0% found this document useful (0 votes)
10 views27 pages

MCQs PDF 100

The document contains a series of questions and answers related to operating systems, system development life cycle (SDLC), object-oriented programming using C++, control structures, arrays and strings, and functions in C++. It covers key concepts such as the purpose of operating systems, phases of SDLC, C++ syntax, and programming structures. Each question is followed by the correct answer, providing a comprehensive overview of fundamental computer science topics.

Uploaded by

rafaytanoli04
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
10 views27 pages

MCQs PDF 100

The document contains a series of questions and answers related to operating systems, system development life cycle (SDLC), object-oriented programming using C++, control structures, arrays and strings, and functions in C++. It covers key concepts such as the purpose of operating systems, phases of SDLC, C++ syntax, and programming structures. Each question is followed by the correct answer, providing a comprehensive overview of fundamental computer science topics.

Uploaded by

rafaytanoli04
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 27

1: OPERATING SYSTEM

1. Which of the following is the primary purpose of an Operating System?

A) To provide entertainment

B) To manage hardware and software resources

C) To create documents

D) To browse the internet

Answer: B) To manage hardware and software resources

2. Which of these is NOT a commonly used operating system?

A) Windows

B) Linux

C) Oracle

D) macOS

Answer: C) Oracle (Oracle is a database company, though they have Solaris OS)

3. An operating system that allows multiple users to access a computer system


concurrently is called:

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

Answer: C) Memory Management

6. A program in execution is called a:

A) Thread

B) Process

C) Task

D) Job

Answer: B) Process

7. Which of the following is NOT a state of a process?

A) New

B) Ready

C) Paused

D) Terminated

Answer: C) Paused (Common states are New, Ready, Running, Waiting/Blocked,


Terminated)

8. A lightweight process within a process is called a:

A) Parent Process

B) Child Process

C) Thread
D) Scheduler

Answer: C) Thread

9. The ability of an OS to execute more than one task simultaneously on a single


processor system (by rapidly switching between them) is known as:

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

11. Which operating system is commonly used for smartphones?

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

Answer: C) File Management

---

### UNIT 2: SYSTEM DEVELOPMENT LIFE CYCLE (SDLC)

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

14. SDLC stands for:

A) System Design Life Cycle

B) Software Development Life Cycle

C) System Development Life Cycle

D) Software Design Life Cycle

Answer: C) System Development Life Cycle

15. Which of the following is a primary objective of SDLC?

A) To deliver a high-quality system that meets customer expectations

B) To create a system with the maximum number of features

C) To develop a system in the shortest possible time, regardless of quality

D) To only use the latest technology


Answer: A) To deliver a high-quality system that meets customer expectations

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

17. Which is typically the first phase of SDLC?

A) Design

B) Testing

C) Planning/Feasibility Study

D) Implementation

Answer: C) Planning/Feasibility Study

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

Answer: C) System Analyst

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

---

### UNIT 3: OBJECT ORIENTED PROGRAMMING USING C++

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

Answer: B) Computer Program


23. Which of the following is a C++ header file used for input/output operations?

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

B) Reserved Words (Keywords)

C) Constants

D) Comments

Answer: B) Reserved Words (Keywords)

25. Every C++ statement typically ends with a:

A) Colon (:)

B) Comma (,)

C) Semicolon (;)

D) Full Stop (.)

Answer: C) Semicolon (;)

26. Which syntax is used for a single-line comment in C++?

A) `/* comment */`

B) `// comment`

C) ``

D) `# comment`
Answer: B) `// comment`

27. Which of the following is an invalid variable name in C++?

A) `myVar`

B) `_value`

C) `total_Sum`

D) `2ndName`

Answer: D) `2ndName` (Variable names cannot start with a digit)

28. The C++ data type used to store single characters is:

A) `int`

B) `float`

C) `char`

D) `bool`

Answer: C) `char`

29. The `const` qualifier is used to:

A) Declare a variable whose value can be changed

B) Declare a variable whose value cannot be changed after initialization

C) Declare a function

