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.

Predict the output?#include <stdio.h>int main(){void demo();void (*fun)();fun = demo;(*fun)();fun();return 0;}void demo(){printf("GeeksQuiz ");}(A) GeeksQuiz(B) GeeksQuiz GeeksQuiz(C) Compiler Error(D) Blank Screen

Answer»
2.

Output?#include <stdio.h>int main(){int (*ptr)(int ) = fun;(*ptr)(3);return 0;}int fun(int n){for(;n > 0; n--)printf("GeeksQuiz ");return 0;}(A) GeeksQuiz GeeksQuiz GeeksQuiz(B) GeeksQuiz GeeksQuiz(C) Compiler Error(D) Runtime Error

Answer» None
3.

Output of following program?#include<stdio.h>void dynamic(int s, ...){printf("%d ", s);}int main(){dynamic(2, 4, 6, 8);dynamic(3, 6, 9);return 0;}(A) 2 3(B) Compiler Error(C) 4 3(D) 3 2

Answer»
4.

#include <stdio.h>int main(){printf("%d", main);return 0;}(A) Address of main function(B) Compiler Error(C) Runtime Error(D) Some random value

Answer» None
5.

What is the meaning of using static before function declaration?For example following function sum is made staticstatic int sum(int x, int y, int z){ return (x + y + z);}(A) Static means nothing, sum() is same without static keyword.(B) Function need not to be declared before its use(C) Access to static functions is restricted to the file where they are declared(D) Static functions are made inline

Answer»
6.

In C, what is the meaning of following function prototype with empty parameter listvoid fun(){/* .... */}(A) Function can only be called without any parameter(B) Function can be called with any number of parameters of any types(C) Function can be called with any number of integer parameters.(D) Function can be called with one integer parameter.

Answer»
7.

In C, parameters are always(A) Passed by value(B) Passed by reference(C) Non-pointer variables are passed by value and pointers are passed by reference(D) Passed by value result

Answer»
8.

What is the meaning of using extern before function declaration?For example following function sum is made externextern int sum(int x, int y, int z){ return (x + y + z);}(A) Function is made globally available(B) extern means nothing, sum() is same without extern keyword.(C) Function need not to be declared before its use(D) Function is made local to the file.

Answer»
9.

Which of the following is true about return type of functions in C?(A) Functions can return any type(B) Functions can return any type except array and functions(C) Functions can return any type except array, functions and union(D) Functions can return any type except array, functions, function pointer and union

Answer»
10.

#include <stdio.h>#include <stdarg.h>int fun(int n, ...){int i, j = 1, val = 0;va_list p;va_start(p, n);for (; j < n; ++j){i = va_arg(p, int);val += i;}va_end(p);return val;}int main(){printf("%d\n", fun(4, 1, 2, 3));return 0;}(A) 3(B) 5(C) 6(D) 10

Answer»