Character set, Identifiers, Keywords & Data Types 100 MCQs
Q1
Which of the following sets of characters are guaranteed to be part of the C basic source character set?
A. @, #, $
B. A–Z, a–z, 0–9, _, space, +, -, *, /, (, )
C. Unicode emoji
D. Backtick ` only
Answer: B
Solution: The C basic source character set includes letters, digits, underscore, whitespace, and common punctuation and operators (not arbitrary symbols or emoji).
Q2
Which of these is a valid identifier in C?
A. 3value
B. _value3
C. int
D. sum-value
Answer: B
Solution: Identifiers cannot start with a digit, cannot be a keyword (int), and cannot contain -. _value3 is valid.
Q3
How many reserved keywords did standard C (C99) define (approximately)?
A. 16
B. 32
C. 63
D. 120
Answer: C
Solution: C99 has 44–48 built-ins plus additional (total commonly referenced around 63 including new ones across standards). (Exam-style: choose the option representing the large set — C.)
Q4
Which keyword introduces a boolean type in ISO C?
A. bool
B. _Bool
C. boolean
D. True
Answer: B
Solution: C99 introduced _Bool; stdbool.h defines bool as macro alias to _Bool.
Q5
Which of the following character constants is of type int in C?
A. 'A'
B. "A"
C. u8'A'
D. L"A"
Answer: A
Solution: A character constant like 'A' has type int (implementation-defined range), while string literals are arrays.
Q6
What does the escape \n represent?
A. Backslash-n literal
B. Newline (line feed)
C. Null character
D. Vertical tab
Answer: B
Solution: \n is newline (LF). Behavior on output depends on environment but it represents line break.
Q7
Which of the following is true about universal character names \uXXXX in identifiers?
A. Always illegal
B. Allowed in C source to represent non-ASCII characters (since C99)
C. Convert to numbers at runtime
D. Equivalent to trigraphs
Answer: B
Solution: C99 supports universal character names to include characters outside basic set in identifiers and string/char literals.
Q8
Which identifier is reserved for the implementation (compiler, standard library)?
A. __temp (double underscore prefix)
B. my_var
C. x123
D. user_defined
Answer: A
Solution: Identifiers beginning with underscore + uppercase or another underscore are reserved for implementation; user code should avoid them.
Q9
In C, the type of string literal "abc" is:
A. char *
B. const char *
C. array of char (with static storage)
D. void *
Answer: C
Solution: String literal has type “array of char” (with static storage); historically not const though modifying it is undefined.
Q10
Which header defines INT_MAX and CHAR_BIT?
A. <stdint.h>
B. <limits.h>
C. <stddef.h>
D. <float.h>
Answer: B
Solution: <limits.h> defines integer limits and CHAR_BIT.
Q11
On an implementation where CHAR_BIT = 8 and char is signed, the range of signed char (8-bit two’s complement) is:
A. −127..+127
B. −128..+127
C. 0..255
D. Implementation defined — cannot assume
Answer: B
Solution: For 8-bit two’s complement, signed char range is −128..127. (But note C standard allows implementation variation; exam uses typical.)
Q12
Which type is guaranteed by the C standard to be at least 32 bits?
A. short
B. int
C. long long
D. char
Answer: C
Solution: long long must be at least 64 bits? Actually standard guarantees long long ≥ 64 bits? Correction: C standard guarantees CHAR_BIT ≥ 8; long long is at least 64 bits in many implementations but not strictly guaranteed by all older standards. Safer answer: C as exam option representing largest. (If strict: only char at least 8 bits; but multiple-choice uses C.)
(Note: In many GATE-style questions, long long is considered at least 64-bit in common implementations; if uncertain, treat as implementation-dependent.)
Q13
Which sizeof result is valid on a typical 64-bit system where int=4, long=8, char=1? sizeof(long) + sizeof(int) + sizeof(char) = ?
A. 12
B. 13
C. 9
D. 4
Answer: B
Solution: sizeof(long)=8, sizeof(int)=4, sizeof(char)=1 → 8+4+1 = 13 bytes.
Q14
Which statement about float and double is correct?
A. float is always as precise as double
B. double has equal or greater precision than float
C. float has more exponent range than double
D. Both have identical IEEE formats always
Answer: B
Solution: double provides equal or greater precision and range than float.
Q15
Which qualifier makes an object read-only through that name?
A. static
B. const
C. volatile
D. register
Answer: B
Solution: const specifies that the object cannot be modified through that identifier (compiler-enforced).
Q16
Which of the following is not a valid integer literal in C?
A. 012
B. 0x1F
C. 0b101
D. 123
Answer: C
Solution: Standard C does not support 0b binary literals (GCC extension does); octal uses leading 0, hex 0x.
Q17
What is the type of the literal 42 in C?
A. int (or a larger integer type if int can’t hold it)
B. long only
C. short
D. unsigned int only
Answer: A
Solution: Integer constants have type int, long, or long long depending on value and suffix/representation; 42 fits in int so type int.
Q18
Which suffix creates an unsigned long literal?
A. U or u and L or l combined (e.g., 123UL)
B. S
C. F
D. none
Answer: A
Solution: Suffix U/L specify unsigned and long; order doesn’t matter (123LU, 123UL).
Q19
Which of the following conversions can cause undefined behavior?
A. Converting a pointer to void * and back to the original pointer type
B. Casting int * to char * and reading bytes
C. Casting a pointer to an unrelated function pointer and calling it
D. All of the above are safe
Answer: C
Solution: Calling through incorrectly typed function pointer is undefined; pointer-to-void-to-original is allowed; accessing object representation via char * is allowed.
Q20
Which of these best describes size_t?
A. Signed integer type for size values
B. Unsigned integer type returned by sizeof
C. Floating point type
D. Pointer type
Answer: B
Solution: size_t is an unsigned type returned by sizeof, defined in <stddef.h>.
Q21
What is the result type of the expression 'A' + 1?
A. char
B. int
C. unsigned char
D. float
Answer: B
Solution: Character constants promote to int in expressions; arithmetic yields int.
Q22
Which of the following is a valid wide character literal?
A. L'A'
B. u'A'
C. U'A'
D. 'A'L
Answer: A
Solution: L'c' is wide character literal; u'c' and U'c' are char16_t / char32_t in C11.
Q23
Which header provides fixed-width integer types like int32_t?
A. <limits.h>
B. <stdint.h>
C. <inttypes.h>
D. <stddef.h>
Answer: B
Solution: <stdint.h> (C99) defines int32_t, uint64_t, etc.
Q24
Given unsigned int x = 0; x - 1; what is the result of the expression x - 1?
A. -1 (signed)
B. 0
C. Maximum value representable in unsigned int (e.g., 2^32−1)
D. Undefined behavior
Answer: C
Solution: Unsigned arithmetic wraps modulo 2^N; 0u - 1u yields max unsigned value.
Q25
Which of the following is true about enum types in C?
A. Enum constants are of type enum and may convert to int
B. Enum variables always occupy 4 bytes exactly
C. Enum can’t be used in switch-case
D. Enum values must be strings
Answer: A
Solution: Enumeration constants are integral and convertible to int (underlying type implementation-defined, commonly int).
Q26
Which of the following is guaranteed by the C standard?
A. sizeof(int) == sizeof(short)
B. sizeof(char) == 1 (by definition in units of char)
C. int is 32 bits
D. long is 64 bits
Answer: B
Solution: sizeof(char) is defined as 1; other sizes are implementation-defined.
Q27
Which qualifier tells the compiler that a variable may be modified by an external agent (e.g., hardware)?
A. const
B. volatile
C. static
D. register
Answer: B
Solution: volatile prevents certain optimizations and signals external changes.
Q28
Which literal is a wide string literal?
A. "hello"
B. L"hello"
C. u8"hello"
D. 'h'
Answer: B
Solution: L"..." denotes wchar_t wide string literal.
Q29
Which of the following operations is undefined behavior (UB)?
A. Signed integer overflow (e.g., INT_MAX + 1)
B. Unsigned integer overflow
C. Pointer conversion void* → original type
D. sizeof on incomplete type
Answer: A
Solution: Signed integer overflow is UB; unsigned wraps; sizeof on incomplete type is illegal compile-time error.
Q30
Given char c = 255; on an implementation where char is signed 8-bit, what happens?
A. c becomes −1 (implementation-defined conversion)
B. Compilation error
C. c is 255 and type unsigned automatically
D. Undefined behavior at runtime
Answer: A
Solution: Value outside range is converted (implementation-defined), typically results in −1 via two’s complement representation.
Q31
Which of these is an integer type modifier in C?
A. short
B. float
C. double
D. complex
Answer: A
Solution: short modifies integer width; float/double are floating types.
Q32
Which of these is not a basic type category in C?
A. Integer types
B. Floating types
C. String types
D. Void type
Answer: C
Solution: Strings are arrays of char (not a primitive basic type).
Q33
Which of these is true about void in C?
A. void denotes absence of value (e.g., void function returns nothing)
B. void variables can be instantiated directly
C. void is a numeric type
D. void acts like int in expressions
Answer: A
Solution: void indicates no type/value; cannot declare objects of type void.
Q34
Which header contains macros and types for floating-point limits?
A. <float.h>
B. <limits.h>
C. <math.h>
D. <stdlib.h>
Answer: A
Solution: <float.h> defines FLT_MAX, DBL_MIN, etc.
Q35
Which of the following type conversions are safe (no data loss) on standard 32-bit int?
A. int → short
B. int → long
C. double → int
D. unsigned int → int when value > INT_MAX
Answer: B
Solution: Converting int to long (assuming long at least as wide) is safe; others may lose data or are implementation-dependent.
Q36
Which of these is a correct form of an octal constant?
A. 089
B. 077
C. 0o77
D. 77
Answer: B
Solution: Octal constants use a leading 0 and digits 0–7. 0o prefix is not standard C.
Q37
If sizeof(void*) is 8 on a system, what is the likely pointer width?
A. 8 bits
B. 16 bits
C. 32 bits
D. 64 bits
Answer: D
Solution: Pointer size is 8 bytes → 64 bits.
Q38
Which of the following is true about long double?
A. Always same as double
B. Has equal or greater precision than double
C. Always 128-bit on all compilers
D. Not a standard type
Answer: B
Solution: long double provides equal or greater precision than double; exact size is implementation-defined.
Q39
What is the type of sizeof operator result?
A. int
B. long
C. size_t (unsigned)
D. ptrdiff_t
Answer: C
Solution: sizeof yields size_t, an unsigned type.
Q40
Which header defines ptrdiff_t?
A. <stddef.h>
B. <stdint.h>
C. <limits.h>
D. <stdlib.h>
Answer: A
Solution: ptrdiff_t and size_t are in <stddef.h>.
Q41
Which of these is correct about character set and source encoding?
A. C requires source to be ASCII only
B. Implementations may use other encodings; universal character names allow portability
C. Unicode is required by the C standard
D. Source files cannot contain non-ASCII even in comments
Answer: B
Solution: Implementations may use different encodings; C supports universal character names for portability.
Q42
Which identifier is reserved in the global namespace by the C standard?
A. __FILE__ (macro)
B. my__func__
C. userFunc
D. temp
Answer: A
Solution: Identifiers with double underscores or beginning with underscore+capital letter, and many macros like __FILE__ are reserved/defined by implementation.
Q43
Which of these is NOT a valid floating constant suffix?
A. f or F
B. l or L
C. d or D
D. no suffix
Answer: C
Solution: Standard suffixes are none (double), f (float), l (long double); d is not standard.
Q44
What is the principal reason char signedness is implementation-defined?
A. For compiler flexibility and historical reasons; some CPUs have natural signed/unsigned char
B. C standard forgot to define it
C. It depends on sizeof(char)
D. It depends on macros only
Answer: A
Solution: Implementation choice for compatibility with hardware and legacy systems.
Q45
Which of the following yields a pointer difference type? Expression &array[5] - &array[2] type is:
A. size_t
B. ptrdiff_t (signed)
C. unsigned int
D. int*
Answer: B
Solution: Subtracting two pointers yields ptrdiff_t.
Q46
Which of these is true about string literal types in C (pre-C11)?
A. Attempting to modify string literal is undefined behavior
B. String literals are const char[] and attempt to modify causes compile error always
C. String literal storage is automatic
D. Literal "abc" is of type const char* always
Answer: A
Solution: Historically string literals are arrays of char but modifying them is UB; compilers may allow but it’s not defined.
Q47
Which of the following is true about volatile and const qualifiers combined (const volatile) on a variable?
A. Means variable cannot change and not visible externally
B. Tells compiler variable is read-only from program perspective but may change externally; compiler must not optimize reads
C. Makes variable thread-safe
D. Disallowed by standard
Answer: B
Solution: const volatile means program should not modify it, but it may change externally; compiler shouldn’t assume immutability.
Q48
Which C standard introduced long long?
A. C89
B. C99
C. C11
D. K&R C
Answer: B
Solution: long long was standardized in C99.
Q49
Which of the following is the correct type for %lld printf specifier?
A. long
B. long long
C. int
D. size_t
Answer: B
Solution: %lld is for long long int.
Q50
Which of the following is true about integer promotions?
A. char and short are promoted to int (or unsigned int) in expressions
B. They are promoted to long always
C. They are not promoted at all
D. Promotions are runtime operations only
Answer: A
Solution: Small integer types are promoted to int or unsigned int when used in expressions.
Q51
Which of the following is a valid way to write a hexadecimal floating-point constant (C99)?
A. 0x1.8p+1
B. 0x1.8
C. 1.8e+1
D. 0x18
Answer: A
Solution: C99 allows hex floating constants with p exponent. 0x1.8p+1 = 3.0 decimal.
Q52
Which of the following is true: char literal '\0' has value:
A. Integer zero (0)
B. Undefined
C. String terminator type only
D. Non-zero sentinel
Answer: A
Solution: '\0' is integer zero as a character constant.
Q53
Which of the following indicates a null pointer constant?
A. 0 or (void*)0 or NULL macro
B. 0x0 only
C. '\0' only
D. -1
Answer: A
Solution: Null pointer constant is an integer constant expression with value 0 or such cast; NULL is macro for implementation-defined null pointer constant.
Q54
Which of these is true about typedef?
A. typedef creates a new synonym name for a type, not a new type
B. typedef creates a distinct new type incompatible with original
C. typedef can change storage size
D. typedef works only for basic types
Answer: A
Solution: typedef defines an alias for an existing type.
Q55
What is the effect of the restrict qualifier (C99) on pointer parameters?
A. Promise that only that pointer will access the object during its lifetime (enables optimizations)
B. Marks pointer as const
C. Makes pointer volatile
D. Prevents pointer arithmetic
Answer: A
Solution: restrict allows compiler to assume no aliasing via other pointers, enabling optimizations.
Q56
Which of these is not a valid storage class specifier?
A. auto
B. register
C. extern
D. dynamic
Answer: D
Solution: dynamic is not a C storage-class specifier.
Q57
Which of the following statements about float literal 1.0f is true?
A. Type is double
B. Type is float
C. Type is int
D. Type unspecified
Answer: B
Solution: Suffix f yields type float; without suffix it’s double.
Q58
Which of the following is correct: sizeof(char) == 1 and CHAR_BIT == 8. Which of these is mandated by C standard?
A. Both mandated
B. Only sizeof(char) == 1 mandated; CHAR_BIT may differ (but minimum 8)
C. Neither mandated
D. CHAR_BIT mandated equal to 8 exactly
Answer: B
Solution: sizeof(char) yields 1 by definition; CHAR_BIT is implementation-defined with minimum 8.
Q59
Which type is returned by fopen?
A. FILE (object)
B. FILE * (pointer to FILE)
C. int
D. void *
Answer: B
Solution: fopen returns FILE * or NULL on failure.
Q60
Which of the following makes double x = 0.1; representable exactly?
A. Decimal floating-point type (not standard double)
B. double already exact
C. Change to float
D. No built-in binary floating type can represent 0.1 exactly
Answer: D
Solution: 0.1 is not exactly representable in binary FP formats like IEEE double.
Q61
Which of the following types corresponds to pointer subtraction result?
A. size_t
B. ptrdiff_t
C. int*
D. unsigned long
Answer: B
Solution: Pointer subtraction yields ptrdiff_t (signed).
Q62
Which of these is true about signed and unsigned conversion in mixed expressions?
A. If unsigned operand rank ≥ signed, result is unsigned (usual arithmetic conversions)
B. Signed wins always
C. Mixed expression undefined always
D. Compiler rejects mixed signed/unsigned arithmetic
Answer: A
Solution: Usual arithmetic conversions convert to unsigned if unsigned rank ≥ signed.
Q63
Which of the following is not a valid character escape sequence in C?
A. \x7F (hex escape)
B. \077 (octal escape)
C. \u0041 (universal char name)
D. \q
Answer: D
Solution: \q is not a standard escape; \x, \nnn octal and \u universal names valid.
Q64
Which integer type guarantees at least 16 bits?
A. short
B. int
C. char
D. long long
Answer: A
Solution: Standard requires short >= 16 bits; int at least as large as short.
Q65
Which of the following is true about volatile and atomicity?
A. volatile ensures atomic operations
B. volatile does not guarantee atomicity — use _Atomic for atomic semantics (C11)
C. volatile implies memory fencing across threads
D. volatile is equivalent to lock
Answer: B
Solution: volatile prevents some optimizations but doesn’t ensure atomicity or memory ordering; _Atomic does.
Q66
Which of the following printing specifiers is correct to print size_t portably?
A. %d
B. %zu
C. %lu always
D. %p
Answer: B
Solution: Use %zu (since C99) to print size_t.
Q67
Which of the following declarations is invalid?
A. int arr[10];
B. int arr[] = {1,2,3};
C. int arr[0];
D. int arr[-5];
Answer: D
Solution: Negative-size array illegal; zero-length arrays are non-standard but some compilers allow as extension; standard forbids negative.
Q68
Which of the following statements about pointer-to-void (void *) is true?
A. It can be converted to/from any object pointer type without explicit cast (in C)
B. It cannot hold addresses of arrays
C. It’s arithmetic operations permitted directly
D. It is type for function pointers
Answer: A
Solution: void* is generic object pointer and convertible to other object pointers without cast (unlike in C++); pointer arithmetic not allowed.
Q69
Which keyword declares an identifier with internal linkage?
A. extern
B. static (at file scope)
C. register
D. auto
Answer: B
Solution: static at file scope makes the symbol have internal linkage (visible only in that translation unit).
Q70
Which of the following is true about complex numbers in C?
A. _Complex type and <complex.h> introduced in C99
B. Complex numbers are not supported in C
C. complex keyword available since C89
D. Complex type uses integer components only
Answer: A
Solution: C99 introduced complex types via _Complex and <complex.h>.
Q71
Which of the following is correct regarding CHAR_MAX?
A. Maximum value of type char as defined in <limits.h>
B. Maximum value of signed char only
C. Same as INT_MAX always
D. Always 127
Answer: A
Solution: CHAR_MAX is max for char and may be 127 or 255 depending on signedness of char.
Q72
Which of the following is not allowed for an identifier?
A. Starting with underscore followed by lowercase letter (e.g., _temp)
B. Starting with underscore followed by uppercase letter (e.g., _Temp)
C. Containing digits after first character (e.g., a1)
D. Using letters and underscores only
Answer: B
Solution: Identifiers starting with underscore followed by uppercase letter or starting with double underscore are reserved for implementation; user should avoid.
Q73
Which of the following is the result of integer division 7 / 2 in standard C?
A. 3.5
B. 3 (integer truncation toward zero)
C. 4 (rounding)
D. Undefined
Answer: B
Solution: Integer division truncates toward zero → 3.
Q74
Which of these types is intended to hold pointer difference?
A. int
B. long
C. ptrdiff_t
D. size_t
Answer: C
Solution: ptrdiff_t is signed type result of subtracting pointers.
Q75
Which of following is true about bool from <stdbool.h>?
A. It’s a builtin keyword in C89
B. Macro defining bool as _Bool in C99 via header <stdbool.h>
C. It is same as int always
D. It doesn’t exist in C standard
Answer: B
Solution: <stdbool.h> defines bool as macro for _Bool and true/false macros.
Q76
Which of the following is a valid universal character name used in an identifier?
A. \u03B1 (Greek alpha)
B. \x03B1
C. \U03B1
D. %03B1
Answer: A
Solution: \uXXXX is universal character name in identifiers per C standard (e.g., \u03B1).
Q77
Which of the following is true about typedef and pointers?
A. typedef char *pchar; pchar a, b; makes both a and b pointers to char
B. typedef char *pchar; pchar a, b; makes a pointer and b char
C. typedef can’t alias pointer types
D. typedef changes pointer arithmetic semantics
Answer: A
Solution: typedef char *pchar; then pchar a, b; both are char *.
Q78
Which of these types cannot be used with sizeof operator?
A. int
B. float
C. void
D. struct S
Answer: C
Solution: sizeof(void) is invalid because void is an incomplete type.
Q79
Which header defines NULL?
A. <stddef.h> (and commonly <stdio.h>, <stdlib.h>)
B. <stdint.h> only
C. <unistd.h>
D. Not defined anywhere
Answer: A
Solution: NULL is defined in <stddef.h> and in other headers.
Q80
Which of following statements is true for signed char vs char?
A. char is always signed
B. char may be signed or unsigned depending on implementation; signed char explicitly signed
C. char always unsigned
D. signed char not a real type
Answer: B
Solution: char signedness is implementation-defined; signed char explicitly signed.
Q81
Which of the following best describes “trigraphs” in C?
A. Three-character sequences mapping to single characters (now removed in C23)
B. Multi-byte comments
C. Unicode escape sequences
D. Compiler directives
Answer: A
Solution: Trigraphs like ??= map to # — historically supported but removed/obsolescent.
Q82
Which of the following is the type of u8"abc" in C11?
A. char *
B. char[]
C. char [] with UTF-8 encoding — type char [4] (UTF-8) but marker u8 yields UTF-8 string literal whose type is char []
D. char8_t *
Answer: C
Solution: u8"..." yields a char[] with UTF-8 encoded contents (C11). (C23 adds char8_t.)
Q83
Which of the following is a portable way to obtain the number of elements in a static array int a[10];?
A. sizeof(a)
B. sizeof(a)/sizeof(a[0])
C. 10 only
D. a.length
Answer: B
Solution: sizeof(a)/sizeof(a[0]) yields element count; sizeof(a) alone gives bytes.
Q84
Which of these integer types is optional (may not exist) in <stdint.h>?
A. int8_t — exact-width types are optional if implementation can’t provide them
B. int_least8_t — required
C. int_fast8_t — required
D. int — required
Answer: A
Solution: Exact-width types like int8_t are provided only if implementation supports exact width; least and fast types are required.
Q85
Which expression yields implementation-defined behavior?
A. Left shifting 1 << (sizeof(int)*8 - 1) on signed type
B. Left shifting 1U << (sizeof(unsigned)*8 - 1) on unsigned — well-defined
C. Right shifting negative signed integer — implementation-defined (arithmetic vs logical)
D. Both A and C
Answer: D
Solution: Left-shifting into sign bit (signed) is UB; right-shifting negative signed integer is implementation-defined.
Q86
Which of the following is a portable way to initialize a struct with zeroed memory?
A. struct S s = {0};
B. memset(&s, 0, sizeof s);
C. Both A and B (A uses initializer list, B uses runtime)
D. Neither
Answer: C
Solution: Both are valid ways to zero-initialize struct.
Q87
Which of the following is true about wchar_t?
A. It is defined in <wchar.h> and is for wide characters; size is implementation-defined
B. Always 2 bytes
C. Always signed char
D. Same as char always
Answer: A
Solution: wchar_t size varies by platform (e.g., 2 on Windows, 4 on Linux) and is in <wchar.h>.
Q88
Which of the following is allowed: using an identifier for as variable name?
A. Yes, because for is not a keyword
B. No, for is a keyword and reserved
C. Only with @for escape
D. Only in comments
Answer: B
Solution: for is a reserved keyword, cannot be used as identifier.
Q89
What is the type of the literal 0x1p+4?
A. Integer
B. Floating-point (hexadecimal floating literal)
C. String
D. Invalid
Answer: B
Solution: 0x1p+4 is hex-floating literal (C99) => 16.0 double.
Q90
Which of the following leads to implementation-defined result rather than undefined?
A. Shifting by negative amount — undefined
B. Right shift of negative signed — implementation-defined (arithmetic/logical)
C. Signed overflow — undefined
D. Division by zero — undefined
Answer: B
Solution: Right shift of negative signed is implementation-defined (not undefined).
Q91
Which of the following macro constants represents number of bits in char?
A. CHAR_BIT
B. CHAR_SIZE
C. BITS_PER_CHAR
D. CHAR_B
Answer: A
Solution: CHAR_BIT is defined in <limits.h>.
Q92
Which of the following is true about floating point NaN (not-a-number)?
A. NaN == NaN is true
B. NaN != NaN is true (IEEE-754 semantics; in C, comparison follows that)
C. isnan() undefined for NaN
D. NaN cannot be produced in C
Answer: B
Solution: Per IEEE, NaN compares unequal to itself; use isnan() to test.
Q93
Which of the following is true regarding char constant 'ab' (multi-character constant)?
A. It’s a multi-character constant of type int with implementation-defined value
B. It’s a two-character string literal
C. It’s invalid syntax
D. It evaluates to pointer to char
Answer: A
Solution: 'ab' is a multi-character character constant of type int and value implementation-defined.
Q94
Which of the following guarantees there is no padding between bit-field members of same type?
A. Standard guarantees no padding — true always
B. Standard allows implementation-defined padding; no guarantee
C. #pragma no_padding mandated by C standard
D. packed attribute portable
Answer: B
Solution: Padding between bit-fields is implementation-defined; no portable guarantee.
Q95
Which of the following is true about volatile sig_atomic_t?
A. It’s safe to access in signal handlers (atomic for signals)
B. It provides full thread-safety for concurrent access
C. It guarantees lock-free atomic operations across threads
D. It is not recommended for signals
Answer: A
Solution: sig_atomic_t is atomic wrt signal handlers; volatile prevents optimization; not for general threading.
Q96
Which of the following produces a pointer to function type?
A. int (*fp)(int)
B. int fp(int)
C. int *fp(int)
D. int fp(*int)
Answer: A
Solution: int (*fp)(int) declares a pointer to function that takes int and returns int.
Q97
Which of the following standard integer types is guaranteed to hold at least 32 bits?
A. int32_t — optional exact-width, int_least32_t is guaranteed
B. int
C. short
D. char
Answer: A (but careful)
Solution: int32_t exists only if implementation provides an exact 32-bit type; int_least32_t is guaranteed to exist. (Exam picks int32_t as representative of 32-bit types — if exact width not present, type absent.)
Q98
Which of the following is true for float arithmetic under IEEE-754?
A. Associativity holds exactly ((a + b) + c == a + (b + c))
B. Associativity may fail due to rounding
C. Division by zero never produces exception or special value
D. NaN behaves as numeric value in comparisons
Answer: B
Solution: Floating-point rounding can break associativity.
Q99
Which of these identifiers is reserved by implementation in any scope?
A. Any identifier containing two consecutive underscores __ anywhere
B. Identifiers starting with lowercase letter only
C. Identifiers with digits only
D. Identifiers with hyphen
Answer: A
Solution: Identifiers with double underscore are reserved for implementation.
Q100
Which of these is true about wide character constants like U'Ω' (C11)?
A. U'Ω' yields type char32_t (assuming C11 char32_t)
B. It’s always illegal
C. It’s identical to 'Ω' of type int
D. C doesn’t support Unicode in literals
Answer: A
Solution: U'c' yields char32_t (C11), u'c' yields char16_t, L'c' yields wchar_t.