You are on page 1of 11

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

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. Ampersand symbol (& b. Two Slashes (//) c. Number Sign (#) d. Less than symbol (<

Question 3
The file iostream includes a. The declarations of the basic standard input-output library. b. The streams of includes and outputs of program effect. c. Both of these d. None of these

Question 4
There is a unique function in C++ program by where all C++ programs start their execution a. Start() b. Begin() c. Main() d. Output()

Question 5
Every function in C++ are followed by a. Parameters b. Parenthesis c. Curly braces d. None of these

Question 6
Which of the following is false? a. Cout represents the standard output stream in c++.

b. Cout is declared in the iostream standard file c. Cout is declared within the std namespace d. None of above

Question 7
Every statement in C++ program should end with a. A full stop (.) b. A Comma (,) c. A Semicolon ( d. A colon (

Question 8
Which of the following statement is true about preprocessor directives? a. These are lines read and processed by the preprocessor b. They do not produce any code by themselves c. These must be written on their own line d. They end with a semicolon

Question 9
A block comment can be written by a. Starting every line with double slashes (//) b. Starting with /* and ending with */ c. Starting with //* and ending with *// d. Starting with <!- and ending with -!>

Question 10
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

Answers
1. b. All lines beginning with two slash signs are considered comments. 2. c. Number Sign (#) 3. a. The declarations of the basic standard input-output library. 4. c. Main() 5. b. Parenthesis 6. d. None of above 7. c. A semicolon 8. d. They end with a semicolon 9. b. Starting with /* and ending with */ 10. b. Use code and // comments on the same line

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. Spaces

Question 3
Which of the following identifiers is invalid?

a. papername b. writername c. typename d. printname

Question 4
Which of the following can not be used as valid identifier? a. bitand b. bittand c. biand d. band

Question 5

The difference between x and x is a. The first one refers to a variable whose identifier is x and the second one refers to the character constant x b. The first one is a character constant x and second one is the string literal x c. Both are same d. None of above

Question 6
Which of the following is not a valid escape code? a. \t b. \v c. \f d. \w

Question 7
Which of the following statement is true? a. String Literals can extend to more than a single line of code by putting a backslash sign at the end of each unfinished line. b. You can also concatenate several string constants separating them by one or several blank spaces, tabulators, newline or any other valid blank character c. If we want the string literal to explicitly made of wide characters, we can precede the constant with the L prefix d. All of above

Question 8
Regarding #difine which of the following statement is false? a. It is not C++ statement but the directive for the preprocessor b. This does not require a semicolon at the end of line c. It is a C++ statement that declares a constant in C++

You might also like