D) Perform type casting

Answer: B) Declare a variable whose value cannot be changed after initialization

30. Explicitly converting one data type to another is known as:

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`

32. Which function is used to read a string of text including spaces?

A) `cin` (with default behavior)

B) `getch()`

C) `gets()` (use with caution) or `getline(cin, str)`

D) `putch()`

Answer: C) `gets()` (use with caution) or `getline(cin, str)` (Note: `gets()` is unsafe;
`getline()` is preferred for C++ strings)

33. The escape sequence `\n` represents:

A) Tab

B) Newline

C) Backspace

D) Carriage Return

Answer: B) Newline

34. The `endl` manipulator in C++ is used to:

A) Insert a tab space

B) End the program

C) Insert a newline and flush the output buffer


D) Set the width of the output field

Answer: C) Insert a newline and flush the output buffer

35. An operator that works on a single operand is called a:

A) Binary Operator

B) Ternary Operator

C) Unary Operator

D) Relational Operator

Answer: C) Unary 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

---

### UNIT 4: CONTROL STRUCTURES

37. Which statement is used to make decisions in C++ based on a condition?

A) `for` statement

B) `while` statement

C) `if` statement

D) `switch` statement

Answer: C) `if` statement (and `switch`)


38. An `if` statement inside another `if` statement is called:

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`

40. The `exit()` function is used to:

A) Terminate the current loop

B) Terminate the entire program

C) Terminate the current function

D) Skip the current iteration of a loop

Answer: B) Terminate the entire program

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

Answer: C) `do-while` loop


42. The statement that skips the rest of the current iteration of a loop and proceeds to
the next iteration is:

A) `break`

B) `exit()`

C) `continue`

D) `goto`

Answer: C) `continue`

43. A loop inside another loop is known as a:

A) Complex loop

B) Nested loop

C) Double loop

D) Iterative loop

Answer: B) Nested 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

Answer: B) 5 times (for i = 0, 1, 2, 3, 4)

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

Answer: B) Zero times


46. The `if-else if-else` structure is used for:

A) Single condition checking

B) Two alternative choices

C) Multiple alternative choices based on different conditions

D) Looping

Answer: C) Multiple alternative choices based on different conditions

47. Which of these is NOT a type of loop in C++?

A) `for`

B) `while`

C) `repeat-until` (this is common in other languages like Pascal)

D) `do-while`

Answer: C) `repeat-until`

---

### UNIT 5: ARRAYS AND STRINGS

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

49. The individual elements in an array are accessed using their:


A) Value

B) Name

C) Index (or subscript)

D) Type

Answer: C) Index (or subscript)

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

52. The `sizeof()` operator, when applied to an array name, returns:

A) The number of elements in the array

B) The size of the first element in bytes

C) The total size of the array in bytes

D) The size of the array index

Answer: C) The total size of the array in bytes

53. A two-dimensional array can be thought of as a:


A) List of elements

B) Table with rows and columns

C) Single element

D) Pointer

