MCQs For RGPV CSEIT
MCQs For RGPV CSEIT
Set1 – 10 questions
1. Programming in C
#include <stdio.h>
int main() {
int x = 5;
printf("%d %d %d", x++, x++, ++x);
return 0;
}
A) 5 6 7
B) 7 6 5
C) 5 5 7
D) Undefined behavior
Explanation: The order of evaluation of arguments in a printf statement is not specified in the C
standard. The increments (x++ and ++x) modify x multiple times within the same expression
without an intervening sequence point, leading to undefined behavior. Competitive exams often
test such edge cases.
2. Data Structures
Question: What is the time complexity of inserting an element at the end of a singly linked list,
given only a pointer to the head?
A) O(1)
B) O(n)
C) O(log n)
D) O(n²)
Answer: B) O(n)
Explanation: Without a tail pointer, inserting at the end requires traversing the list from the head
to the last node, which takes O(n) time, where n is the number of nodes. This is a fundamental
concept in RGPV’s Data Structures course and competitive exams like GATE.
3. Algorithms
Question: Which sorting algorithm has the best average-case time complexity among the
following?
A) Bubble Sort
B) Selection Sort
C) Quick Sort
D) Insertion Sort
Explanation: Quick Sort has an average-case time complexity of O(n log n), while Bubble Sort,
Selection Sort, and Insertion Sort have O(n²). This is a key topic in RGPV’s algorithm syllabus
and a frequent focus in competitive exams.
4. Operating Systems
Question: In a paging system, a logical address is 32 bits, and the page size is 4 KB. How many
bits are required for the page offset? A) 10
B) 12
C) 14
D) 20
Answer:
B) 12
Explanation: Page size = 4 KB = 2¹² bytes. The page offset, which identifies a byte within a
page, requires log₂(4 KB) = 12 bits. This concept from memory management is part of RGPV’s
OS syllabus and is crucial for exams like GATE.
Question: Which of the following SQL queries retrieves all unique values of a column Dept
from a table Employee? A) SELECT Dept FROM Employee;
B) SELECT DISTINCT Dept FROM Employee;
C) SELECT UNIQUE Dept FROM Employee;
D) SELECT ALL Dept FROM Employee;
Explanation: DISTINCT eliminates duplicate values, while SELECT Dept alone retrieves all
values, including duplicates. UNIQUE is not a valid SQL keyword in this context. This aligns
with RGPV’s DBMS syllabus and competitive exam patterns.
6. Computer Networks
Question: What is the maximum data rate of a noiseless channel with a bandwidth of 3 kHz and
2 signal levels?
A) 3 kbps
B) 6 kbps
C) 9 kbps
D) 12 kbps
Answer: B) 6 kbps
Explanation: For a noiseless channel, Nyquist’s theorem applies: Maximum data rate = 2 ×
Bandwidth × log₂(Number of levels). Here, 2 × 3 kHz × log₂(2) = 6 kbps. This is covered in
RGPV’s networking course and is a staple in competitive exams.
7. Discrete Structures
Question: How many edges are there in a complete graph with 5 vertices? A) 5
B) 10
C) 15
D) 20
Answer: B) 10
Explanation: In a complete graph with n vertices, the number of edges is n(n-1)/2. For n = 5, it’s
5 × 4 / 2 = 10. Discrete mathematics is a core RGPV subject and frequently tested in competitive
exams.
8. Object-Oriented Programming
Question: In C++, which keyword is used to prevent a class from being inherited?
A) static
B) virtual
C) final
D) sealed
Answer: C) final
Explanation: The final keyword in C++ (introduced in C++11) prevents a class from being
subclassed. This is part of RGPV’s OOP syllabus (e.g., with Java or C++) and relevant for
technical assessments.
9. Theory of Computation
Question: Which of the following languages can be recognized by a finite automaton? A) {aⁿbⁿ |
n ≥ 0}
B) {aⁿ | n is a prime number}
C) {aⁿbᵐ | n, m ≥ 0}
D) {ww | w is a string}
Answer: C) {aⁿbᵐ | n, m ≥ 0}
Explanation: A finite automaton recognizes regular languages. {aⁿbᵐ} is regular, while {aⁿbⁿ}
(context-free), {aⁿ | n is prime} (not regular), and {ww} (context-sensitive) are not. This is a key
topic in RGPV’s theoretical foundations.
Question: Which software development model is best suited for projects with well-defined
requirements that are unlikely to change?
A) Waterfall Model
B) Spiral Model
C) Agile Model
D) V-Model
Answer: A) Waterfall Model
Explanation: The Waterfall Model assumes stable requirements and follows a sequential phases
approach, making it ideal for such scenarios. This is taught in RGPV’s Software Engineering
course and tested in competitive exams.
Set 2
Programming in C (5 Questions)
1. What is the output of the following C code?
#include <stdio.h>
int main() {
printf("%d", a+++b);
return 0;
A) 30
B) 31
C) 21
D) Compilation error
Answer: A) 30
Explanation: a+++b is parsed as (a++) + b. a++ uses the current value of a (10), then
increments a to 11. So, 10 + 20 = 30.
int fun(int x) {
return x & (x - 1);
A) Checks if x is even
B) Sets the least significant bit to 0
C) Counts the number of 1s in x
D) Always returns 0
Answer: B) Sets the least significant bit to 0
Explanation: x & (x-1) resets the rightmost 1-bit to 0 in x’s binary form (e.g., 6 (110)
becomes 4 (100)).
A) 4 bytes
B) 8 bytes
C) Depends on the compiler
D) Size of int
Answer: B) 8 bytes
Explanation: On a 64-bit system, pointers are typically 8 bytes, regardless of the data
type they point to.
6. What is the time complexity of searching in a binary search tree (BST) with n nodes,
if it is balanced?
A) O(n)
B) O(log n)
C) O(n log n)
D) O(1)
Answer: B) O(log n)
Explanation: A balanced BST has a height of log n, making search time logarithmic.
A) Array
B) Linked List
C) Heap
D) Stack
Answer: C) Heap
Explanation: A binary heap (min or max) provides O(log n) insertion and deletion, ideal
for priority queues.
8. In a circular queue with size 5, if front = 4 and rear = 3, how many elements are
present?
A) 4
B) 5
C) 3
D) 2
Answer: A) 4
Explanation: In a circular queue, when rear < front, elements wrap around. Formula:
(rear - front + size) % size + 1 = (3 - 4 + 5) % 5 + 1 = 4.
A) 1
B) 2
C) 3
D) 4
Answer: B) 2
Explanation: Two stacks can simulate a queue: one for enqueue (push), one for dequeue
(pop after transferring).
10. Which traversal of a binary tree requires a stack explicitly when implemented
iteratively?
A) Inorder
B) Preorder
C) Postorder
D) All of the above
Answer: D) All of the above
Explanation: Iterative tree traversals (inorder, preorder, postorder) use a stack to track
nodes, unlike recursive versions.
Algorithms (5 Questions)
A) O(n)
B) O(n log n)
C) O(n²)
D) O(log n)
Answer: B) O(n log n)
Explanation: Merge Sort divides the array into halves (log n) and merges them (n),
consistently O(n log n).
12. Which algorithm is used for finding the shortest path in a weighted graph with
negative edges?
A) Dijkstra’s
B) Bellman-Ford
C) Floyd-Warshall
D) Prim’s
Answer: B) Bellman-Ford
Explanation: Bellman-Ford handles negative weights, unlike Dijkstra’s, which assumes
non-negative weights.
13. What is the space complexity of a recursive factorial function with n as input? A)
O(1)
B) O(n)
C) O(log n)
D) O(n²)
Answer: B) O(n)
Explanation: Recursion uses O(n) stack space due to n recursive calls.
A) Quick Sort
B) Heap Sort
C) Bubble Sort
D) Selection Sort
Answer: C) Bubble Sort
Explanation: Bubble Sort preserves the relative order of equal elements, making it
stable.
15. What is the time complexity of the best-case scenario for Binary Search?
A) O(1)
B) O(log n)
C) O(n)
D) O(n log n)
Answer: A) O(1)
Explanation: In the best case, the target is at the root of the search space, found in one
comparison.
A) Round Robin
B) Shortest Job First (SJF)
C) First Come First Serve (FCFS)
D) Multilevel Queue
Answer: B) Shortest Job First (SJF)
Explanation: In SJF, long jobs may wait indefinitely if short jobs keep arriving.
17. What is the size of a page table entry if the physical address is 32 bits and page size
is 4 KB?
A) 20 bits
B) 22 bits
C) 32 bits
D) 12 bits
Answer: A) 20 bits
Explanation: Page size = 4 KB = 2¹² bytes, so offset = 12 bits. Frame number = 32 - 12
= 20 bits.
A) Paging
B) Segmentation
C) Fixed Partitioning
D) Both B and C
Answer: B) Segmentation
Explanation: Segmentation allocates variable-sized blocks, leading to external
fragmentation; paging uses fixed-size pages.
20. What does the ‘fork()’ system call return to the parent process?
A) 0
B) Child’s PID
C) -1
D) Parent’s PID
Answer: B) Child’s PID
Explanation: fork() returns the child’s process ID to the parent and 0 to the child.
Database Management Systems (5 Questions)
A) 1NF
B) 2NF
C) 3NF
D) BCNF
Answer: C) 3NF
Explanation: 3NF eliminates transitive dependencies (non-key attributes depending on
other non-key attributes).
23. Which join returns all rows from the left table and matching rows from the right
table?
A) INNER JOIN
B) LEFT JOIN
C) RIGHT JOIN
D) FULL JOIN
Answer: B) LEFT JOIN
Explanation: LEFT JOIN includes all rows from the left table, with NULLs for non-
matching right table rows.
A) SELECT
B) INSERT
C) CREATE
D) UPDATE
Answer: C) CREATE
Explanation: Data Definition Language (DDL) commands like CREATE define
database structures.
A) 20 bytes
B) 24 bytes
C) 32 bytes
D) 16 bytes
Answer: A) 20 bytes
Explanation: IPv4 header is 20 bytes (5 words of 32 bits each) without options.
27. Which layer of the OSI model handles error detection and correction?
A) Physical
B) Data Link
C) Network
D) Transport
Answer: B) Data Link
Explanation: The Data Link layer uses CRC or parity for error detection/correction.
28. What is the default subnet mask for a Class C IP address?
A) 255.0.0.0
B) 255.255.0.0
C) 255.255.255.0
D) 255.255.255.255
Answer: C) 255.255.255.0
Explanation: Class C uses 24 bits for the network portion, leaving 8 bits for hosts.
A) TCP
B) UDP
C) FTP
D) HTTP
Answer: B) UDP
Explanation: UDP (User Datagram Protocol) does not establish a connection, unlike
TCP.
30. What is the maximum window size in TCP with a 16-bit window field?
A) 32 KB
B) 64 KB
C) 128 KB
D) 16 KB
Answer: B) 64 KB
Explanation: 2¹⁶ = 65,536 bytes = 64 KB.
A) 8
B) 16
C) 32
D) 64
Answer: B) 16
Explanation: Number of subsets = 2ⁿ, where n = 4; 2⁴ = 16.
A) (P ∧ Q) → P
B) P ∧ ¬P
C) P ∨ ¬P
Answer: C) P ∨ ¬P
D) Both A and C
A) 512
B) 256
C) 64
D) 128
Answer: A) 512
Explanation: Number of relations = 2^(n²), where n = 3; 2⁹ = 512.
A) 3
B) 4
C) 5
D) 6
Answer: C) 5
Explanation: In K₅, every vertex is adjacent to all others; thus, 5 colors are needed.
A) 60
B) 120
C) 100
D) 150
Answer: B) 120
Explanation: 5! = 5 × 4 × 3 × 2 × 1 = 120.
36. Which language is accepted by a pushdown automaton but not a finite automaton?
A) {aⁿ | n ≥ 0}
B) {aⁿbⁿ | n ≥ 0}
C) {aⁿbᵐ | n, m ≥ 0}
D) {aⁿ | n is even}
Answer: B) {aⁿbⁿ | n ≥ 0}
Explanation: {aⁿbⁿ} is context-free (needs a stack), not regular.
37. What is the minimum number of states in a DFA accepting strings ending with
‘ab’?
A) 2
B) 3
C) 4
D) 5
Answer: C) 4
Explanation: States: initial, seen ‘a’, seen ‘ab’ (accept), and trap state.
A) Finite Automaton
B) Pushdown Automaton
C) Turing Machine
D) Linear Bounded Automaton
Answer: C) Turing Machine
Explanation: Turing Machines accept recursively enumerable languages.
A) Design
B) Analysis
C) Coding
D) Testing
Answer: B) Analysis
Explanation: The analysis phase defines what the system should do.
A) Integration Testing
B) Unit Testing
C) System Testing
D) Acceptance Testing
Answer: B) Unit Testing
Explanation: Unit testing focuses on individual components.
A) Store data
B) Perform arithmetic and logic operations
C) Fetch instructions
D) Manage memory
Answer: B) Perform arithmetic and logic operations
Explanation: ALU (Arithmetic Logic Unit) handles computations.
47. How many address lines are needed for a memory of 16 KB?
A) 12
B) 14
C) 16
D) 18
Answer: B) 14
Explanation: 16 KB = 2¹⁴ bytes, requiring 14 address lines.
48. Which register holds the address of the next instruction to be executed?
A) MAR
B) MDR
C) PC
D) IR
Answer: C) PC
Explanation: Program Counter (PC) points to the next instruction.
A) ADD R1, R2
B) MOV R1, #5
C) LOAD R1, [R2]
D) JMP R3
Answer: B) MOV R1, #5
Explanation: Immediate addressing embeds the operand (e.g., #5) in the instruction.
Notes
These 50 MCQs cover the breadth of RGPV’s CSE/IT syllabus, focusing on semesters 1–
6, and are aligned with competitive exam standards (e.g., GATE, technical interviews).
Programming in C
Data Structures
6. Which data structure follows the Last In, First Out (LIFO) principle?
a) Queue
b) Stack
c) Heap
d) Tree
Answer: b) Stack
Explanation: A stack operates on the LIFO principle.
7. What is the time complexity of inserting an element at the end of a singly linked list
(with tail pointer)?
a) O(1)
b) O(n)
c) O(log n)
d) O(n²)
Answer: a) O(1)
Explanation: With a tail pointer, insertion at the end is constant time.
10. What is the time complexity of searching in a binary search tree (BST) in the
average case?
a) O(1)
b) O(n)
c) O(log n)
d) O(n log n)
Answer: c) O(log n)
Explanation: A balanced BST has a logarithmic search time.
Algorithms
11. Which sorting algorithm has the best average-case time complexity of O(n log n)?
a) Bubble Sort
b) Selection Sort
c) Merge Sort
d) Insertion Sort
Answer: c) Merge Sort
Explanation: Merge Sort has an average-case complexity of O(n log n).
13. Which algorithm is used to find the shortest path in a weighted graph?
a) BFS
b) DFS
c) Dijkstra’s
d) Kruskal’s
Answer: c) Dijkstra’s
Explanation: Dijkstra’s algorithm finds the shortest path in a weighted graph.
Operating Systems
18. Which scheduling algorithm provides equal time slices to each process?
a) FCFS
b) SJF
c) Round Robin
d) Priority Scheduling
Answer: c) Round Robin
Explanation: Round Robin allocates equal time quanta to processes.
Computer Networks
Object-Oriented Programming
31. Which OOP concept allows a class to inherit properties from another class?
a) Encapsulation
b) Inheritance
c) Polymorphism
d) Abstraction
Answer: b) Inheritance
Explanation: Inheritance enables code reuse through class hierarchies.
32. What keyword is used to define a method that can be overridden in Java?
a) final
b) static
c) virtual
d) None required
Answer: d) None required
Explanation: In Java, methods are virtual by default and can be overridden.
33. Which access modifier makes a member accessible only within the same class?
a) public
b) protected
c) private
d) default
Answer: c) private
Explanation: private restricts access to the class itself.
Software Engineering
41. What is the cardinality of the power set of a set with 3 elements?
a) 3
b) 6
c) 8
d) 4
Answer: c) 8
Explanation: Power set cardinality is 2^n, so 2^3 = 8.
42. Which HTML tag defines a hyperlink?
a) <link>
b) <a>
c) <href>
d) <url>
Answer: b) <a>
Explanation: <a> is used for hyperlinks with the href attribute.