Font size
WorksheetsCPP Mid Term SPOT test
Total questions: 25
Worksheet time: 20mins
Any CPU of computer can understand
High level programming language
machine language
assembly language
English language
In Cpp source code 72, 'z', “3.141 * r”, 3.987 are example of __________
Variable
Strings
Literals
not possible to categories into one option given below
What will be the output of the following Cpp program
2
4
8
program will give error while compiling
Cpp Compiler converts source code in
.cpp file
.obj file
.exe file
.lnk file
What value will get stored in x and n when the part of Cpp code given below get executed
int x , y = 3;
float n, m = 1.5;
x = y*m;
n = x * m;
x = 4 and n = 6
x= 4 and n = 6.0
x = 4.5 and n = 6.75
x = 5 and n = 7.5
Directives are translated by the
Pre-processor
Compiler
Linker
Editor
What will the result of 'num' variable after execution of the following statements?
int num = 58;
num % = 11;
3
5
8
11
What will the result of num1 variable after execution of the following statements?
int j = 1, num1 = 4;
while (++j <= 10)
{
num1++;
}
11
12
13
14
What output is produced by the following segment of code:
for(int i = 0; i < 10; i++)
cout << i << " ";
0 1 2 3 4 5 6 7 8 9 10
0 1 2 3 4 5 6 7 8 9
1 2 3 4 5 6 7 8 9 10
1 2 3 4 5 6 7 8 9
Infinite Loop
True/False: For Loops can never be an infinite loop.
True
False
How many times will the shown for loop execute?
0
9
10
11
What does <= mean?
less than
greater than
less than or equal to
greater than or equal to
What is the only function all C++ programs must contain?
cout()
system()
main()
program()
Which of the following is a correct comment?
*/ Comments */
** Comment **
/* Comment */
{ Comment }
Which command moves the shown text to the next line?
\t
\n
\r
/n
After running the following code, what will be the value of x?
y = 3;
x = 5 * (++y);
15
5
15
20
Do while loops
Runs a statement once
Runs a statement twice
Runs a statement multiple times or not within a boolean condition
Doesn't run at all
Switch Statement
Is a statement with a set of conditions called cases
Is a case
Is a condition with no cases
Is a boolean statement
Cpp Compiler converts source code in
.cpp file
.obj file
.exe file
.lnk file
What is the difference when allocating the following memory?
int array1[15];
int array2[3][5];
array1 is larger
array2 is larger
The size allocated is the same
Fill in the blank to make the variable num a constant.
_______int num=2;
con
constant
const
constans
Fill in the missing parentheses to have x equal 15.
int x =__2 + 3__* 3;
Console.WriteLine(x);
(....)
{.....}
<....>
|.....|
What is the alternative for x = x + 5?
x += 5;
x -= 4;
x = y + 5;
x=+5
Evaluate the following expressions to true or false
3!=4-1
true
False
Evaluate the following expressions to true or false
5+1==6 || 8-1>4
True
False
