wayground logo

Free Printable Worksheets

NEW

Font size

S
M
L
XL
Worksheets

C++ : Assignment 6

Total questions: 10

Worksheet time: 5mins

Name
Class
Date
1.

Object _______ and operator _______ are used for reading

a)

cin >>

b)

cout <<

c)

cin <<

d)

none of the above

2.

Manipulators without parameters such as endl, hex, dec etc are defined in __________ file.

a)

iomanip.h

b)

conio.h

c)

io.h

d)

fstream.h

e)

none of the above

3.

Of the following, _________ is not a manipulator.

a)

dec

b)

scientific

c)

endl

d)

flush

e)

hex

4.

Which of the following manipulator is used for the representing octal equivalent of a given decimal number ?

a)

oct

b)

setbase(8)

c)

tobase(8)

d)

both a and b

e)

all a, b, c

5.

Predict the output:


int x = 786;

cout <<setfill(‘*’)<<setw(6)<<x;

a)

786***

b)

**786

c)

***786

d)

******

6.

Predict the output:


float x= 3.1496;

cout<<setprecision(2)<<x;

a)

3.1

b)

3.15

c)

3.149

d)

None of these

7.

if you have to make decision based on multiple choices, which of the following is best suited?

a)

if

b)

if-else

c)

if-else-if

d)

All of the above

8.

In situations where we need to execute body of the loop before testing the condition, we should use_____.

a)

for loop

b)

while loop

c)

do-while loop

d)

nested for loop

9.

Which of the following can replace a simple if -else construct?

a)

Ternary operator

b)

while loop

c)

do-while loop

d)

for loop

10.

The switch statement is also called as?

a)

choosing structure

b)

selective structure

c)

certain structure

d)

bitwise structure