Tamil Nadu HSE Second Year Computer Science study materials
Tamil Nadu HSE Second Year Computer Science study resources

Tamil Nadu HSE Second Year Computer Science practice questions

One question at a time. Build your Tamil Nadu HSE Second Year Computer Science understanding.

First 50 of 200 questions. Each one lists the choices, the correct answer, and an explanation. The checker at the top of this page saves progress in this browser when it is available.

Continue in the practice tool above to load more questions, 50 at a time.

Question 1Fundamentals of Computers and Number Systems

In the Tamil Nadu Higher Secondary Computer Science syllabus, the physical components of a computer such as the processor, memory chips and hard disk are together known by which term?

  1. Hardware Correct answer.
  2. Firmware
  3. Software
  4. Malware

Explanation

Hardware refers to the tangible, physical parts of a computer system that can be seen and touched, including the CPU, RAM modules, motherboard and storage drives. Software, by contrast, is the set of instructions that directs this physical equipment.

Question 2Fundamentals of Computers and Number Systems

Which unit of the CPU performs arithmetic operations such as addition and subtraction and also carries out logical comparisons?

  1. Memory Unit
  2. Arithmetic Logic Unit Correct answer.
  3. Control Unit
  4. Input Unit

Explanation

The Arithmetic Logic Unit (ALU) is the part of the processor where arithmetic operations like addition and logical operations like comparison are actually executed. The control unit only directs and coordinates; it does not perform the calculation itself.

Question 3Fundamentals of Computers and Number Systems

A computer is described as a 'stored program' machine. Which feature of the von Neumann design does this phrase directly describe?

  1. Input devices convert analog signals into digital form before processing
  2. The processor contains separate caches for data and for instructions
  3. Data and instructions share a single memory and are fetched in the same way Correct answer.
  4. Output is produced only after the entire program has finished running

Explanation

In the stored program concept, both the program instructions and the data are kept in the same main memory, and the CPU fetches each instruction from memory exactly as it fetches data. This is the defining feature of the von Neumann architecture.

Question 4Fundamentals of Computers and Number Systems

Which generation of computers is characterised by the use of integrated circuits, in which many transistors are fabricated on a single silicon chip?

  1. First generation
  2. Third generation Correct answer.
  3. Second generation
  4. Fourth generation

Explanation

The third generation introduced integrated circuits, replacing individual transistors with multiple components built on one chip. This made computers smaller, faster and more reliable than the earlier transistor-based second generation.

Question 5Fundamentals of Computers and Number Systems

Which of the following is an example of system software rather than application software?

  1. A photo editing package
  2. A spreadsheet program used for payroll
  3. An operating system such as Linux Correct answer.
  4. A web browser installed by the user

Explanation

System software manages the hardware and provides a platform on which other programs run; an operating system is the classic example. Application software is written to let the user perform a specific task.

Question 6Fundamentals of Computers and Number Systems

What is the decimal value of the binary number 1101?

  1. 13 Correct answer.
  2. 11
  3. 14
  4. 12

Explanation

Each binary digit is multiplied by its place value: 1×8 + 1×4 + 0×2 + 1×1 = 13. The zero in the twos place contributes nothing, so the total is thirteen.

Question 7Fundamentals of Computers and Number Systems

The decimal number 45 is written in binary as which of the following?

  1. 110101
  2. 101101 Correct answer.
  3. 101011
  4. 100101

Explanation

Repeated division by two gives remainders 1, 0, 1, 1, 0, 1 read upwards, giving 101101. Checking the place values: 32 + 8 + 4 + 1 = 45, which confirms the result.

Question 8Fundamentals of Computers and Number Systems

What is the hexadecimal equivalent of the binary number 10101111?

  1. BF
  2. AF Correct answer.
  3. 9F
  4. A9

Explanation

Group the bits in fours from the right: 1010 and 1111. The group 1010 is A and 1111 is F, so the hexadecimal value is AF.

