wayground logo

Free Printable Worksheets

NEW

Font size

S
M
L
XL
Worksheets

Programming with C++

Total questions: 15

Worksheet time: 8mins

Name
Class
Date
1.

The value 132.54 can be represented using which data type?

a)

double

b)

void

c)

int

d)

bool

2.

Which of the following statements are true? int f(float)

a)

f is a function taking an argument of type int and returning a floating point number

b)

f is a function taking an argument of type float and returning an integer

c)

f is a function of type float

d)

none of the mentioned

3.

Identify the user-defined types from the following

a)

enumeration

b)

classes

c)

both enumeration and classes

d)

int

4.

Which type is best suited to represent the logical values?

a)

integer

b)

boolean

c)

character

d)

all the mentioned

5.

Which data type is used to represent the absence of parameters?

a)

int

b)

short

c)

void

d)

float

6.

Pick the odd one out

a)

array type

b)

character type

c)

boolean type

d)

integer type

7.

In which type do the enumerators are stored by the compiler?

a)

string

b)

integer

c)

float

d)

none of the mentioned

8.

Which variable does equals in size with enum variable?

a)

int variable

b)

float variable

c)

string variable

d)

none of the mentioned

9.

What are the parts of the literal constants?

a)

integer numerals

b)

floating-point numerals

c)

strings and boolean values

d)

all of the mentioned

10.

What is the output of this program?#include <iostream> using namespace std; int main() { int const p = 5; cout << ++p; return 0; }

a)

5

b)

6

c)

error

d)

none of the mentioned

11.

What is the output of this program?#include <iostream> using namespace std; #define PI 3.14159 int main () { float r = 2; float circle; circle = 2 * PI * r; cout << circle; return 0; }

a)

12.5664

b)

13.5664

c)

compile error

d)

none of the mentioned

12.

The difference between x and ‘x’ is

a)

The first one refers to a variable whose identifier is x and the second one refers to the character constant x

b)

The first one is a character constant x and the second one is the string literal x

c)

both are the same

d)

none of the above

13.

How to declare a wide character in the string literal?

a)

L prefix

b)

l prefix

c)

W prefix

d)

none of the mentioned

14.

Which of the following will not return a value?

a)

null

b)

void

c)

empty

d)

free

15.

What does the following statement mean?

void a;

a)

variable a is of type void

b)

a is an object of type void

c)

declares a variable with value a

d)

flags an error