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

1.       If you use same variable for two getline statements ..................
(A) both the inputs are stored in that variable.
(B) the second input overwrites the first one.
(C) the second input attempt fails since the variable already got its value.
(D) you can not use same variable for two getline statements.
Answer: B
2.       Which of the following is not a reserve keyword in C++?
(A) mutable       (B) default
(C) readable     (D) volatile
Answer: D
3.       The size of following variable is not 4 bytes in 32 bit systems is ...............
(A) int                 (B) long int
(C) short int       (D) float
Answer: C
4.       The variable that are declared outside all the functions are called ............
(A) Local variable        (B) Global variable
(C) Auto variable         (D) None of the above
Answer: B
Explanation:
The variables that are declared outside all functions are called global variable.
5.       Consider the following statements:
int x = 6, y=8, z, w;
y = x++;
z = ++x;
The value of x,y,z by calculating the above expressions are:-
(A) y=8, z=8, x=6          (B) y=6, x=8, z=8
(C) y=9, z=7, x=8          (D) y=7, x=8, z=7
Answer: B
Explanation:
y is assigned value of x that is 6, then x in incremented that is value of x=7, z is assigned value of x after incrementing that is z = 8 so value of x = 8.

6.       Every function in C++ is followed by ...................
(A) parameters             (B) parenthesis
(C) curly braces           (D) none of these
Answer: B
7.       Which of the following is false?
(A) cout represents the standard output stream in c++
(B) cout is declared in the iostream standard file
(C) cout is declared within the std namespace
(D) none of above
Answer: D
8.       Every statement in C++ program should end with a ................
(A) full stop (.)               (B) comma (,)
(C) semicolon (;)          (D) colon (:)
Answer: C
9.       The size of operator returns the size of variable or type in ...............
(A) bits               (B) nibble
(C) bytes            (D) char
Answer: C
10.    The .................. functions are implementation independent.
(A) inline                       (B) accessor
(C) member                   (D) recursive
Answer: A


Post a Comment

0 Comments