Computer Science Study Materials for Competitive Exams

Sample Questions, Previous Year Solved Papers, Study Materials For Competitive Examinations Like UGC NET, SET And GATE Computer Science.

Saturday, 29 July 2017

C & C++ Programming Multiple Choice Questions - Set 39

1.       The C language includes the header file standard input & output in
(A) stdlib.h library
(B) stdio.h library
(C) conio.h library
(D) #include library
Answer: B
2.       Set of values of the same type, which have a single name followed by an index is called
(A) function
(B) structure
(C) array
(D) union
Answer: C
3.       What will be the output of the following program ?
main()
{
int i = 5;
printf(“%d”, i=++i==6);
}
(A) 0
(B) 1
(C) 7
(D) 6
Answer: B
4.       Determine which of the following is a valid character constant
(A) ‘\\’
(B) ‘\0’
(C) ‘xyz’
(D) ‘\052’
Answer: A
5.       The maximum value that an integer constant can have is
(A) .32767
(B) 32767
(C) 1.7014e+38
(D) –1.7014e+38
Answer: B

6.       The expression X=4+2%-8 evaluates
(A) –6
(B) 6
(C) 4
(D) None
Answer: B
7.       What will be the output of following program ?
main()
{
int x=15;
printf(“\n%d%d%d”, x!=15, x=20, x<30);
}
(A) 0, 20, 1
(B) 15, 20, 30
(C) 0, 0, 0
(D) Error
Answer: A
8.       How many times the following program would print (“abc”) ?
main()
{
printf(“\nabc”);
main();
}
(A) Infinite number of times
(B) 32767 times
(C) 65535 times
(D) Till the stack does not overflow
Answer: A
9.       What would be output of the following program ?
# define SQR(X) (X*X)
main()
{
int a, b=3;
a = SQR(b+2);
printf(“\n%d”, a);
}
(A) 25
(B) 11
(C) Error
(D) Garbage value
Answer: B
10.    What would be output of the following program ?
#include "stdio.h"
main()
{
printf(“%d%d”, size of (NULL!), size of (“ “));
}
(A) 2 1
(B) 1 2
(C) 2 2
(D) 1 1
Answer: C


No comments:

Post a Comment