WorksheetsC-Quest
Total questions: 20
Worksheet time: 10mins
What is the purpose of the 'sizeof( )' operator in C programming?
To return the size of a variable
To compare two strings
To calculate the sum of two numbers
To print the address of a variable
Mention the syntax for declaring a pointer in C.
int ptr;
int *ptr;
*int ptr;
ptr int;
What is the purpose of the 'continue' statement in C programming?
To skip the current iteration and move to the next
To print a line break in the output
To exit the loop or switch statement
To terminate the program
Mention the difference between '++i' and 'i++' in C programming.
'++i' is post-increment and 'i++' is pre-increment.
'++i' is pre-increment and 'i++' is post-increment.
Both '++i' and 'i++' are used for the same purpose.
Give the output of the given code.
-10, 0
-9, -9
-7, 0
-10, -9
Explain the concept of 'Pointers' in C programming.
Pointers are used to perform arithmetic operations.
Pointers are used to store the value of other variables.
Pointers are used to store the address of other variables.
Choose the correct option for receiving an input in Line 7.
Store the Input in variable "a".
scanf("%d", *a);
scanf("%d", x);
scanf("%d", &x);
scanf("%d", *x);
What is the purpose of the 'void' keyword in C programming?
To declare a function that returns no value
To declare a function that returns a character
To declare a function that returns a pointer
To declare a function that returns an integer
Choose the correct Syntax of the prototype:
For a Sum Function taking two Integer arguments "a" & "b".
Sum (a ,b);
int Sum(int a)(int b);
void Sum (int a+ int b);
int Sum (int a , int b);
What will be the output of the following code?
18
17
10
15
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
while(temp>0)
while(num<0)
while(num>0)
while(temp<0)
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
Line 12:
rev=rev + temp*10;
Line 12:
rev=rev + dig*10;
Line 12:
rev=rev*10 + temp;
Line 12:
rev=rev*10 + dig;
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
What does the 'f' stand for, in 'scanf' ?
Format
Formatted
Function
File
Which of the following is 'Exit Controlled'?
while Loop
for Loop
None
do while Loop
What is the correct syntax of initializing a 2d array in C?
int arr[10][10];
int arr[arr[10]];
int arr[[10]];
int arr[10,10];
What does the expression '8>>2' evaluate to?
10
4
6
2
What is the output of the following code snippet?
int x = 5, y = 10;
printf("%d", x++ + y);
14
16
11
15
Give the output of the code.
4
5
2
3
How can you declare and initialize a structure variable 'book1' using structure 'Book' in a single line?
struct book1 = { "Title", 2023, 15.99 };
struct Book { "Title", 2023, 15.99 };
struct Book book1 = { "Title", 2023,15.99 };
struct book { title: "Title", year:2023, price: 15.99 };