Answer: B) Table with rows and columns

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]`

Answer: B) `arr[1][2]` (2nd row is index 1, 3rd column is index 2)

55. In C++, a C-style string is typically an array of:

A) `int`

B) `float`

C) `char` terminated by a null character (`\0`)

D) `string` objects

Answer: C) `char` terminated by a null character (`\0`)

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:

A) `string name = "Alice";`

B) `char name[] = "Alice";`

C) Both A and B (B is for C-style string)

D) Only with `cin`

Answer: A) `string name = "Alice";`

58. If `arr` is an array, `arr[0]` refers to:

A) The last element

B) The size of the array

C) The first element

D) The address of the array

Answer: C) The first element

---

### UNIT 6: FUNCTIONS

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

60. Which of the following is an advantage of using functions?

A) Reduces code reusability


B) Makes the program harder to understand

C) Promotes modularity and code reusability

D) Increases program size unnecessarily

Answer: C) Promotes modularity and code reusability

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

62. A variable declared inside a function is called a:

A) Global variable

B) Local variable

C) Static variable

D) External variable

Answer: B) Local variable

63. Parameters listed in the function definition are called:

A) Actual parameters

B) Formal parameters

C) Global parameters

D) Default parameters

Answer: B) Formal parameters

64. Values passed to a function when it is called are known as:


A) Formal parameters

B) Return values

C) Actual parameters

D) Local variables

Answer: C) Actual parameters

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

Answer: C) Inline 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

Answer: B) Function overloading


68. What is the scope of a global variable?

A) Only within the function it is declared

B) Throughout the entire program file where it is declared

C) Only within the `main()` function

D) Only within the class it is declared

Answer: B) Throughout the entire program file where it is declared

69. When arguments are passed to a function by value:

A) The original variable's value is changed if the parameter is modified in the function

B) A copy of the argument's value is passed to the function

C) The function receives the memory address of the argument

D) It is not possible to pass arguments by value

Answer: B) A copy of the argument's value is passed to the function

---

### UNIT 7: POINTERS

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

71. The unique address of a memory location is represented as a:

A) Hexadecimal number

B) Binary number
C) Decimal number

D) All of the above, depending on representation

Answer: D) All of the above, depending on representation (though often shown as


hex)

72. Which operator is used to get the memory address of a variable?

A) `*` (Dereference operator)

B) `&` (Reference/Address-of operator)

C) `->` (Arrow operator)

D) `.` (Dot operator)

Answer: B) `&` (Reference/Address-of operator)

73. Which operator is used to access the value stored at the memory address pointed to
by a pointer?

A) `*` (Dereference operator)

B) `&` (Reference/Address-of operator)

C) `&&` (Logical AND)

D) `||` (Logical OR)

Answer: A) `*` (Dereference operator)

74. How do you declare a pointer `p` that can point to an integer variable?

A) `int &p;`

B) `int *p;`

C) `pointer int p;`

D) `address int p;`

Answer: B) `int *p;`

75. Initializing a pointer with the address of a variable `var` is done as:

A) `int *ptr = var;`


B) `int *ptr = &var;`

C) `int *ptr = *var;`

D) `int ptr = &var;`

Answer: B) `int *ptr = &var;`

76. If `ptr` is a pointer to an integer variable `x`, what does `*ptr` represent?

A) The address of `x`

B) The value of `x`

C) The address of `ptr`

D) An error

Answer: B) The value of `x`

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`

Answer: B) `NULL` or `nullptr` (`nullptr` is preferred in modern C++)

78. If `int num = 10; int *p = &num;`, what is the value of `p`?

A) 10

B) The memory address of `num`

C) The memory address of `p`

D) An error

Answer: B) The memory address of `num`

---
### 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

80. An instance of a class is called an:

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

C) Encapsulation (Data Hiding is part of this)

D) Abstraction

Answer: C) Encapsulation (Data Hiding is part of this)

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

87. The ability of an object to take on many forms, or a message/function to be


processed in more than one way, is called:

A) Encapsulation

B) Polymorphism

C) Inheritance

D) Data Hiding

Answer: B) Polymorphism

88. By default, members of a class in C++ are:

A) `public`

B) `private`

C) `protected`

D) `global`

Answer: B) `private`

89. A constructor that takes no arguments is called a:

A) Parameterized constructor

B) Copy constructor

C) Default constructor

D) Friend constructor

Answer: C) Default constructor


90. Which access specifier allows members to be accessed by the class itself, derived
classes, and friend functions?

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

Answer: B) Data Hiding

---

### UNIT 9: FILE HANDLING

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

C) Check for the end-of-file condition

D) Move the file pointer to the beginning of the file

Answer: C) Check for the end-of-file condition

95. A sequence of bytes flowing from a source to a destination is called a:

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`

C) `fstream` (can be used for both, but `ifstream` is specific)

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

B) The program terminates

C) The file is created

D) The user is prompted to create it

Answer: C) The file is created (by default)

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();`

Answer: A) `file_stream.seekg(0, ios::beg);`

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`

You might also like