Online Computer Science Test - Object Oriented Programming Test 1



Loading...  Loading Test...

Instruction:

  • This is a FREE online test. DO NOT pay money to anyone to attend this test.
  • Total number of questions : 20.
  • Time alloted : 30 minutes.
  • Each question carry 1 mark, no negative marks.
  • DO NOT refresh the page.
  • All the best :-).


1.

If you design a class that needs special initialization tasks, you will want to design a(n) _____

A.
housekeeping routine
B.
initializer
C.
constructor
D.
compiler

Your Answer: Option (Not Answered)

Correct Answer: Option C

Learn more problems on : Object Oriented Programming Using C++

Discuss about this problem : Discuss in Forum


2.

Redirection redirects

A.
a stream from a file to the screen
B.
a file from a device to a stream
C.
a device from the screen to a file
D.
the screen from a device to a stream

Your Answer: Option (Not Answered)

Correct Answer: Option A

Learn more problems on : Object Oriented Programming Using C++

Discuss about this problem : Discuss in Forum


3.

If you declare two objects as Customer firstCust, secondCust; which of the following must be true?

A.
Each object's nonstatic data members will be stored in the same memory location
B.
Each object will be stored in the same memory location
C.
Each object will have a unique memory address
D.
You cannot declare two objects of the same class

Your Answer: Option (Not Answered)

Correct Answer: Option C

Learn more problems on : Object Oriented Programming Using C++

Discuss about this problem : Discuss in Forum


4.

A compound statement does not consist of

A.
a single statement
B.
other compound statements
C.
expression statements
D.
control statements
E.
None of the above

Your Answer: Option (Not Answered)

Correct Answer: Option A

Learn more problems on : Object Oriented Programming Using C++

Discuss about this problem : Discuss in Forum


5.

Which of the following statements will display the word "Hello" on the computer screen?

A.
cin << "Hello";
B.
cin >> "Hello";
C.
cout << "Hello";
D.
cout >> "Hello";
E.
None of the above

Your Answer: Option (Not Answered)

Correct Answer: Option C

Learn more problems on : Object Oriented Programming Using C++

Discuss about this problem : Discuss in Forum


6.

Which of the following while clause will stop the loop when the value in the age variable is less than the number 0?

A.
while age < 0
B.
while (age < 0)
C.
while age >= 0;
D.
while (age >= 0);
E.
while (age >= 0)

Your Answer: Option (Not Answered)

Correct Answer: Option E

Learn more problems on : Object Oriented Programming Using C++

Discuss about this problem : Discuss in Forum


7.

The continue statement should be written only

A.
in the body of a loop.
B.
in the nested loops
C.
outside the body of a loop
D.
any where
E.
None of the above

Your Answer: Option (Not Answered)

Correct Answer: Option A

Learn more problems on : Object Oriented Programming Using C++

Discuss about this problem : Discuss in Forum


8.

The statement int num[2][3]={ {3,8,6}, {9,4,7}};

A.
assigns a value 4 to num[1][2]
B.
assigns a value 7 to num[1][2]
C.
assigns a value 8 to num[1][2]
D.
assigns a value 9 to num[1][2]

Your Answer: Option (Not Answered)

Correct Answer: Option B

Learn more problems on : Object Oriented Programming Using C++

Discuss about this problem : Discuss in Forum


9.

The most common operation used in constructors is _____

A.
addition
B.
overloading
C.
assignment
D.
polymorphism

Your Answer: Option (Not Answered)

Correct Answer: Option C

Learn more problems on : Object Oriented Programming Using C++

Discuss about this problem : Discuss in Forum


10.

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 _____

A.
const int &
B.
int &
C.
either (a) or (b)
D.
neither (a) nor (b)

Your Answer: Option (Not Answered)

Correct Answer: Option C

Learn more problems on : Object Oriented Programming Using C++

Discuss about this problem : Discuss in Forum


11.

The end of string is recognized by

A.
the null character
B.
the newline character
C.
the $ sign
D.
the / sign
E.
None of the above

Your Answer: Option (Not Answered)

Correct Answer: Option A

Learn more problems on : Object Oriented Programming Using C++

Discuss about this problem : Discuss in Forum


12.

The arguments that determine the state of the cout object are called _____

A.
classes
B.
manipulators
C.
format flags
D.
state controllers

Your Answer: Option (Not Answered)

Correct Answer: Option C

Learn more problems on : Object Oriented Programming Using C++

Discuss about this problem : Discuss in Forum


13.

Which of the following C++ expressions will find the square root of the number 16?

A.
pow (16, 2) (b) root (16, 2)
B.
sqroot (16)
C.
sqrt (16, 2)
D.
sqrt (16)

Your Answer: Option (Not Answered)

Correct Answer: Option D

Learn more problems on : Object Oriented Programming Using C++

Discuss about this problem : Discuss in Forum


14.

Making class members inaccessible to nonmember functions is an example of

A.
polymorphism
B.
data hiding
C.
redundancy
D.
recursion

Your Answer: Option (Not Answered)

Correct Answer: Option B

Learn more problems on : Object Oriented Programming Using C++

Discuss about this problem : Discuss in Forum


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:

A.
list, list2
B.
address, Address
C.
identifier_l, identifier_2
D.
answer, ANSWER
E.
None of the above

Your Answer: Option (Not Answered)

Correct Answer: Option C

Learn more problems on : Object Oriented Programming Using C++

Discuss about this problem : Discuss in Forum


16.

The C++ keyword for declaring a variable that contains a decimal point is _____

A.
dec
B.
decimal
C.
float
D.
floater
E.
None of the above

Your Answer: Option (Not Answered)

Correct Answer: Option C

Learn more problems on : Object Oriented Programming Using C++

Discuss about this problem : Discuss in Forum


17.

The string HELLO WORLD needs

A.
11 bytes
B.
12 bytes
C.
10 Bytes
D.
8 bytes
E.
None of the above

Your Answer: Option (Not Answered)

Correct Answer: Option A

Learn more problems on : Object Oriented Programming Using C++

Discuss about this problem : Discuss in Forum


18.

The null character is represented by

A.
\n
B.
\0
C.
\o
D.
\r
E.
None of the above

Your Answer: Option (Not Answered)

Correct Answer: Option B

Learn more problems on : Object Oriented Programming Using C++

Discuss about this problem : Discuss in Forum


19.

Which is a good guideline for creating function names?

A.
Use all lowercase letters to identify the functions as C++ functions
B.
Use long names to reduce the likelihood of creating a duplicate function name
C.
Use abbreviations as much as possible to save both keystrokes and memory
D.
Avoid the use of digits because they are easily confused with letters

Your Answer: Option (Not Answered)

Correct Answer: Option D

Learn more problems on : Object Oriented Programming Using C++

Discuss about this problem : Discuss in Forum


20.

To write data that contains variables of type float, to an object of type ofstream, you should use

A.
the insertion operator
B.
seekg()
C.
writeQ
D.
put()

Your Answer: Option (Not Answered)

Correct Answer: Option C

Learn more problems on : Object Oriented Programming Using C++

Discuss about this problem : Discuss in Forum


Submit your test now to view the Results and Statistics with answer explanation.