Thursday, 18 August 2016

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

1.       ‘C’ allows a three-way transfer of control with the help of
(A) unary operator                   (B) relational operator
(C) ternary operator                 (D) comparison operator
Answer: C
2.       The switch expression must be of type .................. or .................
(A) char,float                 (B) float,int
(C) int, char                   (D) char, float
Answer: C
3.       The second expression (j – k) in the following expression will be evaluated
(i + 5) && (j – k)
(A) if expression (i + 5) is true.
(B) if expression (i + 5) is false.
(C) irrespective of whether (i + 5) is true or false.
(D) will not be evaluated in any case.
Answer: A
Explanation:
In a compound logical expression combined with &&, the second expression is evaluated only if first is evaluated in true.
4.       If the condition in a for loop is false then .................
(A) code inside loop may not be executed.
(B) program terminates.
(C) code inside loop may be executed atleast once.
(D) shows error.
Answer: A
5.       Which of the following for loop is not correct?
(A) for(;x<10;)               (B) for(; ; ;)
(C) for(; ;)                       (D) for (x=0;x!=123;)
Answer: B

6.       C++ programs start their execution at ................
(A) start()           (B) begin()
(C) main()          (D) output()
Answer: C
7.       Inline is a ................
(A) command                (B) statement
(C) request                    (D) class
Answer: C
8.       The output of the following code segment will be
char x = ‘B’;
switch (x) {
case ‘A’: printf(“a”);
case ‘B’: printf(“b”);
case ‘C’: printf(“c”);
}
(A) B                   (B) b
(C) BC               (D) bc
Answer: D
Explanation:
Since there is no break statement, all the statement after case’B’ are executed.
9.       Size of operator is ................ operator.
(A) compile time           (B) intrinsic
(C) extraction                (D) ternary
Answer: A
10.    A reference parameter is declared by proceeding with ....................
(A) *                    (B) &
(C) &&                (D) ~
Answer: B


0 comments:

Post a Comment

UGC NET Computer Science

Computer GK App