Question 9Fundamentals of Computers and Number Systems

Which of the following is the octal representation of the decimal number 100?

  1. 144 Correct answer.
  2. 124
  3. 64
  4. 104

Explanation

Dividing 100 by 8 gives quotient 12 and remainder 4; dividing 12 by 8 gives quotient 1 and remainder 4; the final quotient is 1. Reading remainders upward gives 144.

Question 10Fundamentals of Computers and Number Systems

How many distinct values can be represented with a 6-bit binary number?

  1. 32
  2. 64 Correct answer.
  3. 63
  4. 12

Explanation

With n bits the number of distinct patterns is 2 raised to n, so 2^6 = 64 values, ranging from 0 to 63 when unsigned. The largest value is 63, but the count of patterns is 64.

Question 11Fundamentals of Computers and Number Systems

Which binary operation is used to clear selected bits of a register to zero while leaving the other bits unchanged?

  1. OR with a mask of zeros in those positions
  2. NOT applied to the whole register
  3. AND with a mask of zeros in those positions Correct answer.
  4. XOR with an all-ones pattern

Explanation

ANDing any bit with 0 always yields 0, and ANDing with 1 leaves the bit unchanged, so a mask with zeros in the target positions clears exactly those bits. This is the standard masking technique.

Question 12Fundamentals of Computers and Number Systems

What is the 2's complement representation of the decimal number −5 in an 8-bit register?

  1. 11111010
  2. 11111011 Correct answer.
  3. 10000101
  4. 00000101

Explanation

Write +5 as 00000101, invert the bits to get 11111010, then add 1 to obtain 11111011. The leading 1 marks the number as negative, and its magnitude is five.

Question 13Fundamentals of Computers and Number Systems

A computer uses 1's complement arithmetic. What is the result of adding 0101 and 1010?

  1. 0000
  2. 0101
  3. 1111 with a carry that must be added back
  4. 1111 Correct answer.

Explanation

Adding bit by bit gives 1111 with no carry out of the sign position, so the sum is the 1's complement pattern 1111. In 1's complement this pattern represents negative zero, and no end-around carry arises here.

Question 14Fundamentals of Computers and Number Systems

In the BCD representation, how is the decimal number 27 stored?

  1. 00011011
  2. 01000111
  3. 00100111 Correct answer.
  4. 00100110

Explanation

In packed BCD each decimal digit is coded separately in four bits, so 2 becomes 0010 and 7 becomes 0111, giving 00100111. This differs from the pure binary form of 27.

Question 15Fundamentals of Computers and Number Systems

Which code is a weighted, self-complementing decimal code in which the weights of the four bits are 2, 4, 2 and 1?

  1. Excess-3 code
  2. ASCII
  3. Gray code
  4. 2421 code Correct answer.

Explanation

The 2421 code assigns the weights 2, 4, 2 and 1 to its four bit positions and is self-complementing, so the 9's complement of a digit is obtained by inverting its bits. Excess-3 is self-complementing but is not a weighted code of this kind.

Question 16Fundamentals of Computers and Number Systems

What is the Gray code equivalent of the binary number 1011?

  1. 1101
  2. 0110
  3. 1110 Correct answer.
  4. 1010

Explanation

The most significant Gray bit equals the most significant binary bit, and each further Gray bit is the XOR of adjacent binary bits. Thus 1, then 1⊕0=1, 0⊕1=1, 1⊕1=0, giving 1110.

Question 17Fundamentals of Computers and Number Systems

How many bits are required to encode the 26 uppercase letters of the English alphabet in a fixed-length binary code?

  1. 8 bits
  2. 6 bits
  3. 4 bits
  4. 5 bits Correct answer.

Explanation

Four bits give only 16 patterns, which is insufficient for 26 letters, whereas five bits give 32 patterns, enough to assign a unique code to each letter. Six bits would also work but uses more bits than necessary.

