2. 51. What is the output of this C code?
#include <stdio.h>
int main()
{
register static int i = 10;
i = 11;
printf("%dn", i);
}
a) 10
b) Compile time error
c) Undefined behaviour
d) 11
Answer: B
3. 52. The C- preprocessors are specified with _________symbol.
a) #
b) $
c) โ โ
d) None of the mentioned
53. The #include directive
a) Tells the pre-processor to grab the text of a file and place it directly into the
current file
b) Statements are typically placed at the top of a program
c) both a & b
d) None of a & b
Answer: A
Answer: C
4. 54. The preprocessor provides the ability for _______________.
a) The inclusion of header files
b) The inclusion of macro expansions
c) Conditional compilation and line control.
d) All of the mentioned
55. If #include is used with file name in angular brackets
a) The file is searched for in the standard compiler include paths
b) The search path is expanded to include the current source directory
c) Both a & b
d) None of the mentioned
Answer: D
Answer: A
5. 56. Which of the following data types are accepted while declaring bit-fields?
a) char
b) float
c) double
d) None of the mentioned
57. Which of the following reduces the size of a structure?
a) union
b) bit-fields
c) malloc
d) None of the mentioned
Answer: A
Answer: B
6. 58. In the declaration of bit-fields,
struct-declarator:
declarator
type-specifier declarator opt : constant-expression
The constant-expression specifies
a) The width of the field in bits.
b) Nothing
c) The width of the field in bytes.
d) Error
Answer: A
7. 59. In the declaration of bit-fields,
struct-declarator:
declarator
type-specifier declarator opt : constant-expression
The constant-expression must be
a) Any type
b) Nothing
c) Integer value
d) Nonnegative integer value
Answer:D
8. 60. Which of the following is not allowed?
a) Arrays of bit fields
b) Pointers to bit fields
c) Functions returning bit fields
d) None of the mentioned
61. Bit fields can only be declared as part of a structure.
a) false
b) true
c) Nothing
d) Varies
Answer: D
Answer: B
9. 62. The following declarations in order are
short a : 17;
int long y : 33;
a) Legal, legal
b) Legal, illegal
c) Illegal, illegal
d) Illegal, legal
Answer: C
10. 63. Which of the following return-type cannot be used for a function in C?
a) char *
b) struct
c) void
d) None of the mentioned
64. Presence of code like โs.t.b = 10โ indicate.
a) Syntax Error
b) structure
c) double data type
d) An ordinary variable name
Answer: D
Answer: B
11. 65. Which of the following is not possible under any scenario?
a) s1 = &s2;
b) s1 = s2;
c) (*s1).number = 10;
d) None of the mentioned
66. Which of the following operation is illegal in structures?
a) Typecasting of structure
b) Pointer to a variable of same structure
c) Dynamic allocation of memory for structure
d) All of the mentioned
Answer: D
Answer: A
12. 67. Which of the following are themselves a collection of different data types?
a) string
b) structures
c) char
d) All of the mentioned
68. User-defined data type can be derived by___________.
a) struct
b) enum
c) typedef
d) All of the mentioned
Answer: B
Answer: D
13. 69. Which operator connects the structure name to its member name?
a) โ
b) <-
c) .
d) Both (b) and (c)
70. Which of the following cannot be a structure member?
a) Another structure
b) Function
c) Array
d) None of the mentioned
Answer: C
Answer: B
14. 71. Size of a union is determined by size of the.
a) First member in the union
b) Last member in the union
c) Biggest member in the union
d) Sum of the sizes of all members
72. Members of a union are accessed as________________.
a) union-name.member
b) union-pointer->member
c) Both a & b
d) None of the mentioned
Answer: C
Answer: C
15. 73. The number of digits present after decimal in float is________.
a. 1
b. 3
c. 6
d. 16
74. Which among the following is never possible as an output for float?
a. 3.666666
b. 3.666
c. 3
d. None of the mentioned
Answer: D
Answer: C
16. 75. In a 32-bit compiler, which 2 types have same size?
a. char and short
b. short and int
c. int and float
d. float and double
76. What is the size of float in a 32-bit compiler?
a. 1
b. 2
c. 4
d. 8
Answer: C
Answer: C
17. 77. Loss in precision occurs for typecasting from____________.
a. char to short
b. float to double
c. long to float
d. float to int
78. Select the odd one out with respect to type?
a. char
b. int
c. long
d. float
Answer: D
Answer: D
18. 79. The size is decided by:
a. char
b. int
c. float
d. Both (b) and (c)
80. %f access specifier is used for
a. Strings
b. Integral types
c. Floating type
d. All of the mentioned
Answer: D
Answer: C
19. 81. What is the sizeof(char) in a 32-bit C compiler?
a. 1 bit
b. 2 bits
c. 1 Byte
d. 2 Bytes
82. What is the output of this C code?
#include <stdio.h>
printf("%d", sizeof('a'));
a. 1
b. 2
c. 4
d. None of the mentioned
Answer: C
Answer: C
20. 83. Size of an array can be evaluated by:
(Assuming array declaration int a[10];)
a. sizeof(a);
b. sizeof(*a);
c. sizeof(a[10]);
d. 10 * sizeof(a);
Answer: A
21. 84. Which of the following is not an operator in C?
a. ,
b. sizeof()
c. ~
d. None of the mentioned
85. Which among the following has the highest precedence?
a. &
b. <<
c. sizeof()
d. &&
Answer: D
Answer: C
22. 86. The sizeof(void) in a 32-bit C is_____.
a. 0
b. 1
c. 2
d. 4
87. What type of value does sizeof return?
a. char
b. short
c. unsigned int
d. long
Answer: B
Answer: C
23. 88. Which among the following is never possible in C when members are
different in a structure and union?
//Let P be a structure
//Let Q be a union
a. sizeof(P) is greater than sizeof(Q)
b. sizeof(P) is less than sizeof(Q)
c. sizeof(P) is equal to sizeof(Q)
d. None of the mentioned
Answer: D
24. 89. Which among the following is never possible in C when members in a
structure are same as that in a union?
//Let P be a structure
//Let Q be a union
a. sizeof(P) is greater than sizeof(Q)
b. sizeof(P) is equal to sizeof(Q)
c. sizeof(P) is less than to sizeof(Q)
d. None of the mentioned
Answer: C
25. 90. Which among the following is right?
a. sizeof(struct stemp*) > sizeof(union utemp*) > sizeof(char *)
b. sizeof(struct stemp*) < sizeof(union utemp*) < sizeof(char *)
c. sizeof(struct stemp*) = sizeof(union utemp*) = sizeof(char *)
d. The order Depends on the compiler
Answer: C
91. Which of the following cannot be used inside sizeof?
a. pointers
b. functions
c. macro definition
d. None of the mentioned
Answer:d
26. 92. What is the output of this C code?
#include <stdio.h>
printf("%.0f", 2.89);
a. 2.890000
b. 2.89
c. 2
d. 3
Answer: D
27. 93. What is the output of this C code?
#include <stdio.h>
int main()
{
float a = 2.455555555555;
printf("%f", a);
}
a. 2.455555
b. 2.455556
c. 2.456
d. 2.46
Answer: A
28. 94. Which of the following % operation is invalid?
a. 2 % 4;
b. 2 % 4l;
c. 2 % 4f;
d. Both (b) and (c)
95. Which data type is suitable for storing a number like?
10.0000000001
a. int
b. float
c. double
d. Both (b) and (c)
Answer: C
Answer: C
29. 96. Modulus for float could be achieved by?
a. a % b
b. modulus(a, b);
c. fmod(a, b);
d. mod(a, b);
97. Predict the data type of the following mathematical operation?
2 * 9 + 3 / 2 . 0
a. int
b. long
c. float
d. double
Answer: C
Answer: D
30. 98. %lf is used to display
a. float
b. long float
c. double
d. All of the mentioned
Answer: C