Home
Computer Science and IT MCQs
Introduction to Programming
Quiz # 2, MCQs
-
1)
Computer can understand only machine language code.
- A) True
- B) False
-
2)
Consider the following code segment. What will be the output of following code?
Int addValue (int *a){
int b = (*a) + 2;
return b ;
}
main () {
int x =6 ;
cout << x << “,” ;
cout << addValue(&x) << “,” ;
cout << x ;
}
- A) 6,8,6
- B) 6,6,8
- C) 6,8,8
- D) 6,6,6
-
3)
_______ is used to trace the logic of the program and correct the logical errors.
- A) Compiler
- B) Editor
- C) Linker
- D) Debugger
-
4)
New and delete are _____ whereas malloc and free are _____.
- A) Functions, operators
- B) Classes, operators
- C) Operators, functions
- D) Operators, classes
-
5)
Like member functions, ______ can also access the private data members of a class.
- A) Non-member functions
- B) Friend functions
- C) Any function outside class
- D) None of the given options
-
6)
Which situation would require the use of a non-member overloaded operator?
- A) The overloaded operator is an Assignment operator.
- B) The left most operand is an object of a class.
- C) The left operand is built-in data type.
- D) The operator returns a reference.
-
7)
The stream insertion and stream extraction operators are already overloaded for ______.
- A) User-defined data types
- B) Built-in data types
- C) User-defined and built-in data types
- D) None of the given options
-
8)
If we define an identifier with the statement #define PI 3.1415926 then during the execution of the program the value of PI __________.
- A) can not be replaced
- B) None of the given options
- C) Remain constant.
- D) can be changed by some operation
-
9)
Assignment operator is -------------------------associative.
- A) right
- B) left
- C) binary
- D) unary
-
10)
When ever dynamic memory allocation is made in C/C++, it is freed_____________.
- A) Explicitly
- B) Implicitly
- C) Both explicitly and implicitly
- D) None of the given options