Saturday, 13 August 2016

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

1.       What will be the output of the following arithmetic expression?
(A) -34                (B) -37                       
(C) -66               (D) -24
Answer: B
2.       What will be the output of the following statement?
printf( 3 + "goodbye");
(A)  goodbye     (B) odbye
(C)  dbye           (D) bye
Answer: C
3.       What punctuation is used to signal the beginning and end of code blocks?
(A) { }                              (B) -> and <-
(C) BEGIN and END   (D) ( and )
Answer: A
4.       The file iostream includes .................
(A) the declarations of the basic standard input-output library.
(B) the streams of includes and outputs of program effect.
(C) both of these
(D) none of these.
Answer: A
5.       If x is one dimensional array, then pick up the correct answer
(A) *(x + i) is same as &x[i]     (B) *&x[i] is same as x + i
(C) *(x + i) is same as x[i] +1  (D) *(x + i) is same as *x[i]
Answer: A
num[i] is same as *(num+i)

6.       The function ftell ()
(A) reads a character from a file
(B) reads an integer from a file
(C) gives the current position in the file
(D) sets the position to the beginning of the file.
Answer: C
ftell() takes a file pointer and returns a number of type long, that corresponds to the current position.
7.       The continue statement ..................
(A) resumes the program if it is hanged
(B) resumes the program if it was break was applied
(C) skips the rest of the loop in current iteration
(D) executes the entire iteration
Answer: C
8.       The code ifstream fin; would be used when ..................
(A) creating a file         (B) reading a file
(C) appending a file    (D) removing a file
Answer: B
9.       The conditional compilation ................
(A) is taken care of by the compiler
(B) is setting the compiler option conditionally
(C) is compiling a program based on a condition
(D) none of the above
Answer: C
10.    If ‘y’ is of integer type then the expressions
3* (y − 8)/9 and (y − 8)/9 * 3
(A) must yield the same value.
(B) must yield different values.
(C) may or may not yield the same value.
(D) none of the above.
Answer: C
The expression may or may not yield the same value.


Post a Comment