Question 18Fundamentals of Computers and Number Systems

The ASCII code of the character 'A' is 65. What is the ASCII code of the character 'E'?

  1. 68
  2. 69 Correct answer.
  3. 70
  4. 67

Explanation

Uppercase letters occupy consecutive ASCII positions, so each step forward in the alphabet adds one to the code. Counting A=65, B=66, C=67, D=68 and E=69 gives the answer.

Question 19Fundamentals of Computers and Number Systems

Which of the following best describes the function of the control unit during the fetch-decode-execute cycle?

  1. It generates timing and control signals that direct the other units Correct answer.
  2. It converts user input into binary form
  3. It performs the arithmetic and logical operations requested by instructions
  4. It stores the program permanently on the hard disk

Explanation

The control unit fetches each instruction, decodes it and then issues the control signals that tell the ALU, registers and memory exactly what to do at each step. It coordinates the machine without performing the computation itself.

Question 20Fundamentals of Computers and Number Systems

Which memory is volatile, meaning its contents are lost when power is switched off?

  1. RAM Correct answer.
  2. Flash drive
  3. ROM
  4. Hard disk

Explanation

RAM is read-write main memory that holds programs and data while the computer is running, and it loses its contents when power is removed. ROM and secondary storage devices retain their contents without power.

Question 21Fundamentals of Computers and Number Systems

What is the main advantage of cache memory in a computer system?

  1. It replaces the need for main memory entirely
  2. It stores the operating system permanently
  3. It provides large permanent storage at low cost
  4. It reduces the average time the CPU waits for data from main memory Correct answer.

Explanation

Cache is small, very fast memory placed close to the CPU that holds recently used instructions and data. Because the CPU can read it far faster than main memory, the average access time and waiting are reduced.

Question 22Fundamentals of Computers and Number Systems

Which of the following correctly lists the units of memory in increasing order of size?

  1. Megabyte, Kilobyte, Gigabyte, Terabyte
  2. Kilobyte, Megabyte, Gigabyte, Terabyte Correct answer.
  3. Kilobyte, Gigabyte, Megabyte, Terabyte
  4. Terabyte, Gigabyte, Megabyte, Kilobyte

Explanation

Memory and storage units scale upward by powers of 1024 in the conventional scheme: a kilobyte is smaller than a megabyte, which is smaller than a gigabyte, which is smaller than a terabyte. The given order follows this increasing sequence.

Question 23Fundamentals of Computers and Number Systems

A student writes the decimal fraction 0.5 as a binary fraction. Which representation is correct?

  1. 0.11
  2. 0.1 Correct answer.
  3. 0.001
  4. 0.01

Explanation

The first fractional binary place has weight 1/2, so a single 1 there represents exactly 0.5. Multiplying the fraction by 2 repeatedly gives the digit 1 followed by zeros.

Question 24Fundamentals of Computers and Number Systems

Which statement correctly distinguishes a compiler from an interpreter?

  1. A compiler is system software, while an interpreter is application software
  2. A compiler translates the whole program at once, while an interpreter translates and executes it line by line Correct answer.
  3. A compiler runs the source code directly, while an interpreter produces an object file
  4. A compiler works only with assembly language, while an interpreter works only with machine code

Explanation

A compiler scans the entire source program and produces an object or executable file before execution, whereas an interpreter translates and executes one statement at a time. This difference affects error reporting and execution speed.

Question 25Data Structures: Lists, Stacks and Queues

In a singly linked list, which field of a node stores the address of the following node?

  1. The link (next) field Correct answer.
  2. The head pointer of the list
  3. The data field
  4. The index field

Explanation

A node in a singly linked list has two parts: a data part holding the value and a link part holding the address of the next node. The head pointer belongs to the list as a whole, not to a node, and nodes have no index field because access is sequential.

Question 26Data Structures: Lists, Stacks and Queues

