wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

IPC144 - Week 3

Total questions: 28

Worksheet time: 14mins

Name
Class
Date
1.

What is the size of char?

a)

8 Bits

b)

8 Bytes

c)

4 Bits

d)

4 Bytes

2.

What is the size of an int? (in a 32-bit environment)

a)

4 Bytes

b)

16 Bytes

c)

2 Bytes

d)

8 Bytes

3.

Which is an example of postfix operator?

a)

i++

b)

++i

4.

Which of the following is a prefix operator?

a)

++i

b)

i++

5.

What does "const" keyword signify in a declaration? (ex. "const int x = 7")

a)

That "x" can be changed after initialization

b)

That "x" cannot be changed after initialization

c)

That "x" is a super int

6.

Select the variable which doesn't comply with naming conventions

a)

int auto = 7;

b)

int 8auto = 7;

c)

int auto_word = 7;

d)

int _auto = 7;

7.

What does the backslash (\) signify when placed before a symbol?

a)

A hack in the mainframe

b)

An entrance sequence

c)

An escape sequence

8.

\n signifies:

a)

A new line

b)

A program exit

c)

A tab

d)

An alarm

9.

The instruction for accepting data from the user is:

a)

scanf(format, address);

b)

whatDoYouWantToWriteHere(format, typeGarbageHere);

c)

scanf(address);

d)

input(userInput);

10.

Which specifier.... uh, specifies a char?

a)

%c

b)

%d

c)

%f

d)

%lf

11.

Which specifier is used for an int and/or short?

a)

%c

b)

%d

c)

%f

d)

%lf

12.

Which specifier is used for a float?

a)

%c

b)

%d

c)

%f

d)

%lf

13.

How do you get the address variable "x"?

a)

&x

b)

x.address

c)

x&

d)

x->address

14.

Which of the following will successfully accept user input into "x", an integer?

a)

scanf("%c", &x);

b)

scanf("%d", &x);

c)

scanf("%d", x);

d)

scanf(&x);

15.

You've declared "x int;" in your program. How do you assign a value to x?

a)

4 = x;

b)

x = 4;

c)

x == 4;

d)

x === 4;

16.

How do you "print" an expression (a variable) to the screen?

a)

print(format, expression);

b)

printf(format, expression);

c)

printout(expression);

17.

How do you print "hello" with quotation marks?

a)

printf("hello");

b)

printf("\"hello\"");

c)

printf(hello);

d)

printf(""hello"");

18.

Which "relational expression" means both "operands" are equal?

a)

==

b)

>

c)

!=

d)

<=

19.

Which "relational expression" means left "operand" is less than right operand?

a)

>

b)

<

c)

==

d)

<=

20.

Which "relational expression" means two "operands" are not equal?

a)

=

b)

==

c)

!=

d)

===

21.

Which "arithmetic expression" multiples the left "operand" by the right "operand"?

a)

x

b)

*

c)

/

d)

.

22.

Which "arithmetic expression" adds two "operands" together?

a)

+

b)

=

c)

-

d)

*

23.

Which "relational expression" means the left "operand" is greater than or equal to the right "operand"?

a)

<

b)

>

c)

>=

d)

!=

24.

Which "logical expression" checks if both "operands" are true?

a)

operand && operand

b)

operand || operand

c)

operand == operand

d)

operand != operand

25.

The arithmetic operator % gives:

a)

the remainder of the division of left operand by right operand

b)

the product of the left and right operands

c)

the percentage of the right operand

d)

the number of times the left operand is divisible by the right operand

26.

What does "casting" mean?

a)

Changing a variable into a constant

b)

Checking what type a variable is

c)

Converting one type to another type

27.

Which option successfully casts "minutes" as a float?

a)

hours = (float)minutes / 60;

b)

hours = float * minutes / 60;

c)

hours = minutes / 60;

d)

hours = minutes(float) / 60;

28.

int x = 8;

int y = 9;

Select ALL expressions that yield 1 ("true")

a)

x == 8 && y == 777

b)

x == 8 || y == 777

c)

x > 5

d)

x != y