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

1.       In multi-list organization ..................
(A) records that have equivalent value for a given secondary index item are linked together to form a list.
(B) records are loaded in ordered sequence defined by collating sequence by content of the key
(C) records are directly accessed by record key field
(D) records are directly accessed without record key field
Answer: A
2.       If the variables i, j and k are assigned the values 5,3 and 2 respectively, then the expression i = j + ( k + + = 6 ) + 7
(A) gives an error message    (B) assigns a value 16 to i
(C) assigns a value 18 to i     (D) assigns a value 19 to i
Answer: A
Explanation:
It gives an error message-Lvalue required.
3.       In C++, 14 % 4 = ................
(A) 1                   (B) 2
(C) 3                   (D) 4
Answer: B
4.       Which of the following is not a jump statement in C++?
(A) break           (B) goto
(C) exit               (D) switch
Answer: D
5.       In a for loop, if the condition is missing, then,
(A) It is assumed to be present and taken to be false.
(B) It is assumed to be present and taken to be true.
(C) It results in a syntax error.
(D) Execution will be terminated abruptly.
Answer: B

6.       Choose the correct answer
(A) enum variable cannot be assigned new values
(B) enum variable can be compared
(C) enumeration feature increase the power of C
(D) None of the above
Answer: C
Explanation:
The enumerated data types give an opportunity to invent our own data type and define what value the variable of this data type can take.
7.       How do we declare an interface class?
(A) By making all the methods pure virtual in a class
(B) By making all the methods abstract using the keyword abstract in a class
(C) By declaring the class as interface with the keyword interface
(D) It is not possible to create interface class in C++
Answer: A
8.       How many copies of a class static member are shared between objects of the class?
(A) A copy of the static member is shared by all objects of a class
(B) A copy is created only when at least one object is created from that class
(C) A copy of the static member is created for each instantiation of the class
(D) No memory is allocated for static members of a class
Answer: A
9.       Consider the following declaration
int a, *b = &a, **c = &b;
The following program fragment
a = 4;
**c = 5;
(A) does not change the value of a (B) assigns address of c to a
(C) assigns the value of b to a          (D) assigns 5 to a
Answer: D
Explanation:
The given statements assigns 5 to a
10.    Which of the following is true about const member functions?
(A) const members can be invoked on both const as well as nonconst objects
(B) const members can be invoked only on const objects and not on nonconst objects
(C) nonconst members can be invoked on const objects as well as nonconst objects
(D) none of the above
Answer: A


Post a Comment

0 Comments