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-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 -4

    Question 1:   cin extraction stops execution as soon as it finds any blank space character   a.       true b.      false   Question 2:   Observe the following statements and decide what do they do.   string mystring;   getline(cin, mystring);   a.       reads a line of string from cin into mystring b.      reads a…

  • C++ MCQ -8

    Question 1 Identify the correct statement a. Programmer can use comments to include short explanations within the source code itself. b. All lines beginning with two slash signs are considered comments. c. Comments very important effect on the behaviour of the program d. both   Question 2 The directives for the preprocessors begin with a.   …

  • C++ MCQ -2

    Question 1: The void specifier is used if a function does not have return type. a.       True b.      False   Question 2: You must specify void in parameters if a function does not have any arguments. a.       True b.      False   Question 3: Type specifier is optional when declaring a function a.       True b.      False…

  • C++ MCQ-12

    Q.1   The address of a variable temp of type float is          (A) *temp  (B) &temp     (C) float& temp  (D) float temp&     Ans: B   Q.2   What is the output of the following code           char symbol[3]={ΓÇÿaΓÇÖ,ΓÇÿbΓÇÖ,ΓÇÿcΓÇÖ};            for (int index=0; index<3; index++)         cout << symbol…

  • C++ MCQ -7

    Question 1 A variable is/are a.    String that varies during program execution b.    A portion of memory to store a determined value c.    Those numbers that are frequently required in programs d.    None of these   Question 2 Which of the following can not be used as identifiers? a.    Letters b.    Digits c.    Underscores d.   …

Leave a Reply

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