wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

C/C++ Programming Chapter 2

Total questions: 16

Worksheet time: 9mins

Name
Class
Date
1.

Every C program begins execution at the function

a)

main

b)

void

c)

stdio.h

d)

if

2.

Every function’s body begins with ___ and ends with ___

a)

left brace ({), right brace (})

b)

right brace (}), left brace ({)

c)

semicolon, left brace ({)

d)

printf, right brace (})

3.

Every statement ends with a(n) (a)  

4.

The ___ standard library function displays information on the screen.

a)

printf

b)

scanf

c)

if

d)

readline

5.

The ___ Standard Library function is used to obtain data from the keyboard.

a)

if

b)

printf

c)

scanf

d)

main

6.

The conversion specifier ___ is used in a scanf format control string to indicate

that an integer will be input and in a printf format control string to indicate that an

integer will be output.

a)

%x

b)

%t

c)

%m

d)

%d

7.

Function printf always begins printing at the beginning of a new line.

a)

True

b)

False

8.

Comments cause the computer to display the text after // on the screen when the program is executed.

a)

False

b)

True

9.

The escape sequence \n when used in a printf format control string causes the cursor

to position to the beginning of the next line on the screen.

a)

True

b)

False

10.

The remainder operator (%) can be used only with integer operands.

a)

True

b)

False

11.

All variables must be defined before they’re used.

a)

True

b)

False

12.

All variables must be given a type when they’re defined.

a)

True

b)

False

13.

C considers the variables number and NuMbEr to be identical.

a)

True

b)

False

14.

Definitions can appear anywhere in the body of a function.

a)

True

b)

False

15.

The arithmetic operators *, /, %, + and - all have the same level of precedence.

a)

False

b)

True

16.

A program that prints three lines of output must contain three printf statements.

a)

True

b)

False