Online Computer Science Test - Object Oriented Programming Test 1

Instruction:

  • This is a FREE online test. Beware of scammers who ask for money to attend this test.
  • Total number of questions: 20.
  • Time allotted: 30 minutes.
  • Each question carries 1 mark; there are no negative marks.
  • DO NOT refresh the page.
  • All the best!

Marks : 2/20


Total number of questions
20
Number of answered questions
0
Number of unanswered questions
20
Test Review : View answers and explanation for this test.

1.
If you design a class that needs special initialization tasks, you will want to design a(n) _____
housekeeping routine
initializer
constructor
compiler
Your Answer: Option
(Not Answered)
Correct Answer: Option

2.
Redirection redirects
a stream from a file to the screen
a file from a device to a stream
a device from the screen to a file
the screen from a device to a stream
Your Answer: Option
(Not Answered)
Correct Answer: Option

3.
If you declare two objects as Customer firstCust, secondCust; which of the following must be true?
Each object's nonstatic data members will be stored in the same memory location
Each object will be stored in the same memory location
Each object will have a unique memory address
You cannot declare two objects of the same class
Your Answer: Option
(Not Answered)
Correct Answer: Option

4.
A compound statement does not consist of
a single statement
other compound statements
expression statements
control statements
None of the above
Your Answer: Option
(Not Answered)
Correct Answer: Option

5.
Which of the following while clause will stop the loop when the value in the age variable is less than the number 0?
while age < 0
while (age < 0)
while age >= 0;
while (age >= 0);
while (age >= 0)
Your Answer: Option
(Not Answered)
Correct Answer: Option

6.
Which of the following statements will display the word "Hello" on the computer screen?
cin << "Hello";
cin >> "Hello";
cout << "Hello";
cout >> "Hello";
None of the above
Your Answer: Option
(Not Answered)
Correct Answer: Option

7.
The continue statement should be written only
in the body of a loop.
in the nested loops
outside the body of a loop
any where
None of the above
Your Answer: Option
(Not Answered)
Correct Answer: Option

8.
The most common operation used in constructors is _____
addition
overloading
assignment
polymorphism
Your Answer: Option
(Not Answered)
Correct Answer: Option

9.
If an integer object is thrown with a throw statement, then a subsequent catch block has a usable match if the type of the catch argument is _____
const int &
int &
either (a) or (b)
neither (a) nor (b)
Your Answer: Option
(Not Answered)
Correct Answer: Option

10.
The statement int num[2][3]={ {3,8,6}, {9,4,7}};
assigns a value 4 to num[1][2]
assigns a value 7 to num[1][2]
assigns a value 8 to num[1][2]
assigns a value 9 to num[1][2]
Your Answer: Option
(Not Answered)
Correct Answer: Option

11.
The end of string is recognized by
the null character
the newline character
the $ sign
the / sign
None of the above
Your Answer: Option
(Not Answered)
Correct Answer: Option

12.
Which of the following C++ expressions will find the square root of the number 16?
pow (16, 2) (b) root (16, 2)
sqroot (16)
sqrt (16, 2)
sqrt (16)
Your Answer: Option
(Not Answered)
Correct Answer: Option

13.
The arguments that determine the state of the cout object are called _____
classes
manipulators
format flags
state controllers
Your Answer: Option
(Not Answered)
Correct Answer: Option

14.
Making class members inaccessible to nonmember functions is an example of
polymorphism
data hiding
redundancy
recursion
Your Answer: Option
(Not Answered)
Correct Answer: Option

15.
Assume that your version of C++ can recognize only the first 8 characters of an identifier name, through identifier names may be arbitrarily long. Which of the following identifier names is not distinct:
list, list2
address, Address
identifier_l, identifier_2
answer, ANSWER
None of the above
Your Answer: Option
(Not Answered)
Correct Answer: Option

16.
The string HELLO WORLD needs
11 bytes
12 bytes
10 Bytes
8 bytes
None of the above
Your Answer: Option
(Not Answered)
Correct Answer: Option

17.
The null character is represented by
\n
\0
\o
\r
None of the above
Your Answer: Option
(Not Answered)
Correct Answer: Option

18.
The C++ keyword for declaring a variable that contains a decimal point is _____
dec
decimal
float
floater
None of the above
Your Answer: Option
(Not Answered)
Correct Answer: Option

19.
Which is a good guideline for creating function names?
Use all lowercase letters to identify the functions as C++ functions
Use long names to reduce the likelihood of creating a duplicate function name
Use abbreviations as much as possible to save both keystrokes and memory
Avoid the use of digits because they are easily confused with letters
Your Answer: Option
(Not Answered)
Correct Answer: Option

20.
To write data that contains variables of type float, to an object of type ofstream, you should use
the insertion operator
seekg()
writeQ
put()
Your Answer: Option
(Not Answered)
Correct Answer: Option

*** END OF THE TEST ***
Time Left: 00:29:56
Post your test result / feedback here: