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

1.       A .................. is a storage location that contains data value.
(A) function      (B) structure
(C) variable       (D) key word
Answer: C
2.       What is the output of the following program?
main ( )
{ int x = 2, y = 5;
if (x < y) return (x = x+y); else printf (“z1”);
printf(“z2”);
}
(A) z2                             (B) z1z2
(C) Compilation error  (D) None of these
Answer: D
Explanation:
There is no compilation error but there will no output because function is returning a value and if statement is true in this case.
3.       .................... is the data type that can accommodate char that require more than 8-bits
(A) char             (B) wchar_t
(C) w char         (D) char_t
Answer: B
4.       The code and data are called ................ of the class.
(A) instances    (B) instance variables
(C) members     (D) object
Answer: C
5.       The ................ is contained in instance variable defined by the class.
(A) data              (B) code
(C) object           (D) function
Answer: A

6.       ................ object is used to print wide characters.
(A) wout             (B) print
(C) w_cout        (D) cout
Answer: A
7.       Which of the following is not true about constants in c++?
(A) It is also called literals
(B) It has not compiled place in memory
(C) It s value cannot be changed
(D) The address value cannot be of constant data type
Answer: D
8.       The escape sequence \onn represents ................
(A) back space             (B) new line
(C) octal number          (D) hexadecimal number
Answer: C
9.       Which of the following is the proper keyword to allocate memory?
(A) new              (B) malloc
(C) create          (D) value
Answer: B
10.    Which of the following is the proper keyword to deallocate memory?
(A) free              (B) delete
(C) clear                        (D) remove
Answer: A


Post a Comment

0 Comments