C++ MCQ -1

Question 1.

What is the correct value to return to the operating system upon the successful completion of a program?
A. -1
B. 1
C. 0
D. Programs do not return a value.

 
Question 2.

What is the only function all C++ programs must contain?
A. start()
B. system()
C. main()
D. program()

 
Question 3.

What punctuation is used to signal the beginning and end of code blocks?
A. { }
B. -> and <-
C. BEGIN and END
D. ( and )

 
Question 4.

What punctuation ends most lines of C++ code?
A. . (dot)
B. ; (semi-colon)
C. : (colon)
D. ‘ (single quote)

 
Question 5.

Which of the following is a correct comment?
A. */ Comments */
B. ** Comment **
C. /* Comment */
D. { Comment }

 
Question 6.

Which of the following is not a correct variable type?
A. float
B. real
C. int
D. double

 
Question 7.

Which of the following is the correct operator to compare two variables?
A. :=
B. =
C. equal
D. ==

 
Question 8.

Which of the following is true?
A. 1
B. 66
C. .1
D. -1
E. All of the above

 
Question 9.

Which of the following is the boolean operator for logical-and?
A. &
B. &&
C. |
D. |&

 
Question 10.

Evaluate !(1 && !(0 || 1)).
A. True
B. False
C. Unevaluatable

Answers

1. C. 0

2. C. main()

3. A. { }

4. B. ;

5. C. /* Comment */

6. B. real

7. D. ==

8. E. All of the above

9. B. &&

10. A. True

Similar Posts

  • C++ MCQ-10

    Q.16   If we create a file by ΓÇÿifstreamΓÇÖ, then the default mode of the file is _________    (A)  ios :: out  (B)  ios :: in (C)  ios :: app  (D)  ios :: binary     Ans: B   Q.17   A variable defined within a block is visible        (A) from the point of…

  • C++ MCQ-11

    Q.31  Use of virtual functions implies (A)  overloading.  (B)  overriding. (C)  static binding.  (D)  dynamic binding. Ans: D   Q.32   this pointer      (A)  implicitly points to an object.    (B)  can be explicitly used in a class. (C)  can be used to return an object.   (D)  All of the above.    Ans: D…

  • C++ MCQ-15

    Q.76   Which of the following expressions is illegal? (A)  ( ) 6 10 .  (B)  (false && true) (C)  bool (x) = (bool)10;  (D)  float y = 12.67;       Ans:C   Q.77  The actual source code for implementing a template function is created when   (A) The declaration of function appears. (B) The…

  • C++ MCQ -9

    Question 1: A function can not be overloaded only by its return type. a. True b. False   Question 2: A function can be overloaded with a different return type if it has all the parameters same. a. True b. False   Question 3: Inline functions involves some additional overhead in running time. a. True…

  • C++ MCQ -6

    Question 1 In an assignment statement a=b; Which of the following statement is true? a.    The variable a and the variable b are equal. b.    The value of b is assigned to variable a but the later changes on variable b will not effect the value of variable a c.    The value of b is…

  • C++ MCQ-16

    Q.91   What will be the result of the expression 13 & 25? (A) 38  (B)  25 (C)  9  (D)  12      Ans:C  Q.92   Which of the following operator can be overloaded through friend function? (A)  ->   (B)  = (C)  ( )   (D)  *        Ans:D   Q.93  To access the public function…

Leave a Reply

Your email address will not be published. Required fields are marked *