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

1.       An ................. is an instance of class.
(A) class                        (B) object
(C) variable       (D) pointer
Answer: B
2.       Public, private, protected are .................
(A) identifiers                (B) keywords
(C) access specifiers  (D) type of class
Answer: C
3.       The output of the following program is
main( )
{ float y;
y=198.7361;
printf(“%7.2f”, y);
}
Answer: C
Explanation:
The printf statement is giving formatted output till two places of decimal.
4.       The ............... access specifier allows functions or data to be accessible to other parts of the program.
(A) private         (B) protected
(C) public          (D) inherited
Answer: C
5.       What punctuation ends most lines of C++ code?
(A) . (dot)                       (B) ; (semi-colon)
(C) : (colon)                   (D) ' (single quote)
Answer: B

6.       Which of the following statement is true about preprocessor directives?
(A) these are lines read and processed by the pre-processor.
(B) they do not produce any code by themselves.
(C) these must be written on their own line.
(D) they end with a semicolon.
Answer: D
7.       When writing comments you can ...................
(A) use code and /* comment on the same line.
(B) use code and // comments on the same line.
(C) use code and //* comments on the same line.
(D) use code and <!- comments on the same line.
Answer: B
8.       C language has been developed by ..................
(A) Ken Thompson      (B) Dennis Ritchie
(C) Peter Norton          (D) Martin Richards
Answer: B
9.       A self contained block of statements that perform a coherent task of some kind is called a ....................
(A) Monitor        (B) Function
(C) Program      (D) Structure
Answer: B
10.    Recursion is sometimes called ..................
(A) Circular definition (B) Complex definition
(C) Procedure              (D) Union
Answer: A


Post a Comment

0 Comments