1. The keyword main in C language is used for
a. an user defined function
*b. the first function to be executed in the program
c. an user defined variable
2. The role of a C compiler is to translate
a. english into machine code
*b. source code in high level C language into machine code
c. machine code into low level code
d. german to english
3. printf and scanf functions in C lanaguage are examples of
a. constants
b. expressions
*c. standard C library functions for basic input/output
d. user defined functions
4. Which of the following is a valid C variable name ?
*a. _iamvalid
b. %iamvalid
c. iam*valid
d. else
5. The expression 2 * 3 + 40 / 5 % 2 evaluates to
a. -5
b. 5
*c. 6
d. 8
6. The expression 2 % 3 + 40 / 5 % 3 evaluates to
*a. 4
b. 3
c. 6
d. 5
7. The expression 5 / 3 + 20 / 4 / 2 evaluates to
a. 5
b. 4
*c. 3
d. 1
8. The expression 5 / 3 / 4 + 45 / 5 % 3 evaluates to
a. 1
*b. 0
c. -1
d. 3
9. The correct C statement for printing a character datatype variable quitKey as
character output is
a. printf("character is %d\n", quitKey);
*b. printf("%c", quitKey);
c. printf("%c", &quitKey);
d. scanf("%c", &quitKey);
10. How many newline are printed by the following printf statement ?
printf("\n \n \n \n");
a. 6
*b. 4
c. 2
d. 3
11. The correct C statement for reading an input into a double data type variable
heightTower ?
a. scanf("%lf", heightTower);
b. scanf("%f", &heightTower);
c. scanf("%d", &heightTower);
*d. none of the above
12. Which of the following statement assigns 5 to the integer variable numFruits ?
*a. numFruits = 25 / 5;
b. numFruits = 5 % 5;
c. numFruits = 40 / 8 % 2;
d. numFruits = 3 / 40;
13. Which of the following statements declare and initialize the integer variables numApples, numOranges to 10 and 12 respectively ?
*a. int numApples = 10, numOranges = 12;
b. int "numApples" = 10; int numOranges = 12;
c. int &numApples = 10, int numOranges = 12;
d. float numApples = 10;
14. Write one function prototype/declaration statement for the following.
1. The function takes two integer data and one double data as inputs.
2. The function returns nothing.
15. Write one function prototype/declaration statement for the following.
1. The function takes two double data and one character data as inputs.
2. The function returns a character data.
16. Write one function prototype/declaration statement for the following.
1. The function takes two character data and one double data as inputs.
2. The function returns a double data.
17. Write one function prototype/declaration statement for the following.
1. The function takes one integer data, one double data and one character data as
inputs.
2. The function returns an integer data.
18. Write one function prototype/declaration statement for the following.
1. The function takes one character data and one double data as inputs.
2. The function returns a double data.
19. Write one function prototype/declaration statement for the following.
1. The function takes two integer data and one character data as inputs.
2. The function returns a double data.
20. Write a printf statement to print the following.
"X" + "Y" = "Y" + "X"
21. Write a printf statement to print the following.
"Z" = "Y" + "X"
22. Write a printf statement to print the following.
"X" * "Y" = "Y" * "X"
23. Write a printf statement to print the followiing.
"X" + "Y" * "Z"
24. Write a printf statement to print the followiing.
"X" / "Y" * "Z"
25. Write one line C statement to express the following equation.
F = A x P2 + B x Q2 + C x R2
Assume all variables F, P,Q,R are declared to be integers and constants A, B,C are
integers also. Do not use math.h functions.
26. Write one line C statement to express the following equation.
F = ( P x Q ) + ( R x S2 )
Assume all variables F, P,Q,R,S are declared to be integers and Do not use math.h
functions.
27. Write one line C statement to express the following equation.
F = ( 5 x Q ) + ( 7 x S2 )
Assume all variables F,Q,S are declared to be integers and Do not use math.h
functions.
28. Write one line C statement to express the following equation.
F = ( P x Q ) x ( R x S2 )
Assume all variables F, P,Q,R,S are declared to be integers and Do not use math.h
functions.
29. Convert the binary number (11110)2 to decimal number.
30. Convert the binary number (11001101)2 to hexa-decimal number.
31. Convert the binary number (0101101)2 to decimal number.
32. Convert the binary number (11101111)2 to hexa-decimal.
33. Write ONE C function definition for following tasks 1. Function accepts an integer input.
2. Function computes the product of three previous consecutive positive integers
less than the input integer.
3. Function returns the result of the product.
4. Error checking should be part of the function definition for the above tasks.
For example, Input integer is 8. Three previous consecutive integers less than 8 5, 6,7.
34. Write ONE C function definition for following tasks 1. Function accepts an integer input.
2. Function computes the product of four previous consecutive positive integers less
than the input integer.
3. Function returns the result of the product.
4. Error checking should be part of the function definition for the above tasks.
For example, Input integer is 8. Four previous consecutive integers less than 8 - 4,
5, 6,7.
35. Write ONE C function definition for following tasks 1. Function accepts an integer input.
2. Function computes the sum of three next consecutive positive integers greater
than the input integer.
3. Function returns the result of the product.
4. Error checking should be part of the function definition for the above tasks.
For example, Input integer is 8. Three next consecutive integers greater than 8 - 9,
10, 11.
36. Write ONE C function definition for following tasks 1. Function accepts an integer input.
2. Function computes the product of two previous consecutive positive integers less
than the input integer and the product of two next consecutive integers greater than
the input integer.
3. Function returns the sum of the individual products.
4. Error checking should be part of the function definition for the above tasks.
For example, Input integer is 8. Two previous consecutive integers less than 8 - 6,
7 and Two next consecutive integers greater than 8 - 9, 10. Sum is 6 x 7 + 9 x 10.
37. Write ONE C function definition for following tasks 1. Function accepts an integer input.
2. Function computes the sum of the squares of three previous consecutive positive
integers less than the positive input integer.
3. Function returns the result of the product.
4. Error checking should be part of the function definition for the above tasks.
For example, Input integer is 8. Three previous consecutive integers less than 8 5, 6,7.
38. Write ONE C function definition for following tasks 1. Function accepts an integer input as parameter.
2. Function computes the product of the squares of three next consecutive positive
integers greater than the input integer.
3. Function returns the result of the product.
4. Error checking should be part of the function definition for the above tasks.
For example, Input integer is 8. Three next consecutive integers greater than 8 - 9,
10, 11.
39. Write a complete C code for the following.
Print a message to display "Even number" when an input positive integer is even and
"Odd number" otherwise.
40. Write a complete C code for the following.
Print a message to display "Remainder is 5 or 6" when an input positive integer
leaves a remainder 5 or 6 when divided by 7, otherwise print "Remainder is NOT 5 or
6".
41. Write a complete C code for the following.
Print a message to display "Quotient is 5 or 6" when an input positive integer
leaves a quotient of 5 or 6 when divided by 7 , otherwise print "Quotient is not 5
or 6" .
42. Write a complete C code for the following.
Read a positive integer score for a student. Print "A grade" when the score falls in
the range 90 to 100 inclusive, otherwise print "Less than A".
43. Write a complete C code for the following.
Read a positive integer as input. Print "Even integer" when the next consecutive
integer is even otherwise print "Odd integer".
© Copyright 2026 Paperzz