A stack is described as a LIFO structure. Which operation removes the most recently inserted element?

  1. push
  2. enqueue
  3. peek
  4. pop Correct answer.

Explanation

In a LIFO (Last In First Out) stack, insertion is done by push and removal by pop, so pop always removes the element that was pushed most recently. Peek only reads the top element without removing it.

Question 27Data Structures: Lists, Stacks and Queues

In a queue, at which end is a new element inserted and from which end is an element deleted?

  1. Inserted and deleted at the rear
  2. Inserted and deleted at the front
  3. Inserted at the rear, deleted at the front Correct answer.
  4. Inserted at the front, deleted at the rear

Explanation

A queue is FIFO (First In First Out): the enqueue operation adds at the rear and the dequeue operation removes from the front. This keeps the element that arrived earliest at the head of the line.

Question 28Data Structures: Lists, Stacks and Queues

In Python, which list method appends an element at the end of an existing list?

  1. insert()
  2. add()
  3. extend()
  4. append() Correct answer.

Explanation

The append() method adds a single object to the end of a Python list. insert() needs a position argument, extend() adds all items of an iterable, and add() is a set method, not a list method.

Question 29Data Structures: Lists, Stacks and Queues

What does the Python expression len([10, 20, 30, 40]) return?

  1. 5
  2. 4 Correct answer.
  3. 3
  4. 10

Explanation

The len() function returns the number of elements in the list. The list contains four elements, 10, 20, 30 and 40, so the result is 4.

Question 30Data Structures: Lists, Stacks and Queues

Which condition correctly identifies an empty stack stored in a list named s?

  1. len(s) == 0 Correct answer.
  2. len(s) == 1
  3. s[0] == 0
  4. s == None

Explanation

A stack implemented with a list is empty when the list holds no elements, which is tested by len(s) == 0 or simply not s. Reading s[0] on an empty list would raise an IndexError.

Question 31Data Structures: Lists, Stacks and Queues

In a circular queue of capacity n with front and rear indices, what is the main advantage over a simple linear array queue?

  1. It reuses freed front positions instead of wasting them Correct answer.
  2. It stores elements in sorted order automatically
  3. It removes the need for a front index
  4. It allows deletion from both ends

Explanation

In a linear array queue, positions freed by dequeue at the front cannot be reused, so the queue drifts towards the end of the array. A circular queue wraps rear and front around using modulo arithmetic, reusing those freed slots.

Question 32Data Structures: Lists, Stacks and Queues

Which of the following is a real-life situation that behaves like a queue?

  1. A pile of plates where the top plate is taken first
  2. Undo operation in a text editor
  3. Students standing in a line at a ticket counter Correct answer.
  4. Nested brackets checked by a compiler

Explanation

A queue serves whoever arrived first, exactly like a line of students at a counter where the first person is served first. Plates on a pile, bracket matching and undo all remove the most recent item, which is stack behaviour.

Question 33Data Structures: Lists, Stacks and Queues

A list L contains [5, 8, 12, 20]. What is the value of L[1] + L[-1]?

  1. 25
  2. 13
  3. 17
  4. 28 Correct answer.

Explanation

In Python, L[1] is the second element, 8, and L[-1] is the last element, 20. Adding them gives 28, since negative indices count from the end of the list.

Question 34Data Structures: Lists, Stacks and Queues

What is printed by the following code? s = [] s.append(1) s.append(2) s.append(3) s.pop() print(s)

  1. [3]
  2. [2, 3]
  3. [1, 2, 3]
  4. [1, 2] Correct answer.

Explanation

Three values are pushed in the order 1, 2, 3, and pop() removes the top element, which is 3. The remaining list is [1, 2], showing the LIFO behaviour of the stack.

Question 35Data Structures: Lists, Stacks and Queues

