wayground logo

Free Printable Worksheets

NEW

Font size

S
M
L
XL
Worksheets

Chapter 1 - Fundamental Programming

Total questions: 25

Worksheet time: 13mins

Name
Class
Date
1.

Which of the following is not a valid C variable name?

a)

int number;

b)

float rate;

c)

int variable_count;

d)

int $main;

2.

Which of the following is true for variable names in C?

a)

They can contain alphanumeric characters as well as special characters

b)

It is not an error to declare a variable to be one of the keywords(like goto, static)

c)

Variable names cannot start with a digit

d)

Variable can be of any length

3.

What is #include <stdio.h>?

a)

Preprocessor directive

b)

Inclusion directive

c)

File inclusion directive

d)

None of the mentioned

4.

The C-preprocessors are specified with _________ symbol.

a)

#

b)

&

c)

%

d)

*

5.

scanf() is a predefined function in______header file.

a)

stdlib. h

b)

ctype. h

c)

stdio. h

d)

stdarg. h

6.

Which is valid C expression?

a)

int my_num = 100,000;

b)

int my_num = 100000;

c)

int my num = 1000;

d)

int $my_num = 10000;

7.

What is the only function that all C++ programs must contain?

a)

main ()

b)

void ()

c)

system ()

d)

start ()

8.

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

a)

{ }

b)

-> and <-

c)

BEGIN and END

d)

( and )

9.

Which of the following is a correct comment?

a)

*/ Comments */

b)

** Comment **

c)

/* Comment */

d)

{ Comment }

10.

What is the function of % operator?

a)

add

b)

devide

c)

substract

d)

remainder

11.

Which of these is not a correct variable data type?

a)

int

b)

float

c)

real

d)

char

12.

Which data type is used to store decimal numbers in C?

a)

int

b)

float

c)

double

d)

char

13.

Which data type is used to store single characters in C?

a)

char

b)

int

c)

float

d)

string

14.
... point variables store decimal numbers (3.5, -5,123, 4.0, etc). 
a)
Float
b)
Integer
c)
Logical
d)
Character
15.

Which type of error is difficult to detect as it does not result in any error messages?

a)

Syntax error

b)

Runtime error

c)

Compilation error

d)

Logical error

16.

If a program compiles successfully but does not produce the desired output, what type of error is likely present?

a)

Logical error

b)

Compilation error

c)

Runtime error

d)

Syntax error

17.

When a program contains misspelled keywords or missing punctuation, what type of error is it classified as?

a)

Runtime Error

b)

Semantic Error

c)

Logic Error

d)

Syntax Error

18.

Pascal, Python, Java, basic and C++ are all _______________

a)

computer program

b)

programming language

c)

windows software

d)

foreign language

19.

Someone who writes computer program called ___________.

a)

Program

b)

Programming

c)

Programmer

20.

What does the oval symbol represent in a flowchart?

a)

Data Input

b)

Process

c)

Start/End

d)

Decision Point

21.

What does the rectangle symbol represent in a flowchart?

a)

Decision point

b)

Start/End point

c)

Process or action

d)

Data input/output

22.

What does the parallelogram symbol represent in a flowchart?

a)

Database storage

b)

Decision point

c)

Mathematical calculations

d)

Input or output operations

23.

What does the diamond symbol represent in a flowchart?

a)

End

b)

Start

c)

Decision

d)

Loop

24.

Which function is used to take input from the user in C?

a)

print

b)

getchar

c)

scanf

d)

input

25.

Which function is used to display output in C?

a)

display()

b)

printf()

c)

output()

d)

print()