1. Which of the following best describes a union in C? A) A collection of named bit-fields only B) A type whose members share the same memory location C) A type that can hold multiple values simultaneously D) A function-like macro for grouping variables Answer: B 2. If a union has members of sizes 4,
1. Consider: struct S { int a; char b; double c; }; What is the most likely value of sizeof(struct S) under the stated assumptions? A) 13 B) 16 C) 24 D) 32 Answer: C 2. Which of the following is not a valid way to initialize a structure struct P { int x; int
Q1. Which of the following correctly declares a one-dimensional array of 50 integers in C? A) int a(50); B) int a[50]; C) int a = [50]; D) int a{50}; Answer: B Q2. Given int a[10];, what is the valid index range for accessing elements? A) 0 to 9 B) 1 to 10 C) -1 to
1. Which of the following correctly declares a function that takes an int and returns a pointer to char? A) char *f(int); B) char (*f)(int); C) char *f(int*); D) char f*(int); Answer: A 2. In C, a function prototype must appear before its use to: A) allocate memory for the function B) inform the compiler
1. Which statement best describes “sequence control” in C? A) Execution of statements in arbitrary order B) Execution of statements strictly from top to bottom unless altered by control constructs C) Execution only of function calls D) Execution only of conditional statements [Answer:] B 2. What will the following code print? int x = 5;
1. Which C data type is used to represent a single character? A) int B) char C) float D) short [Answer: B] 2. Which operator returns the size (in bytes) of a data type or variable? A) & B) * C) sizeof D) typeid [Answer: C] 3. Which of these is not a standard integer
1. Which of the following is a valid identifier in C? A) 2count B) _total C) int D) for-loop [Answer:] B 2. In C, identifiers are: A) Case-insensitive B) Case-sensitive C) Always uppercase D) Always lowercase [Answer:] B 3. Which of the following is not a valid identifier? A) sum_of_values B) value#1 C) value1 D)
1. Which of the following is not a token in C? A) identifier B) whitespace C) constant D) operator [Answer: B] 2. The C token type that represents reserved words like int, return, for is called: A) identifier B) keyword C) literal D) preprocessor [Answer: B] 3. Which of the following is a valid identifier
1. In programming languages, the type of a value primarily defines: A) the memory address where the value is stored B) the set of possible values and operations allowed on that value C) the color to display the value in an IDE D) the method names associated with the value [Answer: B] 2. The property
1. Which programming language property describes the rules for forming valid sentences (programs) in that language? A. Semantics B. Syntax C. Pragmatics D. Typing Answer: B 2. Which of the following is an example of a declarative programming paradigm? A. Object-oriented programming B. Procedural programming C. Functional programming D. Assembly programming Answer: C 3. Binding