Consider a queue implemented with a Python list where enqueue uses append() and dequeue uses pop(0). Why can this be inefficient for a long queue?

  1. pop(0) must shift all remaining elements one position left Correct answer.
  2. append() takes time proportional to the queue length
  3. Python lists cannot store more than 100 elements
  4. The rear index overflows after each enqueue

Explanation

Removing the element at index 0 forces Python to shift every remaining element one place to the left, which costs time proportional to the number of elements. Using collections.deque, which supports fast removal from both ends, avoids this cost.

Question 36Data Structures: Lists, Stacks and Queues

A stack contains the elements 4 (bottom), 7, 9 and 2 (top). What is the state of the stack after push(6) followed by two pop() operations?

  1. [4, 7] Correct answer.
  2. [4, 7, 9]
  3. [4, 7, 6]
  4. [4, 7, 9, 6]

Explanation

push(6) makes 6 the top, giving 4, 7, 9, 2, 6. The first pop removes 6 and the second removes 2, leaving 4, 7 with 7 on top.

Question 37Data Structures: Lists, Stacks and Queues

In a linked list, which operation requires modification of the head pointer when the list is non-empty?

  1. Reading the data of the last node
  2. Traversing the list to print elements
  3. Inserting a new node at the front Correct answer.
  4. Searching for a value in the middle

Explanation

Inserting at the front makes the new node the first node, so the head pointer must be updated to its address. Traversal, reading the last node and searching only follow existing links and change no pointer.

Question 38Data Structures: Lists, Stacks and Queues

Which Python statement correctly removes and returns the last element of a list named stack?

  1. stack.pop() Correct answer.
  2. del stack
  3. stack.delete()
  4. stack.remove()

Explanation

pop() with no argument removes the last element of the list and returns it, which matches stack removal. remove() needs a value argument and deletes by value, while del stack deletes the whole list object.

Question 39Data Structures: Lists, Stacks and Queues

A circular queue has capacity 5 and currently front = 2 and rear = 4 with three elements stored. After one enqueue, what are the new rear value and element count?

  1. rear = 0, count = 3
  2. rear = 0, count = 4 Correct answer.
  3. rear = 5, count = 4
  4. rear = 5, count = 3

Explanation

The next rear position is computed as (rear + 1) % capacity, so (4 + 1) % 5 gives 0, wrapping around to the start of the array. The enqueue adds one element, so the count rises from three to four.

Question 40Data Structures: Lists, Stacks and Queues

Which application is best served by a stack rather than a queue?

  1. Reversing the characters of a string Correct answer.
  2. Handling CPU processes in arrival order
  3. Serving customers on a first-come basis
  4. Printing documents in the order they were submitted

Explanation

Reversing a string means pushing each character and then popping them, so the last character pushed comes out first, which is exactly stack behaviour. The other three situations all require first-in-first-out order and therefore use a queue.

Question 41Data Structures: Lists, Stacks and Queues

In a singly linked list, what does the link field of the last node contain?

  1. A null reference marking the end Correct answer.
  2. The address of the head node
  3. The address of the previous node
  4. The total number of nodes

Explanation

The last node has no successor, so its link field holds a null reference (None in Python) to signal the end of the list. This null link is what stops a traversal loop.

Question 42Data Structures: Lists, Stacks and Queues

What does the following Python code print? q = ["a", "b", "c"] q.append("d") print(q.pop(0), q)

  1. a ['b', 'c', 'd'] Correct answer.
  2. d ['b', 'c']
  3. a ['b', 'c']
  4. d ['a', 'b', 'c']

Explanation

append("d") adds d at the rear, giving ['a', 'b', 'c', 'd']. Then pop(0) removes the front element 'a' and returns it, so the printed value is a and the remaining list is ['b', 'c', 'd'].

Question 43Data Structures: Lists, Stacks and Queues

A list marks = [45, 78, 90, 33] is given. Which statement replaces the value 78 with 80?

  1. marks[1] = 80 Correct answer.
  2. marks.insert(80)
  3. marks.remove(78) = 80
  4. marks.append(80)

