wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

Quiz I - Programming in C

Total questions: 73

Worksheet time: 41mins

Name
Class
Date
1.

All keywords in C are in

a)

uppercase letters

b)

none of the mentioned

c)

lowercase letters

d)

sentence case letters

2.

Who is the Father of C Language

a)

James A. Gosling

b)

Dr. E.F. Codd

c)

Dennis Ritchie

d)

Bjarne Stroustrup

3.

C language developed at

a)

MIT University

b)

Stanford Lab

c)

Haward University

d)

AT&T Bell Laboratory

4.

Constant is ------------------

a)

Unknown values

b)

Fixed values

c)

None of these

d)

Values changes during execution

5.

Every C statement ends with ------------?

a)

.

b)

}

c)

;

d)

,

6.

What is the extension of C program?

a)

.c

b)

.cpp

c)

.java

d)

.py

7.

A sequence of instructions form a ------------.

a)

both

b)

program

c)

none of these

d)

syntax

8.

The correct order of evaluation for the expression “z = x + y * z / 4 % 2 – 1”

a)

* / % + - =

b)

* / % = + -

c)

/ * % - + =

d)

- + = * % /

9.

Which header file can be used to define input/output function prototypes and macros?

a)

- math.h

b)

- dos.h

c)

- memory.h

d)

- stdio.h

10.

What will be the output of the following C code?

a)

None of the above

b)

No Output

c)

Compiler error

d)

TESTING

11.

C is a

a)

High level language

b)

Low level language

c)

Assembly language

d)

Medium level language

12.

Which of these is not a correct variable data type?

a)

real

b)

int

c)

char

d)

float

13.

In which year C language is developed?

a)

1973

b)

1972

c)

1970

d)

1971

14.

Who is father of C Language?

a)

Dr. E.F. Codd

b)

James A. Gosling

c)

Bjarne Stroustrup

d)

Dennis Ritchie

15.

What do you need to import stdio.h a header file?

a)

To perform input and output operations

b)

Just a waste of time

c)

To run the code

d)

It helps in compilation to binary coded file

16.

Find the output of the given program?

a)

Compile-time error

b)

3

c)

3.14

d)

None of these

17.

What will be the output of the below C program?

a)

Garbage Value

b)

Compile-time error

c)

0

d)

9

18.

Assuming a "double" variable named "pi" has already been declared, which of the following statements will assign the value 3.14159 to that variable?

a)

pi 3.14159

b)

pi(3.14159)

c)

3.14159 = pi;

d)

pi = 3.14159;

19.

What is the range of signed char in C?

a)

-32,768 to 32,767

b)

0 to 255

c)

-2,147,483,648 to 2,147,483,647

d)

-128 to 127

20.

What does the %f format specifier do in C?

a)

Formats a character

b)

Formats a float

c)

Formats a string

d)

Formats an integer

21.

What is the output of the integer variable example?

a)

This is my integer: 3.14

b)

This is my integer: 10

c)

This is my integer: b

d)

This is my integer: 3.1415

22.

What is the first letter of a variable in C supposed to be?

a)

An alphabet

b)

Any character

c)

A special character

d)

A digit

23.

What punctuation is used to signal the beginning and end of code blocks?

a)

BEGIN and END

b)

-> and <-

c)

{ }

d)

( and )

24.

The "\n" character does which of the following operations?

a)

Character backspace

b)

Places cursor on the next line

c)

Character deletion

d)

Double line spacing

25.

What is an Identifier in C Language.?

a)

Name of a Variable

b)

Name of a constant

c)

Name of a Function

d)

All the above.

26.

Find an integer constant.

a)

34

b)

3.145

c)

"125"

d)

None of the above

27.

Number of Keywords present in C Language are .?

a)

62

b)

34

c)

32

d)

64

28.

Each statement in a C program should end with.?

a)

Colon :

b)

Semicolon ;

c)

None of the above.

d)

Period . (dot symbol)

29.

A name having a few letters, numbers and special character _(underscore) is called

a)

reserved keywords

b)

tokens

c)

identifiers

d)

keywords

30.

What is the key difference between a signed and unsigned character data type?

a)

Signed takes up more memory than unsigned

b)

Signed can store positive and negative values, unsigned can only store positive

c)

There is no difference, they are the same

d)

Unsigned is the default, signed must be explicitly specified

31.

Which of the following is not a valid reason to choose a specific data type when declaring a variable?

a)

The expected range of values for the variable

b)

Maximizing the variable's value

c)

Ensuring compatibility with external systems or libraries

d)

Minimizing memory usage

32.

The format identifier '%i' is also used for _____ data type.

a)

int

b)

char

c)

float

d)

double

33.

What is the size of 'long double' in C?

a)

8 bytes

b)

16 bytes

c)

4 bytes

d)

12 bytes

34.

Which of the following is NOT a primitive data type in C?

a)

char

b)

int

c)

float

d)

struct

35.

What is the range of 'float' data type in C?

a)

0 to 255

b)

-2,147,483,648 to 2,147,483,647

c)

1.2E-38 to 3.4E+38

d)

1.7E-308 to 1.7E+308

36.

Which of the following is a valid C data type for representing a floating-point number?

a)

float

b)

bool

c)

char

d)

int

37.

What is the size of an int data type on most 32-bit systems?

a)

1 byte

b)

4 bytes

c)

2 bytes

d)

8 bytes

38.

