wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

Programming C++

Total questions: 8

Worksheet time: 8mins

Name
Class
Date
1.

What will be displayed on the console ?

string str = "zqwyrqwou";

char ch = str[4];

Console.WriteLine(ch);

a)

z

b)

q

c)

w

d)

r

2.

What will be displayed on the console after running this program?

char ch = (char)125;

Console.WriteLine(ch);

a)

125

b)

15

c)

char

d)

}

3.

Which data type stores 1 character?

a)

char

b)

int

c)

float

d)

class

4.

Select the line with the error.

a)

while(true){}

b)

while(1 == 1){}

c)

while(int 1){}

d)

while(false){}

5.

What value can the "float" data type store?

a)

12.5

b)

string

c)

=

d)

void

6.

How do I create a "float" array correctly?

a)

float[] array =new string[10];

b)

float[] array =new float[10];

c)

float[] array = 1;

d)

float[] =new float[10] array;

7.

What value can the "int" data type store?

a)

1.5

b)

0.5 * 3

c)

2

d)

string

8.

How do I create a loop that repeats 10 times ?

a)

for ( i < 10) { }

b)

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

c)

for (int i = 0; i < 10; ) { }

d)

for (int i = 0;) { }