Explanation

The value 78 is at index 1, and assignment to an existing index replaces the element stored there. append and insert add new elements instead of replacing, and remove cannot appear on the left of an assignment.

Question 44Data Structures: Lists, Stacks and Queues

Which statement about the time needed to access the k-th element in an array-based list versus a singly linked list is correct?

  1. The array gives direct access in constant time, while the linked list needs k steps Correct answer.
  2. The linked list is faster because nodes are linked
  3. Both need the same constant time
  4. Both need time proportional to k

Explanation

An array stores elements in consecutive memory, so the address of the k-th element is computed directly in constant time. A singly linked list has no such formula, so it must follow k links from the head, which takes time proportional to k.

Question 45Data Structures: Lists, Stacks and Queues

A queue is implemented with a list and the operations are enqueue(1), enqueue(2), dequeue(), enqueue(3), dequeue(). What remains in the queue?

  1. [2, 3]
  2. [3] Correct answer.
  3. [1, 3]
  4. [1, 2]

Explanation

After enqueue(1) and enqueue(2) the queue is [1, 2]; the first dequeue removes 1, leaving [2]. enqueue(3) gives [2, 3] and the second dequeue removes 2, so only [3] remains.

Question 46Data Structures: Lists, Stacks and Queues

Which expression correctly tests whether a circular queue with capacity n is full, given front and rear indices and a count variable?

  1. count == n Correct answer.
  2. front == rear
  3. rear == n
  4. front == 0

Explanation

Keeping an explicit count makes the full test simply count == n, which avoids the ambiguity of front == rear, a condition that also holds when the queue is empty. Comparing rear with n fails because indices wrap around.

Question 47Data Structures: Lists, Stacks and Queues

What is the final content of the list after this code runs? lst = [1, 2, 3, 4, 5] del lst[1:3] lst.insert(1, 9)

  1. [1, 2, 9, 4, 5]
  2. [9, 1, 4, 5]
  3. [1, 9, 4, 5] Correct answer.
  4. [1, 9, 3, 4, 5]

Explanation

The slice lst[1:3] covers indices 1 and 2, that is the values 2 and 3, so deleting it leaves [1, 4, 5]. Then insert(1, 9) places 9 at index 1, giving [1, 9, 4, 5].

Question 48Data Structures: Lists, Stacks and Queues

A stack is used to check whether the brackets in the string "([{}])" are balanced. What is the maximum number of elements held by the stack during the scan?

  1. 3 Correct answer.
  2. 6
  3. 4
  4. 2

Explanation

Each opening bracket is pushed and each closing bracket pops the matching top, so the stack depth equals the number of open brackets not yet closed. The deepest point is after reading "([{", when three opening brackets are pending, so the maximum depth is 3.

Question 49Data Structures: Lists, Stacks and Queues

A singly linked list is to be reversed by changing links. Which pointer updates are required at each node while traversing the list?

  1. Swap the data fields of the first and last nodes only
  2. Point the current node's link to its previous node, then advance previous and current Correct answer.
  3. Point the current node's link to its next node twice
  4. Point the head to the last node and stop

Explanation

Reversal requires three pointers: previous, current and next. At each step the current node's link is redirected to the previous node, then previous moves to current and current moves to the saved next node, and finally the head is set to the old last node.

Question 50Data Structures: Lists, Stacks and Queues

In a list-based stack implementation, which pair of Python list methods gives the standard push and pop operations with O(1) time each?

  1. insert(0, x) for push and pop() for pop
  2. append() for push and pop() for pop Correct answer.
  3. append() for push and pop(0) for pop
  4. insert(0, x) for push and pop(0) for pop

Explanation

A stack follows the LIFO principle, so the newest element must be the one removed first. Python's append() adds at the end of the list and pop() with no argument removes the last element, so both act at the same end and each takes constant time. The other pairings act at opposite ends or shift every remaining element.