Saturday, 13 August 2016

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

1.       When using a built-in function, you must ................
(A) include the function's prototype
(B) include the proper header file
(C) include the function's definition
(D) specify the length of the library function
Answer: D
2.       Which is not dynamic memory allocation function?
(A) malloc          (B) free
(C) alloc             (D) calloc
Answer: C
Explanation:
Three dynamic memory allocation functions are: malloc, calloc and free
3.       The library function isalpha( ) requires the header file ................
(A) <ctype.h>    (B) <math.h>
(C) <time.h>      (D) <stdlib.h>
Answer: A
4.       Which of the following can not be used as identifiers?
(A) letters                       (B) digits
(C) underscores           (D) spaces
Answer: D
5.       Which of the following identifiers is invalid?
(A) papername             (B) writername
(C) typename               (D) printname
Answer: C

6.       Array indexing always starts with the number .................
(A) 0                   (B) 1
(C) a                   (D) \0
Answer: A
7.       The expression x = 4 + 2 % - 8 evaluates to
(A) -6      (B) 6
(C) 4       (D) None of the above
Answer: B
8.       Hierarchy decides which operator ..............
(A) is most important   (B) is used first
(C) is fastest                 (D) operates on largest numbers
Answer: B
9.       When a data type must contain decimal numbers, the data type assigned is ................
(A) int                 (B) char
(C) double         (D) long int
Answer: C
10.    In the for statement: for (exp1; exp2; exp3) { … }
where exp1, exp2 and exp3 are expressions. What is optional?
(A) None of the expressions is optional.
(B) Only exp1 is optional.
(C) Only exp1 and exp3 are optional.
(D) All the expressions are optional.
Answer: D
Explanation:
All the expressions are optional. For (;;) is a valid statement in C.


0 comments:

Post a Comment

UGC NET Computer Science

Computer GK App