wayground logo

Free Printable Worksheets

NEW

Font size

S
M
L
XL
Worksheets

C que que que

Total questions: 23

Worksheet time: 12mins

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 calculate the sum of two numbers

c)

To compare two strings

d)

To print the address of a variable

2.

Explain 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 exit the loop or switch statement

b)

To skip the current iteration and move to the next

c)

To print a line break in the output

d)

To terminate the program

4.

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

a)

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

b)

'++i' is post-increment and 'i++' is pre-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 store the address of other variables.

b)

Pointers are used to store the value of other variables.

c)

Pointers are used to perform arithmetic operations.

7.

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

a)

To exit the loop or switch statement

b)

To skip the current iteration and move to the next

c)

To print a line break in the output

d)

To terminate the program

8.

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

Store the Input in variable "a".

a)

scanf("%d", &x);

b)

scanf("%d", x);

c)

scanf("%d", *x);

d)

scanf("%d", *a);

9.

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 an integer

c)

To declare a function that returns a pointer

d)

To declare a function that returns a character

10.

Choose the correct Syntax.

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

a)

int Sum (int a , int b);

b)

Sum (a ,b);

c)

void Sum (int a+ int b);

d)

int Sum(int a)(int b);

11.

What will be the output of the following code? 

a)

10

b)

17

c)

15

d)

18

12.

Debug the following code:

Note:

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

 

Case 1-

Sample Input:

232

Sample Output: 

Pallindrome:  Yes

 

Case 2-

Sample Input:

2234

a)

while(num>0)

b)

while(temp>0)

c)

while(temp<0)

d)

while(num<0)

13.

Debug the following code:

Note:

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

 

Case 1-

Sample Input:

232

Sample Output: 

Pallindrome:  Yes

 

Case 2-

Sample Input:

2234

a)

rev=rev + dig*10;

b)

rev=rev*10 + temp;

c)

rev=rev + temp*10;

d)

rev=rev*10 + dig;

14.

Debug the following code:

Note:

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

 

Case 1-

Sample Input:

232

Sample Output: 

Pallindrome:  Yes

 

Case 2-

Sample Input:

2234

a)

printf("Palindrome: %s", rev==num?"Yes":"No");

b)

printf("Palindrome: %s", rev==num:"Yes"?"No");

c)

printf("Palindrome: %s", "Yes":"No"?rev==num);

d)

printf("Palindrome: %s", "No":"Yes"?rev==num);

15.

'C is a structured programming language'. Why?

a)

Function & Stuctures

b)

Classes & Objects

c)

Arguments & Parameters

d)

Libraries & Modules

16.

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

a)

Formatted

b)

File

c)

Format

d)

Function

17.

Which of the following is 'Exit Controlled'?

a)

while Loop

b)

do while Loop

c)

for Loop

d)

None

18.

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

a)

int arr[10,10];

b)

int arr[10][10];

c)

int arr[[10]];

d)

int arr[arr[10]];

19.

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

a)

4

b)

2

c)

10

d)

6

20.

What is the output of the following code snippet?

int x = 5, y = 10;

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

a)

15

b)

16

c)

14

d)

11

21.

Give the output of the code.

a)

2

b)

5

c)

3

d)

4

22.

What is the Output of the Code?

a)

Value of variable: 1

b)

Value of variable: 0

c)

error: variable not defined

d)

none

23.

How can you declare and initialize a structure variable 'book' in a single line?

a)

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

b)

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

c)

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

d)

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