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>char *c[] = {"GeksQuiz", "MCQ", "TEST", "QUIZ"};char **cp[] = {c+3, c+2, c+1, c};char ***cpp = cp;int main(){printf("%s ", **++cpp);printf("%s ", *--*++cpp+3);printf("%s ", *cpp[-2]+3);printf("%s ", cpp[-1][-1]+1);return 0;}(A) TEST sQuiz Z CQ(B) MCQ Quiz Z CQ(C) TEST Quiz Z CQ(D) GarbageValue sQuiz Z CQ

Answer»
2.

#include <stdio.h>int main(){int a[5] = {1,2,3,4,5};int *ptr = (int*)(&a+1);printf("%d %d", *(a+1), *(ptr-1));return 0;}(A) 2 5(B) Garbage Value(C) Compiler Error(D) Segmentation Fault

Answer»
3.

Assume sizeof an integer and a pointer is 4 byte. Output?#include <stdio.h>#define R 10#define C 20int main(){int (*p)[R][C];printf("%d", sizeof(*p));getchar();return 0;}(A) 200(B) 4(C) 800(D) 80

Answer»
4.

#include <stdio.h>#include <stdlib.h>int main(void){int i;int *ptr = (int *) malloc(5 * sizeof(int));for (i=0; i<5; i++)*(ptr + i) = i;printf("%d ", *ptr++);printf("%d ", (*ptr)++);printf("%d ", *ptr);printf("%d ", *++ptr);printf("%d ", ++*ptr);}(A) Compiler Error(B) 0 1 2 2 3(C) 0 1 2 3 4(D) 1 2 3 4 5

Answer»