C++ MCQ Quiz 1 (Basic) |
C++ Quiz 2 (Function-Class) |
Ad. C++ Quiz 3 (OOP-Function-Class-Object) |
As we know C++ MCQ Quiz are very important for Computer Science and IT class student and also for IT job interview and entrance exam.
It has 3 mcq section questions set about various C++ subject with function of C++, OOP funciton of C++ and Class object. Let’s get started.
Return to Programming Language Quiz List
Complete C++ MCQ Quiz
Question 1: What is the correct value to return to the operating system upon the successful completion of a program?
(A) 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) Unevaluable
(D) None
Question 11: 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) All of above
Question 12: The directives for the preprocessor begin with __________ .
(A) Ampersand symbol (&)
(B) Two Slashes (//)
(C) Number Sign (#)
(D) Less than symbol (<)
Question 13: 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 14: 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 15: Every function in C++ are followed by ________ .
(A) Parameters
(B) Parenthesis
(C) Curly braces
(D) None of these
Question 16: 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 17: Every statement in C++ program should end with _______ .
(A) A full stop (.)
(B) A Comma (,)
(C) A Semicolon (;)
(D) A colon (:)
Question 18: 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 19: 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 20: 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
Question 21: 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 22: Which of the following cannot be used as identifiers?
(A) Letters
(B) Digits
(C) Underscores
(D) Spaces
Question 23: Which of the following identifiers is invalid?
(A) papername
(B) writername
(C) typename
(D) printname
Question 24: Which of the following can not be used as valid identifier?
(A) bitand
(B) bittand
(C) biand
(D) band
Question 25: 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 26: Which of the following is not a valid escape code?
(A) \t
(B) \v
(C) \f
(D) \w
Question 27: 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 28: 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++
(D) None of the above
Question 29: Regarding following statement which of the statements is true?
const int pathwidth=100;
(A) Declares a variable pathwidth with 100 as its initial value
(B) Declares a construction pathwidth with 100 as its initial value
(C) Declares a constant pathwidth whose value will be 100
(D) Constructs an integer type variable with pathwidth as identifier and 100 as value
Question 30: In an assignment statement ____________.
(A) The lvalue must always be a variable
(B) The rvalue might be a constant, a variable, an expression or any combination of these
(C) The assignment always takes place from right to left and never the other way
(D) All of above