Folder101   Home Notes Quiz Assigns Info  
Forum Forum
101 Home 101
 
  C++ Level 2

Practice Test 1


There are 20 questions in this test

Question 1: Multiple Choice       

Comment lines are:

Choice 1 included in the executable code
Choice 2 compiled in the object code
Choice 3 ignored by the compiler
Choice 4 ignored by the linker

Question 2: Multiple Choice       

A syntax error is signalled by the:

Choice 1 editor
Choice 2 compiler
Choice 3 linker
Choice 4 run time system

Question 3: Multiple Choice       

When a program is running the value of a constant:

Choice 1 is always hidden
Choice 2 can be changed
Choice 3 cannot be used
Choice 4 cannot be changed.

Question 4: Multiple Choice      

Which one of the following is a loop construct that will always be executed once:

Choice 1 while
Choice 2 for
Choice 3 switch
Choice 4 do…while

Question 5: Multiple Choice       

The type of a function/procedure/module is determined by:

Choice 1 its arguments
Choice 2 the value returned
Choice 3 its name
Choice 4 the address returned

Question 6: Multiple Choice     

Which type of code is editable?

Choice 1 object
Choice 2 executable
Choice 3 library
Choice 4 source

Question 7: Multiple Choice       

Typically a variable defined in a function/procedure/module has:

Choice 1 local scope
Choice 2 scope for the whole file
Choice 3 global scope
Choice 4 retains its value between calls

Question 8: Multiple Choice       

A program construct used for selection is:

Choice 1 while loop
Choice 2 if…else
Choice 3 for loop
Choice 4 a sequence

Question 9: Multiple Choice       

What is the result of the following expression?

5+((2*(9+5))-4)/2

Choice 1 12.5
Choice 2 14.5
Choice 3 17
Choice 4 15

Question 10: Multiple Choice       

What is the result of the following expression?

6+12*3-4/2

Choice 1 22
Choice 2 25
Choice 3 40
Choice 4 52

Question 11: Multiple Choice       

A run-time error is ALWAYS caused by:

Choice 1 error in syntax
Choice 2 division by zero
Choice 3 incorrect logic
Choice 4 incorrect linkage

Question 12: Multiple Choice       

Test results are proved by a comparison of:

Choice 1 expected to actual output
Choice 2 logical to syntax errors
Choice 3 expected to actual input
Choice 4 run time to logical errors

Question 13: Multiple Choice       

An argument passed by reference passes:

Choice 1 a value
Choice 2 a global variable
Choice 3 a constant
Choice 4 an address

Question 14: Multiple Choice       

How many characters can a string hold when declared as follows?

char name[20];

Choice 1 18
Choice 2 19
Choice 3 20
Choice 4 21

Question 15: Multiple Choice       

Directives are translated by the:

Choice 1 linker
Choice 2 pre-processor
Choice 3 compiler
Choice 4 editor

Question 16: Multiple Choice       

Every call to a function is checked by the compiler against the:

Choice 1 function prototype
Choice 2 parameter list
Choice 3 variable description
Choice 4 program prototype

Question 17: Multiple Choice       

The function atoi() returns the type:

Choice 1 integer
Choice 2 char
Choice 3 float
Choice 4 double

Question 18: Multiple Choice       

How many bytes does “D” use?

Choice 1 0
Choice 2 1
Choice 3 2
Choice 4 3

Question 19: Multiple Choice       

A standalone executable file requires:

Choice 1 a development environment
Choice 2 no run time system
Choice 3 a run time system
Choice 4 compilation

Question 20: Multiple Choice       

What is the result after execution of the following code if a is 10, b is 5 and c is 10?

if((a>b) && (a<=c))
a = a + 1;
else
c = c + 1;

Choice 1 a = 10, c = 10
Choice 2 a = 11, c = 10
Choice 3 a = 10, c = 11
Choice 4 a = 11, c = 11