wayground logo

Free Printable Worksheets

NEW

Font size

S
M
L
XL
Worksheets

PLD_FinalsSAT Quiz

Total questions: 25

Worksheet time: 25mins

Name
Class
Date
1.

Choose a correct C++ do while syntax.

a)

dowhile(condition) { //statements }

b)

do while(condition) { //statements }

c)

do { //statements }while(condition)

d)

do { //statements }while(condition);

2.

In the following loop construct, which one is executed only once always.

for(statement1; statement2; statement3)

a)

statement1

b)

statement3

c)

statement1 and statement3

d)

statement1,statement2 and statement3

3.

Who is Father of C++ Language

a)

Bjarne Stroustrup

b)

James A. Gosling

c)

Dennis Ritchie

d)

Dr. E.F. Codd

4.
What punctuation is used to indicate the beginning and end of code blocks?
a)
{ }
b)
-> <-
c)
BEGIN and END
d)
( and )
5.

Which of the following is a correct comment?

a)

*/ Comments */

b)

** Comment **

c)

/* Comment */

d)

{ Comment }

6.
Which command moves the shown text to the next line?
a)
\t
b)
\n
c)
\r
d)
\s
7.

Declaration statement for an array named arr with size 4 is

a)

int arr[0];

b)

int arr[5];

c)

int arr(4);

d)

int arr[4];

8.
Which type is incorrect?
a)
int
b)
double
c)
float
d)
array
9.

All keywords in C++ are in ____________

a)

Lowercase

b)

Uppercase

c)

Camelcase

d)

None of these

10.

Every C++ Program Statement must be terminated with a

a)

.

b)

#

c)

;

d)

!

11.

How many choices are possible when using a single if-else statement?

a)

1

b)

2

c)

3

d)

4

12.

What will the result of 'num' variable after execution of the following statements?

int num = 58;

num % = 11;

a)

3

b)

5

c)

8

d)

11

13.

What output is produced by the following segment of code:


for(int i = 0; i < 10; i++)

cout << i << " ";

a)

0 1 2 3 4 5 6 7 8 9 10

b)

0 1 2 3 4 5 6 7 8 9

c)

1 2 3 4 5 6 7 8 9 10

d)

1 2 3 4 5 6 7 8 9

e)

Infinite Loop

14.

True/False: For Loops can never be an infinite loop.

a)

True

b)

False

15.

How many times will the shown for loop execute?

a)

0

b)

9

c)

10

d)

11

16.

What is the only function all C++ programs must contain?

a)

cout()

b)

system()

c)

main()

d)

program()

17.

What is the return type of this function?

a)

a * b

b)

int

c)

void

d)

(int a, int b)

18.

True or false: a function can have an empty parameter list

a)

True

b)

False

19.

True or false: functions can call other functions

a)

True

b)

False

20.

What is the output of the following code snippet?

int x = 5;
int y = 10;
int z = x + y;
cout << z << endl;

a)

15

b)

510

c)

5+10

d)

error

21.

Which keyword is used to define a constant in C++?

a)

constant

b)

const

c)

final

d)

immutable

22.

What is the output of the following code snippet?

int a = 10;
int b = 20;
int c = a * b;
cout << c << endl;

a)

200

b)

30

c)

1020

d)

error

23.

What is the output of the following code snippet?

int x = 8;
int y = 4;
int z = x / y;
cout << z << endl;

a)

2

b)

12

c)

4

d)

error

24.

Who developed the C++ programming language?

a)

Ken Thompson

b)

Bjarne Stroustrup

c)

Linus Torvalds

d)

Tim Berners-Lee

25.

What is the correct syntax for a C++ while loop?

a)

while(condition) { //statements }

b)

while { //statements } (condition)

c)

{ //statements } while(condition)

d)

while(condition) { //statements }