wayground logo

Free Printable Worksheets

NEW

Font size

S
M
L
XL
Worksheets

C Module 1

Total questions: 37

Worksheet time: 19mins

Name
Class
Date
1.

Which of the following is the correct order of steps in problem-solving using programming?

a)

Flowchart → Algorithm → Coding

b)

Problem Definition → Algorithm → Flowchart → Coding

c)

Pseudo code → Debugging → Coding

d)

Design → Testing → Compilation

2.

What does a flowchart use to represent a decision?

a)

Rectangle

b)

Diamond

c)

Parallelogram

d)

Circle

3.

Which of these is not a characteristic of structured programming?

a)

Use of sequence

b)

Use of selection

c)

Use of GOTO statements

d)

Use of modularity

4.

Which of the following is not a component of pseudo code?

a)

Logical steps

b)

Conditions

c)

Syntax-specific keywords

d)

Loops

5.

The main advantage of using algorithms is:

a)

Easy to understand problem logic

b)

Requires less memory

c)

Does not need programming skills

d)

Avoids compilation errors

6.

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

a)

1value

b)

my-value

c)

value1

d)

#value

7.

Which keyword is used to define a constant in C?

a)

const

b)

#define

c)

static

d)

fixed

8.

What will be the size of int data type in a 32-bit system?

a)

8 bytes

b)

4 bytes

c)

2 bytes

d)

1 byte

9.

Which of these is not a valid C data type?

a)

int

b)

float

c)

real

d)

char

10.

The correct syntax for reading input using scanf is:

a)

scanf("%d", &a);

b)

scan("%d", &a);

c)

scanf("%d", &&a);

d)

input("%d", &a);

11.

Which control structure is used to make decisions in C?

a)

for

b)

if

c)

while

d)

loop

12.

How many times will the loop run?

for(int i = 0; i < 5; i++)

printf("%d", i);

a)

5

b)

6

c)

infinite

d)

4

13.

Which loop will execute at least once, even if the condition is false?

a)

for

b)

while

c)

do-while

d)

None

14.

Which of the following is not a loop control statement in C?

a)

break

b)

continue

c)

switch

d)

goto

15.

Which keyword is used to declare a function in C?

a)

def

b)

return-type + name

c)

function

d)

void

16.

What is the default return type of a function in C if not specified?

a)

int

b)

float

c)

void

d)

char

17.

Function calling by reference allows:

a)

Changes in actual values

b)

Faster execution

c)

Only reading data

d)

Copy of variable to function

18.

What is the output of the recursive function called with n=3:

void fun(int n){

if(n>0){

fun(n-1);

printf("%d", n);

}

}

a)

321

b)

123

c)

None above

d)

Error

19.

What is the scope of a static variable inside a function?

a)

Global

b)

Local but retains value

c)

Public

d)

Shared across all functions

20.

Which of the following declares a 1D array of 10 integers?

a)

int arr();

b)

int arr[10];

c)

int arr[10][10];

d)

int arr{};

21.

Indexing of array elements starts from:

a)

1

b)

0

c)

-1

d)

2

22.

What is the correct way to initialize a string in C?

a)

char str[10] = {'H','i'};

b)

char str[] = {Hi};

c)

char str[] = "Hi";

d)

char str = "Hi";

23.

Which function is used to find the length of a string?

a)

strlen()

b)

size()

c)

length()

d)

strlen()

24.

Which function is used to concatenate two strings in C?

a)

strcat()

b)

strcpy()

c)

strcat()

d)

stradd()

25.

What is the output of printf("%s", str); if str = "C Programming";

a)

str

b)

C Programming

c)

C

d)

Error

26.

What is a pointer in C?

a)

Variable storing data

b)

Variable storing address of another variable

c)

Function return value

d)

Array name

27.

Which symbol is used to declare a pointer?

a)

&

b)

%

c)

***

d)

#

28.

Which operator gives the address of a variable?

a)

*

b)

&

c)

@

d)

%

29.

Which keyword is used to define a structure in C?

a)

struct

b)

structure

c)

class

d)

object

30.

Which of the following is true about union in C?

a)

All members can hold values simultaneously

b)

Only one member can hold value at a time

c)

It's similar to array

d)

None

31.

Which keyword is used with structures to define a custom name?

a)

struct

b)

typedef

c)

alias

d)

define

32.

How is a member of a structure accessed?

a)

struct.member

b)

structure->member

c)

structure.member

d)

member.structure

33.

Which structure is inside another structure?

a)

Static structure

b)

Nested structure

c)

Recursive structure

d)

Multi structure

34.

Which function is used to open a file in C?

a)

openfile()

b)

fopen()

c)

startfile()

d)

createfile()

35.

Which mode is used to read a file?

a)

"rw"

b)

"w"

c)

"r"

d)

"a"

36.

Which data type is used to define a file pointer?

a)

int

b)

void

c)

FILE*

d)

file

37.

What does fclose() do?

a)

Closes the opened file

b)

Opens a file

c)

Reads file data

d)

Moves file pointer