QN1 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
Answer
Answer: d
QN2. What is the only function all C++ programs must contain?
A. start()
B. system()
C. main()
D. program()
Answer
Answer: C
QN3. What punctuation is used to signal the beginning and end of code blocks?
A. { }
B. -> and <-
C. BEGIN and END
D. ( and )
Answer
Answer: A
QN4. What punctuation ends most lines of C++ code?
A. . (dot)
B. ; (semi-colon)
C. : (colon)
D. ‘ (single quote)
Answer
Answer: B
QN5. Which of the following is a correct comment?
A. */ Comments */
B. ** Comment **
C. /* Comment */
D. { Comment }
Answer
Answer: C
QN6. Which of the following is not a correct variable type?
A. float
B. real
C. int
D. double
Answer
Answer: B
QN7. Which of the following is the correct operator to compare two variables?
A. :=
B. =
C. equal
D. ==
Answer
Answer: D
QN8. Which of the following is true?
A. 1
B. 66
C. .1
D. -1
E. All of the above
Answer
Answer: E
QN9. Which of the following is the boolean operator for logical-and?
A. &
B. &&
C. |
D. |&
Answer
Answer: B
QN10. Evaluate !(1 && !(0 || 1)).
A. True
B. False
C. Unevaluatable
Answer
Answer: A
QN11. Every statement in C++ program should end with
a. A full stop (.)
b. A Comma (,)
c. A Semicolon (;)
d. A colon (:)
Answer
Answer: C
QN12. C++ was originally developed by
1. Nicolas Wirth
2. Donald Knuth
3. Bjarne Stroustrup
4. Ken Thompson
Answer
Answer: 3
QN13. The standard c++ comment
1. /
2. //
3. /* and */
4. None of these
Answer
Answer: 2
QN14. The preprocessor directive #include is required if
1. Console output is used
2. Console input is used
3. Both console input and output is used
4. None of these
Answer
Answer: 3
QN15. The operator << is called
1. an insertion operator
2. put to operator
3. either a or b
4. None of these
Answer
Answer: 3
QN16. The operator >> is called
1. an extraction operator
2. a get from operator
3. either a or b
4. get to operator
Answer
Answer: 3
QN17. When a language has the capability to produce new data type, it is called
1. Extensible
2. Overloaded
3. Encapsulated
4. Reprehensible
Answer
Answer: 1
QN18. The C++ symbol <<
1. perform the action of sending the value of expression listed as its right to the outputs strewn as the left.
2. is used to indicate the action from right to left
3. is adopted to resemble an arrow
4. All the above
Answer
Answer: 4
QN19. What is a reference?
1. an operator
2. a reference is an alias for an object
3. used to rename an object
4. None of these
Answer
Answer: 2
QN20. A constructor is called whenever
1. a object is declared
2. an object is used
3. a class is declared
4. a class is used
Answer
Answer: 1
QN21. State the object oriented languages
1. C++
2. Java
3. Eiffel
4. All of the above
Answer
Answer: 4
QN22. Overload function in C++
1. a group function with the same name
2. all have the same number and type of arguments
3. functions with same name and same number and type of arguments
4. All of the above
Answer
Answer: 1
QN23. Operator overloading is
1. making c++ operators works with objects
2. giving new meaning to existing c++ operators
3. making new c++ operator
4. both a& b above
Answer
Answer: 4
QN24. A constructor is called whenever
1. a object is declared
2. an object is used
3. a class is declared
4. a class is used
Answer
Answer: 1
QN25. A class having no name
1. is not allowed
2. can’t have a constructor
3. can’t have a destructor
4. can’t be passed as an argument
Answer
Answer: 3
QN26. The differences between constructors and destructor are
1. constructors can take arguments but destructor can’t
2. constructors can be overloaded but destructors can’t be overloaded
3. both a & b
4. None of these
Answer
Answer: 3
QN27. A destructor takes
1. one argument
2. two arguments
3. three arguments
4. Zero arguments
Answer
Answer: 4
QN28. Constructors are used to
1. initialize the objects
2. construct the data members
3. both a & b
4. None of these
Answer
Answer: 1
QN29. In C++ a function contained with in a class is called
1. a member function
2. an operator
3. a class function
4. a method
Answer
Answer: 1
QN30. The fields in a class of a c++ program are by default
1. protected
2. public
3. private
4. None
Answer
Answer: 3
QN31. 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
Answer
Answer: b
QN32. Which of the following can not be used as identifiers?
a. Letters
b. Digits
c. Underscores
d. Spaces
Answer
Answer: d
QN33. 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
Answer
Answer: a
QN34. 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
Answer
Answer: d
QN35. 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
Answer
Answer: c
QN36. If you use same variable for two getline statements
a. Both the inputs are stored in that variable
b. The second input overwrites the first one
c. The second input attempt fails since the variable already got its value
d. You can not use same variable for two getline statements
Answer
Answer: b
QN37. The “return 0;” statement in main function indicates
a. The program did nothing; completed 0 tasks
b. The program worked as expected without any errors during its execution
c. not to end the program yet.
d. None of above
Answer
Answer: b
QN38. The size of following variable is not 4 bytes in 32 bit systems
a. int
b. long int
c. short int
d. float
Answer
Answer: c
QN39. Identify the correct statement regarding scope of variables
a. Global variables are declared in a separate file and accessible from any program.
b. Local variables are declared inside a function and accessible within the function only.
c. Global variables are declared inside a function and accessible from anywhere in program.
d. Local variables are declared in the main body of the program and accessible only from functions.
Answer
Answer: b
QN40 cin extraction stops execution as soon as it finds any blank space character
a. true
b. false
Answer
Answer: a