Computer Science MCQ (26 Qu.) : Each question carries 1 mark. Click on the question and its options to take the test and check your result.
What is the addressing called that is used in an instruction of the form ADD X Y?
Indirect
Index
Absolute
None of the above
Absolute
In the instruction ADD X Y, X and Y are direct memory addresses, which is also called absolute addressing.
BPSC TRE 1.0 2023
Which clause creates a temporary relation for the query on which it is defined?
WITH
FROM
WHERE
None of the above
WITH
The WITH clause creates a temporary named result set, or common table expression, for a query.
BPSC TRE 1.0 2023
A matrix contains m rows and n columns. The matrix is called a Sparse Matrix if:
Total number of zero elements is greater than (m × n) / 2
Total number of zero elements is equal to m × n
Total number of zero elements is equal to m × n / 2
None of the above
Total number of zero elements is greater than (m × n) / 2
A sparse matrix has more zero elements than non-zero elements.
BPSC TRE 1.0 2023
Which command makes the updates performed by a transaction permanent in the database?
ROLLBACK
COMMIT
TRUNCATE
None of the above
COMMIT
COMMIT saves all changes made by the transaction permanently in the database.
BPSC TRE 1.0 2023
Which of the following is the basic approach for joining tables?
Union JOIN
Natural JOIN
Subqueries
None of the above
Natural JOIN
Natural JOIN combines two tables based on their common columns.
BPSC TRE 1.0 2023
What is the time complexity of an infix-to-postfix conversion algorithm?
O(N log N)
O(N)
O(N2)
None of the above
O(N)
Each symbol is processed once using a stack, so the time complexity is linear, O(N).
BPSC TRE 1.0 2023
Which of the following is an advantage of the array data structure?
Elements of mixed data types can be stored
It is easier to access the elements in an array
The index of the first element starts from 1
None of the above
It is easier to access the elements in an array
Array elements can be accessed directly using their index.
BPSC TRE 1.0 2023
Which data structure is mainly used for implementing a recursive algorithm?
Queue
Stack
Binary tree
None of the above
Stack
Recursion uses the call stack to store function calls and their return addresses.
BPSC TRE 1.0 2023
Which one of the following is not a type of queue?
Linear queue
Circular queue
Double-ended queue
None of the above
None of the above
Linear queue, circular queue, and double-ended queue are all types of queues.
BPSC TRE 1.0 2023
What is the necessary condition to be checked before deletion from a queue?
Overflow
Underflow
Rear value
None of the above
Underflow
Deletion from an empty queue causes underflow, so underflow must be checked first.
BPSC TRE 1.0 2023
After performing the following operations, what does the final list contain?
InsertFront(10); InsertFront(20); InsertRear(30); DeleteFront(); InsertRear(40); InsertRear(10); DeleteRear(); InsertRear(15); display();
InsertFront(10); InsertFront(20); InsertRear(30); DeleteFront(); InsertRear(40); InsertRear(10); DeleteRear(); InsertRear(15); display();
10 30 10 15
20 30 40 15
10 30 40 15
None of the above
10 30 40 15
The operations finally leave the deque as 10, 30, 40, 15.
BPSC TRE 1.0 2023
A linear data structure in which insertion and deletion operations can be performed from both ends is:
Queue
Circular queue
Deque
None of the above
Deque
A deque allows insertion and deletion at both the front and rear ends.
BPSC TRE 1.0 2023
If a circular queue is implemented using an array of size MAX_SIZE, where the array index starts with 0, front points to the first element, and rear points to the last element, which condition specifies that the circular queue is empty?
Front = rear = -1
Front = rear = 0
Front = rear + 1
None of the above
Front = rear = -1
Initially, both front and rear are set to -1 to indicate that the circular queue is empty.
BPSC TRE 1.0 2023
Which one of the following techniques is not used in a binary tree?
Randomized traversal
Preorder traversal
Postorder traversal
None of the above
Randomized traversal
Binary trees commonly use preorder, inorder, and postorder traversal; randomized traversal is not a standard tree traversal.
BPSC TRE 1.0 2023
Which of the following is not a feature of DBMS?
Minimum duplication and redundancy of data
High level of security
Single-user access only
None of the above
Single-user access only
A DBMS supports multiple users and controlled concurrent access to data.
BPSC TRE 1.0 2023
All members of a structure in C++ are _____ by default.
Public
Private
Protected
None of the above
Public
In C++, structure members are public by default.
BPSC TRE 2.0 2023
In C++, all members of a class are _____ by default.
Public
Private
Protected
None of the above
Private
In C++, class members are private by default.
BPSC TRE 2.0 2023
In C++, what does a class hold?
Array
Data
Data and functions
None of the above
Data and functions
A class binds data members and member functions together.
BPSC TRE 2.0 2023
The number of access specifiers in a class of C++ is:
2
3
4
None of the above
3
C++ has three access specifiers: private, protected, and public.
BPSC TRE 2.0 2023
Which of the following is used to define the members of a class externally in C++?
:
::
#
None of the above
::
The scope resolution operator :: is used to define class members outside the class.
BPSC TRE 2.0 2023
Which concept of C++ is used to reuse written code?
Polymorphism
Inheritance
Encapsulation
None of the above
Inheritance
Inheritance allows a new class to reuse the properties and functions of an existing class.
BPSC TRE 2.0 2023
What will be the output of the given program fragment?
30,10
30,20
20,30
None of the above
30,10
The inner block prints local i = 30, while ::i prints the global i = 10.
BPSC TRE 2.0 2023
Choose the correct statement about an inline function in C++.
It speeds up the execution
It slows down the execution
It decreases the code size
None of the above
It speeds up the execution
An inline function reduces function-call overhead, which can speed up execution.
BPSC TRE 2.0 2023
What will be the output of the following?
int a = 5; cout << “FIRST” << (a << 2) << “SECOND”;
int a = 5; cout << “FIRST” << (a << 2) << “SECOND”;
FIRST 52 SECOND
FIRST 20 SECOND
SECOND 25 FIRST
None of the above
FIRST 20 SECOND
The left-shift operator shifts 5 left by 2 bits: 5 << 2 = 20.
BPSC TRE 2.0 2023
In C++, cout stands for:
Class output
Character output
Common output
None of the above
Character output
cout means character output and is used with the insertion operator to display output.
BPSC TRE 2.0 2023
A group of instructions that directs a computer is called:
Memory
Storage
Program
None of the above
Program
A program is a group of instructions that directs a computer to perform a task.
BPSC TRE 2.0 2023