What is the size of an int data type on most 32-bit systems?

a)

1 byte

b)

4 bytes

c)

2 bytes

d)

8 bytes

39.

Identify the most appropriate type of variable for a student's grade point average (GPA). This is typically reported on a 0 to 4.0 scale (such as a GPA of 3.5).

a)

double

b)

char

c)

int

d)

string

40.

Identify the most appropriate type of variable for the total number of teachers at FHS.

a)

string

b)

char

c)

int

d)

double

41.

What is the format specifier for printing a double value in C?

a)

%c

b)

%d

c)

%lf

d)

%f

42.

What is the size of the unsigned char data type in C?

a)

2 bytes

b)

1 byte

c)

8 bytes

d)

4 bytes

43.

What is the range of the long long int data type in C?

a)

-(2^63) to (2^63)-1

b)

-32,768 to 32,767

c)

0 to 65,535

d)

0 to 18,446,744,073,709,551,615

44.

Which data type is used to store only a single character in C?

a)

int

b)

char

c)

float

d)

double

45.

What is the format specifier for printing a float value in C?

a)

%d

b)

%lf

c)

%f

d)

%c

46.

What is the purpose of the void data type in C?

a)

To store single characters

b)

To specify no value

c)

To store integer values

d)

To store decimal numbers

47.

What is the range of the float data type in C?

a)

0 to 255

b)

1.7E-308 to 1.7E+308

c)

-128 to 127

d)

1.2E-38 to 3.4E+38

48.

What is the range of the short int data type in C?

a)

0 to 65,535

b)

-2,147,483,648 to 2,147,483,647

c)

0 to 4,294,967,295

d)

-32,768 to 32,767

49.

Variable names are case-sensitive.

a)

False

b)

True

50.

Which holds whole numbers?

a)

String

b)

int

c)

double

d)

bool

51.

Which best describes a variable?

a)

Variables enable programmers to work with different input devices

b)

Variables control memory space

c)

Variables store program data while code runs

d)

Variables are individual values in a database table

52.

What is the significance of the 'long' keyword in C data types?

a)

It is used to specify variables that can hold smaller values than 'int'.

b)

It is used to declare constant variables.

c)

It is used to define floating-point variables.

d)

It is used to specify variables that can hold larger values than 'int'.

53.

Why is it important to understand data types in C programming?

a)

Understanding data types in C programming is not important

b)

Data types in C programming have no impact on memory allocation

c)

Manipulation of data in C programming does not require knowledge of data types

d)

It is important to understand data types in C programming to ensure proper memory allocation, manipulation, and interpretation of data.

54.

What is the size of 'double' data type in C language?

a)

4 bytes

b)

16 bytes

c)

8 bytes

d)

12 bytes

55.

Explain the difference between 'int' and 'float' data types in C.

a)

In C, 'int' is for floating-point numbers, while 'float' is for integers.

b)

'int' and 'float' are interchangeable data types in C.

c)

Both 'int' and 'float' are used for integers in C.

d)

In C, 'int' is for integers, while 'float' is for floating-point numbers.

56.

What is the size of 'char' data type in C language?

a)

2 bytes

b)

1 byte

c)

8 bytes

d)

4 bytes

57.

How is the size of a data type determined using the sizeof operator?

a)

The size of a data type is determined by the number of bits it occupies in memory

b)

The size of a data type is determined by using the sizeof operator to calculate the number of bytes it occupies in memory.

c)

The size of a data type is determined by counting the number of characters it contains

d)

The size of a data type is determined by the data type itself

58.

What is the size of 'int' data type in C language?

a)

8 bytes

b)

4 bytes

c)

16 bytes

d)

2 bytes

59.

What are the basic data types in C language?

a)

long

b)

string

c)

short

d)

int, char, float, double, void

e)

bool

60.

What is the purpose of the sizeof operator in C?

a)

To determine the size of a variable or data type in bytes.

b)

To convert data types

c)

To control program flow

d)

To check for memory leaks

61.

*@Ac# is a type of ________________ data.

a)

Alphanumeric

b)

Alphabetic

c)

Numeric

d)

Symbolic

62.

Which of the following is not a data type?

a)

Alphabetic Data

b)

Symbolic Data

c)

Alphanumeric Data

d)

Numeric Data

63.

Which of these operation is used for division?

a)

/

b)

+

c)

*

d)

-

64.

For the following code, what is the data type? float boat = 3.4;

a)

decimal

b)

boat

c)

3.4

d)

float

65.

For the following code, what is the name of the variable? int game = 2;

a)

integer

b)

int

c)

2

d)

game

66.

What kind of data type would you use for the name of your first period class?

a)

integer

b)

float

c)

string

d)

character

67.

What data type is this value? "This is a quiz"

a)

string

b)

character

c)

integer

d)

float

68.

What data type is this value? 'R'

a)

float

b)

string

c)

integer

d)

character

69.

What kind of data type is this value? 9.45

a)

float

b)

string

c)

integer

d)

character

70.

What will be the output of the following C code?

a)

2

b)

8

c)

9

d)

10

71.

What will be the output of the following C code?

a)

3 2 3

b)

2 2 3

c)

3 2 2

d)

2 3 3

72.

What will be the output of the following C code?

a)

3 2 3

b)

2 2 3

c)

3 2 2

d)

2 3 3

73.

What will be the output of the following C code?

a)

Run time error

b)

7

c)

8

d)

Depends on compiler