Wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

C-Quest

Total questions: 20

Worksheet time: 10mins

Name
Class
Date
1.

What is the purpose of the 'sizeof( )' operator in C programming?

a)

To return the size of a variable

b)

To compare two strings

c)

To calculate the sum of two numbers

d)

To print the address of a variable

2.

Mention the syntax for declaring a pointer in C.

a)

int ptr;

b)

int *ptr;

c)

*int ptr;

d)

ptr int;

3.

What is the purpose of the 'continue' statement in C programming?

a)

To skip the current iteration and move to the next

b)

To print a line break in the output

c)

To exit the loop or switch statement

d)

To terminate the program

4.

Mention the difference between '++i' and 'i++' in C programming.

a)

'++i' is post-increment and 'i++' is pre-increment.

b)

'++i' is pre-increment and 'i++' is post-increment.

c)

Both '++i' and 'i++' are used for the same purpose.

5.

Give the output of the given code.

a)

-10, 0

b)

-9, -9

c)

-7, 0

d)

-10, -9

6.

Explain the concept of 'Pointers' in C programming.

a)

Pointers are used to perform arithmetic operations.

b)

Pointers are used to store the value of other variables.

c)

Pointers are used to store the address of other variables.

7.

Choose the correct option for receiving an input in Line 7.

Store the Input in variable "a".

a)

scanf("%d", *a);

b)

scanf("%d", x);

c)

scanf("%d", &x);

d)

scanf("%d", *x);

8.

What is the purpose of the 'void' keyword in C programming?

a)

To declare a function that returns no value

b)

To declare a function that returns a character

c)

To declare a function that returns a pointer

d)

To declare a function that returns an integer

9.

Choose the correct Syntax of the prototype:

For a Sum Function taking two Integer arguments "a" & "b".

a)

Sum (a ,b);

b)

int Sum(int a)(int b);

c)

void Sum (int a+ int b);

d)

int Sum (int a , int b);

10.

What will be the output of the following code?

a)

18

b)

17

c)

10

d)

15

11.

Debug the following code:

Note:

Following is a code for checking if a following number is a palindrome.

Sample Input:

232

Sample Output:

Palindrome: Yes

a)

while(temp>0)

b)

while(num<0)

c)

while(num>0)

d)

while(temp<0)

12.

Debug the following code:

Note:

Following is a code for checking if a following number is a palindrome.

Sample Input:

232

Sample Output:

Palindrome: Yes

a)

Line 12:

rev=rev + temp*10;

b)

Line 12:

rev=rev + dig*10;

c)

Line 12:

rev=rev*10 + temp;

d)

Line 12:

rev=rev*10 + dig;

13.

Debug the following code:

Note:

Following is a code for checking if a following number is a palindrome.

Sample Input:

232

Sample Output:

Palindrome: Yes

a)

b)

c)

d)

14.

What does the 'f' stand for, in 'scanf' ?

a)

Format

b)

Formatted

c)

Function

d)

File

15.

Which of the following is 'Exit Controlled'?

a)

while Loop

b)

for Loop

c)

None

d)

do while Loop

16.

What is the correct syntax of initializing a 2d array in C?

a)

int arr[10][10];

b)

int arr[arr[10]];

c)

int arr[[10]];

d)

int arr[10,10];

17.

What does the expression '8>>2' evaluate to?

a)

10

b)

4

c)

6

d)

2

18.

What is the output of the following code snippet?

int x = 5, y = 10;

printf("%d", x++ + y);

a)

14

b)

16

c)

11

d)

15

19.

Give the output of the code.

a)

4

b)

5

c)

2

d)

3

20.

How can you declare and initialize a structure variable 'book1' using structure 'Book' in a single line?

a)

struct book1 = { "Title", 2023, 15.99 };

b)

struct Book { "Title", 2023, 15.99 };

c)

struct Book book1 = { "Title", 2023,15.99 };

d)

struct book { title: "Title", year:2023, price: 15.99 };