Explore topic-wise InterviewSolutions in .

This section includes InterviewSolutions, each offering curated multiple-choice questions to sharpen your knowledge and support exam preparation. Choose a topic below to get started.

1.

#include <stdio.h>void f(char**);int main(){char *argv[] = { "ab", "cd", "ef", "gh", "ij", "kl" };f(argv);return 0;}void f(char **p){char *t;t = (p += sizeof(int))[-1];printf("%s\n", t);}(A) ab(B) cd(C) ef(D) gh

Answer»
2.

Assume that float takes 4 bytes, predict the output of following program.#include <stdio.h>int main(){float arr[5] = {12.5, 10.0, 13.5, 90.5, 0.5};float *ptr1 = &arr[0];float *ptr2 = ptr1 + 3;printf("%f ", *ptr2);printf("%d", ptr2 - ptr1);return 0;}(A) 90.5000003(B) 90.50000012(C) 10.00000012(D) 0.5000003

Answer»
3.

Consider a compiler where int takes 4 bytes, char takes 1 byte and pointer takes 4 bytes.#include <stdio.h>int main(){int arri[] = {1, 2 ,3};int *ptri = arri;char arrc[] = {1, 2 ,3};char *ptrc = arrc;printf("sizeof arri[] = %d ", sizeof(arri));printf("sizeof ptri = %d ", sizeof(ptri));printf("sizeof arrc[] = %d ", sizeof(arrc));printf("sizeof ptrc = %d ", sizeof(ptrc));return 0;}(A) sizeof arri[] = 3sizeof ptri = 4sizeof arrc[] = 3sizeof ptrc = 4(B) sizeof arri[] = 12sizeof ptri = 4sizeof arrc[] = 3sizeof ptrc = 1(C) sizeof arri[] = 3sizeof ptri = 4sizeof arrc[] = 3sizeof ptrc = 1(D) sizeof arri[] = 12sizeof ptri = 4sizeof arrc[] = 3sizeof ptrc = 4

Answer»