Programming in C | MCQ | CSE101

CoderIndeed
2

  1. What is the starting point of c program execution?

    1. #include
    2. void main()
    3. Opening curly braces '{'
    4. None of these
    Show Answer
    Answer :     Option ( B )
  2. C is a __________ language

    1. High level
    2. Middle level
    3. Machine level
    4. Low level
    Show Answer
    Answer :     Option ( B )
  3. What symbol ends a statement in C program?

    1. ; (Semicolon)
    2. . (full stop)
    3. : (Colon)
    4. } (curly braces)
    Show Answer
    Answer :     Option ( A )
  4. Header file is compulsory to include in a C program printing "Hello World"

    1. True
    2. False
    Show Answer
    Answer :     Option ( A )
  5. How Many Keywords are there in C?

    1. 31
    2. 32
    3. 64
    4. 63
    Show Answer
    Answer :     Option ( B )
  6. Which of the following is true for variable name in C?

    1. Variable names cannot start with a digit
    2. Variable can be of any length
    3. They can contain alphanumeric characters as well as special characters
    4. Reserved word can be used as a variable name
    Show Answer
    Answer :     Option ( A )
  7. printf() belongs to which library of c

    1. stdlib.h
    2. stdio.h
    3. stdout.h
    4. stdoutput.h
    Show Answer
    Answer :     Option ( B )
  8. Which of the following is a correct statement?

    1. Variable name must start with underscore
    2. Variable name must have digit
    3. variable name must have white space character
    4. Keyboard cannot be a variable name
    Show Answer
    Answer :     Option ( D )
  9. Any C program

    1. must contain at least on function
    2. need not contain any function
    3. needs input data
    4. none of above
    Show Answer
    Answer :     Option ( A )
  10. What should be written in the program to get newline on the screen?

    1. printf("\n");
    2. echo"\n"
    3. printf('\n');
    4. printf("\n");
    Show Answer
    Answer :     Option ( A )
  11. What is the Output?

    void main() { float a=654.1239; printf("%0.3f",a); }
    1. Compiler error
    2. 654.123900
    3. 654.123
    4. 654.124
    Show Answer
    Answer :     Option ( D )
  12. Choose a C formatted Input-Output function below

    1. printf(), scanf()
    2. sprintf(), sscanf()
    3. printf(), fscanf()
    4. All of above
    Show Answer
    Answer :     Option ( D )
  13. Which operator if used to compare two values?

    1. Logical operator
    2. Relational operator
    3. Assignment operator
    4. None of these
    Show Answer
    Answer :     Option ( B )
  14. The Operator '&' is used as

    1. Logical AND
    2. Bitwise AND
    3. Logical OR
    4. Bitwise OR
    Show Answer
    Answer :     Option ( B )
  15. Which of the following is a valid relational operator?

    1. =
    2. =>
    3. ==
    4. >>
    Show Answer
    Answer :     Option ( C )
  16. What will be the value of variable a?

    float a = 3.5+4.5;
    1. a = 8.0
    2. a = 8
    3. a = 7
    4. a = 0.0
    Show Answer
    Answer :     Option ( A )
  17. If we want to increment the value of sum by 1. Which of following should be used?

    1. sum++;
    2. sum = sum + 1;
    3. sum += 1;
    4. all of above
    Show Answer
    Answer :     Option ( D )
  18. What will be the value of variable a?

    int a = 3.5+4.5;
    1. a = 0
    2. a = 7
    3. a = 8
    4. a = 8.0
    Show Answer
    Answer :     Option ( C )
  19. Which of the following is a valid assignment operator?

    1. +=
    2. -=
    3. *=
    4. all of above
    Show Answer
    Answer :     Option ( D )
  20. What will be the value of variable b?

    Int a; int b; a=1; b = ++a;
    1. 1
    2. 2
    3. 3
    4. unknown/undefined
    Show Answer
    Answer :     Option ( B )
  21. Choose the correct statement about left shift Operator <<

    1. Left shift operator shits individual bits on the left side
    2. When shifting left side, Overflow bits are ignored
    3. Zeros are filled on the right side
    4. all of above
    Show Answer
    Answer :     Option ( D )
  22. Choose the correct statement about Right Shift Operator >>

    1. Right shift operator shifts individual bits on to the right side
    2. When shifting bits right side, overflow bits on the right are ignored or truncated
    3. Zeroes are filled on the left side
    4. all of above
    Show Answer
    Answer :     Option ( D )
  23. Which is bit toggling operator below?

    1. & Bitwise AND
    2. | Bitwise OR
    3. ^ Bitwise exclusive OR
    4. ~ Bitwise complement
    Show Answer
    Answer :     Option ( D )
  24. Left Shift operation is equivalent to __________

    1. Division by 2
    2. Multiplying by 2
    3. Adding 2
    4. Subtrating 2
    Show Answer
    Answer :     Option ( B )
  25. Which of the following is a symbol for logical AND operator?

    1. ||
    2. &
    3. &&
    4. ##
    Show Answer
    Answer :     Option ( C )
  26. Right Shift operation >> is equivalent to _________

    1. Multiplying by 2
    2. Division by 2
    3. Adding 2
    4. Subtracting 2
    Show Answer
    Answer :     Option ( B )
  27. What will be the value of variable c?

    int c = 2 ^ 3;
    1. 1
    2. 8
    3. 9
    4. 0
    Show Answer
    Answer :     Option ( A )
  28. Which of the following is ternary operator?

    1. ??
    2. :?
    3. ?:
    4. ::
    Show Answer
    Answer :     Option ( C )
  29. What will be the output of following program

       
    #include<stdio.h>
    void main()
    {
    int x,y=10;
    x = y * NULL;
    printf("%d",x);
    }  
    
    
    1. error
    2. 0
    3. 10
    4. garbage value
    Show Answer
    Answer :     Option ( A )
  30. Which of following is not a valid assignment expression?

    1. y = 22;
    2. s = x;
    3. y%=6;
    4. z = 5 = 3
    Show Answer
    Answer :     Option ( D )
  31. An arithmetic expression without paranthesis will be evaluated from left to right

    1. True
    2. False
    Show Answer
    Answer :     Option ( A )
  32. In C Programming, the statement a = a+1 and a+=1 will produe same result

    1. True
    2. False
    Show Answer
    Answer :     Option ( A )
  33. Within a expression, _________ precedence operators will be evaluated first

    1. Similar
    2. Higher
    3. Lower
    4. None of these
    Show Answer
    Answer :     Option ( B )
  34. What will the value of variable a?

    int a = 10 + 2 * 12 / (3*2) + 5;
    1. 31
    2. 19
    3. 11
    4. 29
    Show Answer
    Answer :     Option ( B )
  35. Which of the following correctly shows the hierarchy of arithmetic operation in C?

    1. /+*-
    2. *-/+
    3. /*+-
    4. +-/*
    Show Answer
    Answer :     Option ( C )
  36. Which is a correct 'C' expression?

    1. z = (x+y);
    2. z = [x+y]
    3. z = {x+y}
    4. z = {(x+y)};
    Show Answer
    Answer :     Option ( A )
  37. Which header file is essential for using scanf function?

    1. ctype.h
    2. string.h
    3. conio.h
    4. stdio.h
    Show Answer
    Answer :     Option ( D )
  38. Macro is used to __________________.

    1. Save Memory
    2. fast execution
    3. Both a & b
    4. none of above
    Show Answer
    Answer :     Option ( B )
  39. Which of the following is ternary operator?

    1. ??
    2. :?
    3. ?:
    4. ::
    Show Answer
    Answer :     Option ( C )
  40. Which header file is essential for using scanf() function?

    1. ctype.h
    2. string.h
    3. conio.h
    4. stdio.h
    Show Answer
    Answer :     Option ( D )
  41. A declaration float sum, value; occupies _____ of memory?

    1. 2 byte
    2. 4 byte
    3. 6 byte
    4. 8 byte
    Show Answer
    Answer :     Option ( D )
  42. MACRO is used to _______________.

    1. Save memory
    2. fast execution
    3. Both a & b
    4. none of above
    Show Answer
    Answer :     Option ( B )
  43. Which of the following is a symbol for logical AND operator?

    1. II
    2. &
    3. &&
    4. $$
    Show Answer
    Answer :     Option ( C )
  44. What will be the output of following program

    #include main() { int x,y = 10; x = y * NULL; printf(\"%d\",x); }
    1. error
    2. 0
    3. 10
    4. garbage value
    Show Answer
    Answer :     Option ( A )
  45. printf() belongs to which library of c

    1. stdlib.h
    2. stdio.h
    3. stdout.h
    4. stdoutput.h
    Show Answer
    Answer :     Option ( B )
  46. What will be printed if we type the statement printf("%d\n",’d’);

    1. 0
    2. 100
    3. error
    4. d
    Show Answer
    Answer :     Option ( B )
  47. C is a __________ language

    1. High level
    2. Middle level
    3. Machine level
    4. Low level
    Show Answer
    Answer :     Option ( B )
  48. Which of the following function is more appropriate for reading in a multiword string?

    1. printf();
    2. scanf();
    3. gets();
    4. puts();
    Show Answer
    Answer :     Option ( C )
  49. What are the different types of real data types in C?

    1. float, double
    2. short int, double, long int
    3. double, long int, float
    4. float, double, long double
    Show Answer
    Answer :     Option ( D )
  50. Which of the following is a correct statement?

    1. Variable name must start with underscore
    2. Variable name must have digit
    3. Variable name must have white space character
    4. Keyword cannot be a variable name
    Show Answer
    Answer :     Option ( D )
  51. What will be the output of following code.

    { int x = 10, y=15; x = x++; y = ++y; printf("%d, %d \n" , x, y); }
    1. 10, 15
    2. 10, 16
    3. 11, 16
    4. 11, 15
    Show Answer
    Answer :     Option ( B )
  52. Any C program

    1. Must contain at least one function
    2. Need not contain any function
    3. Needs input data
    4. None of the above
    Show Answer
    Answer :     Option ( A )
  53. Which is a correct ‘C’ expression?

    1. z = (x+y);
    2. z = [x+y];
    3. z = {x+y};
    4. Z = {(x+y)};
    Show Answer
    Answer :     Option ( A )
  54. If we want to increment the value of sum by 1. Which of following should be used?

    1. sum++;
    2. sum = sum+1;
    3. sum += 1;
    4. all of above
    Show Answer
    Answer :     Option ( D )
  55. Which of following is not a valid assignment expression?

    1. y = 22;
    2. s = x;
    3. y % = 6;
    4. z = 5 = 3;
    Show Answer
    Answer :     Option ( D )
  56. What should be written in the program to get newline on the screen?

    1. printf("\n");
    2. echo "\n";
    3. printf(‘\n’);
    4. printf(" \n ");
    Show Answer
    Answer :     Option ( A )
  57. ASCII value of ‘a’ is

    1. 97
    2. 65
    3. 65
    4. None of the above
    Show Answer
    Answer :     Option ( A )
  58. A float requires ______bytes in memory

    1. 2 bytes
    2. 1 byte
    3. 8 bytes
    4. 4 bytes
    Show Answer
    Answer :     Option ( D )
  59. Which of the following operator is used to select a member of a structure variable

    1. .(dot)
    2. ,(comma)
    3. :(colon)
    4. ;(semicolon)
    Show Answer
    Answer :     Option ( A )
  60. What is the starting point of C program execution?

    1. #include
    2. void main()
    3. Opening curly braces ‘{‘
    4. None of these
    Show Answer
    Answer :     Option ( B )
  61. Which symbol ends a statement in C program?

    1. . (full stop)
    2. ; (semicolon)
    3. : (colon)
    4. } (curly braces)
    Show Answer
    Answer :     Option ( B )
  62. Which symbol is used to comment single statement?

    1. //
    2. \
    3. /*
    4. \*
    Show Answer
    Answer :     Option ( A )
  63. Why preprocessor directive needed in the beginning of a C program?

    1. To start execution of a program
    2. To include keywords in a program
    3. To include files in a program
    4. None of these
    Show Answer
    Answer :     Option ( C )
  64. Header file is compulsory to include in a C program printing "Hello World"

    1. True
    2. False
    Show Answer
    Answer :     Option ( A )
  65. Which of the following is not a basic data type in C language?

    1. float
    2. int
    3. real
    4. char
    Show Answer
    Answer :     Option ( C )
  66. How many keywords are there in C?

    1. 31
    2. 32
    3. 64
    4. 63
    Show Answer
    Answer :     Option ( B )
  67. Which of the following is true for variable names in C?

    1. Variable names cannot start with a digit
    2. Variable can be of any length
    3. They can contain alphanumeric characters as well as special characters
    4. Reserved word can be used as a variable name
    Show Answer
    Answer :     Option ( A )
  68. Character literal in C syntax is?

    1. Z
    2. ‘Z’
    3. "Z"
    4. None of these
    Show Answer
    Answer :     Option ( B )
  69. Choose the correct statement about C escape sequences

    1. \n produces a new line
    2. \t produces one tab space (white spaces)
    3. \b produces one backspace
    4. All of these
    Show Answer
    Answer :     Option ( D )
  70. Choose a valid C format specifier

    1. %d prints integer constants
    2. %f prints float constants
    3. %c prints character constants
    4. All of these
    Show Answer
    Answer :     Option ( D )
  71. What is the output?

    void main() { float a=654.1239; printf("%0.3f",a); }
    1. Compiler error
    2. 654.123900
    3. 654.123
    4. 654.124
    Show Answer
    Answer :     Option ( D )
  72. Choose a C formatted Input-Output function below.

    1. printf(), scanf()
    2. sprintf(), sscanf()
    3. fprintf(), fscanf()
    4. All of these
    Show Answer
    Answer :     Option ( D )
  73. Multiple variable declarations are separated with

    1. Semicolon (;)
    2. Colon (;)
    3. Comma(,)
    4. None of these
    Show Answer
    Answer :     Option ( C )
  74. What is the other name of backslash character constants?

    1. Slash characters
    2. Space characters
    3. Escape sequences
    4. None of these
    Show Answer
    Answer :     Option ( C )
  75. Which operator is used to compare two values?

    1. Logical operator
    2. Relational operator
    3. Assignment operator
    4. None of these
    Show Answer
    Answer :     Option ( B )
  76. The operator ‘&’ is used as

    1. Logical AND
    2. Bitwise AND
    3. Logical OR
    4. Bitwise OR
    Show Answer
    Answer :     Option ( B )
  77. Which of the following is a valid relational operator?

    1. =
    2. =>
    3. ==
    4. >>
    Show Answer
    Answer :     Option ( C )
  78. What will be the value of variable a?

    float a = 3.5 + 4.5;
    1. a = 8.0
    2. a = 8
    3. a = 7
    4. a = 0.0
    Show Answer
    Answer :     Option ( A )
  79. What will be the value of variable a?

    int a = 3.5 + 4.5;
    1. a =0
    2. a =7
    3. a =8
    4. a =8.0
    Show Answer
    Answer :     Option ( C )
  80. Choose a right statement

    int a = 5/2; int b = 5.0/2; int c = 5 / 2.0; int d = 5.0/2.0;
    1. a = 2, b = 2, c = 2, d= 2
    2. a = 2, b = 2.0, c = 2, d= 2.0
    3. a = 2, b = 2.5, c = 2.5, d= 2.5
    4. a = 2.5, b = 2.5, c = 2.5, d= 2.5
    Show Answer
    Answer :     Option ( A )
  81. Choose a right statement.

    float a = 5/2; float b = 5/2.0; float c = 5.0/2; float d = 5.0/2.0;
    1. a=2.5, b=2.5, c=2.5, d=2.5
    2. a=2, b=2.5, c=2.5, d=2.5
    3. a=2.0, b=2.5, c=2.5, d=2.5
    4. a=2.0, b=2.0, c=2.0, d=2.0
    Show Answer
    Answer :     Option ( C )
  82. What will the value of variable a?

    int a = 25%10;
    1. 2.5
    2. 2
    3. 5
    4. Compiler error
    Show Answer
    Answer :     Option ( C )
  83. Which of the following is a valid assignment operator?

    1. +=
    2. -=
    3. *=
    4. All of these
    Show Answer
    Answer :     Option ( D )
  84. What will be the value of variable d?

    int a = 10, b = 5, c = 5,d; d = b + c == a;
    1. Syntax error
    2. 1
    3. 5
    4. 10
    Show Answer
    Answer :     Option ( B )
  85. What is the output?

    void main() { int a = 10, b = 5, c = 3; b != !a; c = !!a; printf("%d\t%d", b, c); }
    1. 5 1
    2. 0 3
    3. 5 3
    4. 1 1
    Show Answer
    Answer :     Option ( A )
  86. What will be the value of variable b?

    int a; int b; a=1; b=a++;
    1. 1
    2. 2
    3. 3
    4. unknown/undefined
    Show Answer
    Answer :     Option ( A )
  87. What will be the value of variable b?

    int a; int b; a=1; b=++a;
    1. 1
    2. 2
    3. 3
    4. unknown/undefined
    Show Answer
    Answer :     Option ( B )
  88. What will be the value of variable z?

    int x=3,y=4; z = ++x * y++;
    1. 9
    2. 12
    3. 16
    4. 20
    Show Answer
    Answer :     Option ( C )
  89. What will be the output?

    void main() { int a=9, b=9; a=b++; printf("%d %d",a,b); }
    1. 9,9
    2. 10,10
    3. 9,10
    4. 10,9
    Show Answer
    Answer :     Option ( C )
  90. Choose the correct statement about Left Shift Operator <<

    1. Left shift operator shifts individual bits on the left side
    2. When shifting left side, overflow bits are ignored
    3. Zeroes are filled on the right side
    4. All of these
    Show Answer
    Answer :     Option ( D )
  91. Choose the correct statement about Right Shift Operator >>

    1. Right shift operator shifts individual bits on to the right side
    2. When shifting bits right side, overflow bits on the right are ignored or truncated
    3. Zeroes are filled on the left side
    4. All of these
    Show Answer
    Answer :     Option ( D )
  92. Which is bit toggling operator below?

    1. & Bitwise AND
    2. Bitwise OR
    3. ^ Bitwise exclusive OR
    4. ~ Bitwise complement
    Show Answer
    Answer :     Option ( D )
  93. Left Shift operation is equivalent to____

    1. Division by 2
    2. Multiplying by 2
    3. Adding 2
    4. Subtracting 2
    Show Answer
    Answer :     Option ( B )
  94. Right Shift operation >> is equivalent to___

    1. Multiplying by 2
    2. Division by 2
    3. Adding 2
    4. Subtracting 2
    Show Answer
    Answer :     Option ( B )
  95. What will be the value of variable c?

    int c = 2 ^ 3;
    1. 1
    2. 8
    3. 9
    4. 0
    Show Answer
    Answer :     Option ( A )
  96. What will be the value of variable a?

    int a = 6; a = ~a;
    1. -6
    2. 9
    3. -7
    4. 6
    Show Answer
    Answer :     Option ( C )
  97. An arithmetic expression without parenthesis will be evaluated from left to right

    1. True
    2. False
    Show Answer
    Answer :     Option ( A )
  98. In C programming, the statement a=a+1 and a+=1 will produce same result

    1. True
    2. False
    Show Answer
    Answer :     Option ( A )
  99. Within an expression, __________ precedence operators will be evaluated first

    1. Similar
    2. Higher
    3. Lower
    4. None of these
    Show Answer
    Answer :     Option ( B )
  100. What will the value of variable a?

    int a = 4 + 4/2*5 + 20;
    1. 40
    2. 4
    3. 34
    4. 34
    Show Answer
    Answer :     Option ( C )
  101. What will the value of variable a?

    int a = 10 + 5 * 2 * 8 / 2 + 4;
    1. 124
    2. 54
    3. 23
    4. 404
    Show Answer
    Answer :     Option ( B )
  102. What will the value of variable a?

    int a = 4 + 5/2*10 + 5;
    1. 29
    2. 5
    3. 4
    4. 34
    Show Answer
    Answer :     Option ( A )
  103. What will the value of variable a?

    int a = 10 + 2 * 12 /(3*2) + 5;
    1. 31
    2. 19
    3. 11
    4. 29
    Show Answer
    Answer :     Option ( B )
  104. Which of the following correctly shows the hierarchy of arithmetic operations in C?

    1. / + * -
    2. * - / +
    3. / * + -
    4. + - / *
    Show Answer
    Answer :     Option ( C )
  105. In the following expression guess the correct order of execution of operator

    z = x - y / z * 1 % 2 + 1
    1. / * % - + =
    2. * / % - + =
    3. = / * - % +
    4. = / * % - +
    Show Answer
    Answer :     Option ( A )
  106. What is the output?

    void main() { int i=0, j=1, k=2, m; m = i++ || j++ || k++; printf("%d %d %d %d", m, i, j, k); }
    1. 1 1 2 3
    2. 1 1 2 2
    3. 0 1 2 2
    4. 0 1 2 3
    Show Answer
    Answer :     Option ( B )
  107. What is the output?

    void main() { int x = 1, y = 2; printf("%d", x, y); }
    1. 1 2
    2. 1
    3. 2
    4. Error
    Show Answer
    Answer :     Option ( B )
Tags

Post a Comment

2Comments

  1. Great ��, it helps me a lot

    ReplyDelete
  2. Its really helpful. After learning practicing mcq makes our topics more clear and strong.

    ReplyDelete
Post a Comment

#buttons=(Accept !) #days=(20)

Our website uses cookies to enhance your experience. Check Now
Accept !