Q1. In OOP, “inheritance” primarily promotes which key concept? A) Encapsulation B) Code reusability C) Data hiding D) Overloading Answer: B) Code reusability Q2. The class that is inherited from another class is called: A) Parent class B) Base class C) Derived class D) Subclass Answer: B) Base class Q3. The class that inherits another
1. In object-oriented programming, what does the term “instantiation” refer to? A) The process of defining a class B) The process of copying a function C) The process of creating an object from a class D) The process of compiling code Answer: C 2. What is created when a class is instantiated in Java? A)
1. In Object-Oriented Programming, an object is best described as: A) A function performing a specific task B) A self-contained unit consisting of data and methods C) A library containing multiple functions D) A syntax rule for defining a class Answer: B) 2. Which of the following represents the state of an object? A) Methods
1. Which of the following best defines a class in OOP? A) A collection of variables only B) A function that executes specific tasks C) A blueprint or template for creating objects D) A data type with no behavior Answer: C) A blueprint or template for creating objects 2. In OOP, what is an instance
1. Which library function is used to read a single character from stdin and returns it as an int? A) getc() B) getchar_unlocked() C) getchar() D) fgets() Answer: C 2. Which function from <stdio.h> writes formatted output to a string (not to stdout)? A) printf() B) puts() C) fprintf() D) sprintf() Answer: D 3. To
1. What does the declaration int *a[5]; define? A) An array of 5 pointers to int B) A pointer to an array of 5 int C) An array of 5 pointers to int (same as A) D) A pointer to pointer to int Answer: C) An array of 5 pointers to int (same as A)
Q1. Which memory allocation type occurs automatically when a function is called? A) Static memory allocation B) Automatic memory allocation C) Dynamic memory allocation D) Register memory allocation Answer: B) Automatic memory allocation Q2. Which of the following is responsible for allocating memory at compile time? A) Static memory allocation B) Dynamic memory allocation C)
1. In C, a constant that represents a single character is known as a A) String constant B) Character constant C) Integer constant D) Symbolic constant Answer: B 2. Which of the following is a valid integer constant in C? A) 07AB B) 0x C) 0x2A D) 2H Answer: C 3. The constant ‘A’ in
1. Which of the following best describes the purpose of typedef in C? A) To allocate memory dynamically B) To create an alias for an existing data type C) To define a constant variable D) To include a header file Answer: B 2. Which of the following is the correct syntax for creating a new
Q1) Which bitwise operator in C performs a bit-by-bit logical AND between two integers? A) Bitwise OR (|) B) Bitwise XOR (^) C) Bitwise NOT (~) D) Bitwise AND (&) Answer: D) Bitwise AND (&) Q2) What does the ~ operator do in C when applied to an unsigned integer? A) Shifts bits left by