wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

C Programming Basics - 003

Total questions: 10

Worksheet time: 4mins

Name
Class
Date
1.

An external variable is one

a)

Which resides in the memory till the end of the program

b)

Which is globally accessible by all functions

c)

Which is declared outside the body of any function

d)

All of the above

2.

When applied to a variable, what does the unary "&" operator yield?

a)

The variable's address

b)

The variable's right value

c)

The variable's binary form

d)

The variable's value

3.

The operator "&" is used for

a)

Bitwise AND

b)

Bitwise OR

c)

Logical AND

d)

Logical OR

4.

Which are built-in data structures in C programming?

a)

Arrays

b)

Structures

c)

Files

d)

All of the above

5.

The size of a character variable in C is

a)

8 bytes

b)

4 bytes

c)

2 bytes

d)

1 byte

6.

An expression contains relational, assignment and arithmetic operators. If parenthesis are not specified, the order of evaluation of the operators would be:

a)

assignment, arithmetic, relational

b)

relational, assignment, arithmetic

c)

assignment, relational, arithmetic

d)

arithmetic, relational, assignment

7.

Given two literals 0x001B and 033. What are these equal to?

a)

21 and 23

b)

27 and 33

c)

33 and 33

d)

27 and 27

8.

What is the outpur of the following code segment (assuming sizeof(int) returns 4)?


int i=0x1 << sizeof(int) * 8-1;

printf("\n%x", i);

i = i >> sizeof(int) * 8-1;

printf("%d", i);

a)

0x8000000-1

b)

80000000-1

c)

-1 0x0000000

d)

-1 0000000

9.

Which is the correct sequence statements that swaps values of two statements?

a)

a=a+b; a=a-b; b=a-b;

b)

a=a+b, b=a-b; a=a-b;

c)

a=a-b; a=a+b; b=b-a;

d)

None of these

10.

Choose the option that contains only Unary operators of C:

a)

sizeof, (type conversion)

b)

short hand operator, &

c)

increment(++), >=, !

d)

==, !=