MCQs PDF 100
MCQs PDF 100
A) To provide entertainment
C) To create documents
A) Windows
B) Linux
C) Oracle
D) macOS
Answer: C) Oracle (Oracle is a database company, though they have Solaris OS)
A) Single-user OS
B) Multi-user OS
C) Real-time OS
D) Batch OS
Answer: B) Multi-user OS
4. Which type of operating system processes jobs in groups without direct user
interaction?
A) Time-sharing OS
B) Batch OS
C) Distributed OS
D) Network OS
Answer: B) Batch OS
5. The function of an OS that involves managing the computer's memory is known as:
A) Process Management
B) File Management
C) Memory Management
D) Device Management
A) Thread
B) Process
C) Task
D) Job
Answer: B) Process
A) New
B) Ready
C) Paused
D) Terminated
A) Parent Process
B) Child Process
C) Thread
D) Scheduler
Answer: C) Thread
A) Multiprogramming
B) Multitasking
C) Multithreading
D) Multiprocessing
Answer: B) Multitasking
10. Keeping several programs in different parts of the main memory at the same time
and executing them concurrently is:
A) Multitasking
B) Multiprogramming
C) Multithreading
D) Multi-user
Answer: B) Multiprogramming
A) Windows XP
B) macOS
C) Android
D) MS-DOS
Answer: C) Android
12. Which OS function deals with creating, deleting, and organizing files and folders?
A) Memory Management
B) Process Management
C) File Management
D) Security Management
---
13. A collection of components that work together to achieve a common goal is called
a:
A) Program
B) System
C) Process
D) Task
Answer: B) System
16. Individuals or groups who have an interest in the success of a system are known as:
A) Programmers
B) Testers
C) Stakeholders
D) Managers only
Answer: C) Stakeholders
A) Design
B) Testing
C) Planning/Feasibility Study
D) Implementation
18. The phase where the actual coding of the software takes place is:
A) Analysis
B) Design
C) Development/Implementation
D) Testing
Answer: C) Development/Implementation
19. The professional responsible for understanding user needs and translating them
into system requirements is the:
A) Programmer
B) Project Manager
C) System Analyst
D) Database Administrator
20. Which SDLC phase involves checking the system for errors and ensuring it meets
requirements?
A) Deployment
B) Testing
C) Maintenance
D) Design
Answer: B) Testing
21. The final phase of SDLC, which involves ongoing support and improvements, is:
A) Deployment
B) Maintenance
C) Analysis
D) Planning
Answer: B) Maintenance
---
22. A set of instructions that a computer follows to perform a specific task is called a:
A) Hardware
B) Computer Program
C) CPU
D) Operating System
A) `<math.h>`
B) `<string.h>`
C) `<iostream>`
D) `<stdlib.h>`
Answer: C) `<iostream>`
24. Words that have predefined meanings in C++ and cannot be used as variable names
are called:
A) Identifiers
C) Constants
D) Comments
A) Colon (:)
B) Comma (,)
C) Semicolon (;)
B) `// comment`
C) ``
D) `# comment`
Answer: B) `// comment`
A) `myVar`
B) `_value`
C) `total_Sum`
D) `2ndName`
28. The C++ data type used to store single characters is:
A) `int`
B) `float`
C) `char`
D) `bool`
Answer: C) `char`
C) Declare a function
A) Automatic Casting
B) Type Casting
C) Constant Casting
D) Variable Casting
Answer: B) Type Casting
31. The standard C++ object used for output to the screen is:
A) `cin`
B) `cout`
C) `cerr`
D) `clog`
Answer: B) `cout`
B) `getch()`
D) `putch()`
Answer: C) `gets()` (use with caution) or `getline(cin, str)` (Note: `gets()` is unsafe;
`getline()` is preferred for C++ strings)
A) Tab
B) Newline
C) Backspace
D) Carriage Return
Answer: B) Newline
A) Binary Operator
B) Ternary Operator
C) Unary Operator
D) Relational Operator
36. The order in which operators are evaluated in an expression is determined by their:
A) Size
B) Type
C) Precedence
D) Value
Answer: C) Precedence
---
A) `for` statement
B) `while` statement
C) `if` statement
D) `switch` statement
A) Parallel if
B) Nested if
C) Sequential if
D) Looped if
Answer: B) Nested if
39. Which statement immediately terminates the loop or switch structure it is in?
A) `continue`
B) `exit()`
C) `break`
D) `return`
Answer: C) `break`
41. Which loop executes its body at least once, regardless of the condition?
A) `for` loop
B) `while` loop
C) `do-while` loop
D) Infinite loop
A) `break`
B) `exit()`
C) `continue`
D) `goto`
Answer: C) `continue`
A) Complex loop
B) Nested loop
C) Double loop
D) Iterative loop
44. In a `for` loop `for(int i=0; i<5; i++)`, how many times will the loop body execute?
A) 4 times
B) 5 times
C) 6 times
D) 0 times
45. If the condition in a `while` loop is initially false, the loop body will execute:
A) At least once
B) Zero times
C) Infinitely
D) Exactly once
D) Looping
A) `for`
B) `while`
D) `do-while`
Answer: C) `repeat-until`
---
48. A collection of elements of the same data type stored under a single name is called
an:
A) Object
B) Function
C) Array
D) Structure
Answer: C) Array
B) Name
D) Type
50. If an array is declared as `int arr[5];`, what is the valid range of indices?
A) 1 to 5
B) 0 to 5
C) 0 to 4
D) 1 to 4
Answer: C) 0 to 4
51. The process of visiting each element of an array exactly once is called:
A) Sorting
B) Searching
C) Traversing
D) Merging
Answer: C) Traversing
C) Single element
D) Pointer
54. How would you access the element in the 2nd row and 3rd column of a 2D array
`arr[R][C]` (assuming 0-based indexing)?
A) `arr[2][3]`
B) `arr[1][2]`
C) `arr[3][2]`
D) `arr[2][1]`
A) `int`
B) `float`
D) `string` objects
56. Which C++ string function is used to find the length of a C-style string?
A) `length()`
B) `size()`
C) `strlen()`
D) `strsize()`
Answer: C) `strlen()`
57. To initialize a C++ `std::string` object, you can use:
---
59. A named block of code that performs a specific task and can be called from other
parts of the program is a:
A) Variable
B) Loop
C) Function
D) Conditional statement
Answer: C) Function
61. The combination of a function's name, return type, and parameter list is known as
its:
A) Body
B) Scope
C) Signature
D) Definition
Answer: C) Signature
A) Global variable
B) Local variable
C) Static variable
D) External variable
A) Actual parameters
B) Formal parameters
C) Global parameters
D) Default parameters
B) Return values
C) Actual parameters
D) Local variables
65. A function that is expanded in line at the point of call, rather than being called
through the usual function call mechanism, is an:
A) Overloaded function
B) Recursive function
C) Inline function
D) Virtual function
66. If a function does not return any value, its return type should be:
A) `int`
B) `null`
C) `void`
D) `empty`
Answer: C) `void`
67. The ability to define multiple functions with the same name but different parameter
lists is called:
A) Function overriding
B) Function overloading
C) Function recursion
D) Function hiding
A) The original variable's value is changed if the parameter is modified in the function
---
70. A variable that stores the memory address of another variable is called a:
A) Reference
B) Pointer
C) Array
D) Structure
Answer: B) Pointer
A) Hexadecimal number
B) Binary number
C) Decimal number
73. Which operator is used to access the value stored at the memory address pointed to
by a pointer?
74. How do you declare a pointer `p` that can point to an integer variable?
A) `int &p;`
B) `int *p;`
75. Initializing a pointer with the address of a variable `var` is done as:
76. If `ptr` is a pointer to an integer variable `x`, what does `*ptr` represent?
D) An error
77. What is the typical value assigned to a pointer that is not pointing to any valid
memory location?
A) `0`
B) `NULL` or `nullptr`
C) `-1`
D) `1`
78. If `int num = 10; int *p = #`, what is the value of `p`?
A) 10
D) An error
---
### UNIT 8: OBJECTS AND CLASSES
79. A blueprint for creating objects, providing initial values for state (member variables)
and implementations of behavior (member functions), is a:
A) Function
B) Object
C) Class
D) Pointer
Answer: C) Class
A) Method
B) Attribute
C) Object
D) Constructor
Answer: C) Object
81. Data members and member functions of a class are collectively known as its:
A) Attributes
B) Methods
C) Members
D) Properties
Answer: C) Members
82. Which access specifier makes class members accessible only within the class itself
and by friend functions/classes?
A) `public`
B) `private`
C) `protected`
D) `global`
Answer: B) `private`
83. The mechanism of bundling data (attributes) and methods (functions) that operate
on the data into a single unit (class) is called:
A) Inheritance
B) Polymorphism
D) Abstraction
84. A special member function that is automatically called when an object of a class is
created is a:
A) Destructor
B) Constructor
C) Friend function
D) Static function
Answer: B) Constructor
85. A special member function that is automatically called when an object of a class
goes out of scope or is explicitly deleted is a:
A) Destructor
B) Constructor
C) Copy constructor
D) Finalizer
Answer: A) Destructor
86. The capability of a class to derive properties and characteristics from another class
is known as:
A) Encapsulation
B) Polymorphism
C) Inheritance
D) Abstraction
Answer: C) Inheritance
A) Encapsulation
B) Polymorphism
C) Inheritance
D) Data Hiding
Answer: B) Polymorphism
A) `public`
B) `private`
C) `protected`
D) `global`
Answer: B) `private`
A) Parameterized constructor
B) Copy constructor
C) Default constructor
D) Friend constructor
A) `public`
B) `private`
C) `protected`
D) `internal`
Answer: C) `protected`
91. Hiding the internal implementation details of an object from the outside world is
known as:
A) Inheritance
B) Data Hiding
C) Polymorphism
D) Overloading
---
92. Which of the following is NOT a common type of file in terms of data storage?
A) Text file
B) Binary file
C) Executable file
D) Virtual file
Answer: D) Virtual file (While virtual file systems exist, text and binary are primary
data storage types discussed)
93. To perform file operations in C++, which header file is typically included?
A) `<iostream>`
B) `<fstream>`
C) `<string>`
D) `<cstdio>`
Answer: B) `<fstream>`
94. The `eof()` member function of a file stream object is used to:
A) Open a file
B) Close a file
A) Buffer
B) Stream
C) File
D) Record
Answer: B) Stream
96. Which stream class is typically used for reading from files in C++?
A) `ofstream`
B) `ifstream`
D) `iostream`
Answer: B) `ifstream`
97. Which stream class is typically used for writing to files in C++?
A) `ofstream`
B) `ifstream`
C) `fstream`
D) `stringstream`
Answer: A) `ofstream`
98. When opening a file with `ofstream`, if the file does not exist, it is usually:
A) An error occurs
99. The function `bof()` (or similar logic to check for the beginning of a file) is less
common than `eof()`. To move to the beginning of a file stream `file_stream`, you
would typically use:
A) `file_stream.seekg(0, ios::beg);`
B) `file_stream.bof();`
C) `file_stream.reset();`
D) `file_stream.start();`
100. Which mode is used to open a file for output and append data to the end of it?
A) `ios::in`
B) `ios::out`
C) `ios::app`
D) `ios::trunc`
Answer: C) `ios::app`