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 1Computer Organization and Fundamentals (hardware, memory, number systems, logic basics)
The binary number 10110₂ is equal to which decimal value?
- 21
- 44
- 20
- 22 Correct answer.
Explanation
Each bit is multiplied by its positional weight in base two: 1×16 + 0×8 + 1×4 + 1×2 + 0×1. Adding these weights gives 16 + 4 + 2 = 22, so 10110₂ = 22₁₀.
Question 2Computer Organization and Fundamentals (hardware, memory, number systems, logic basics)
Which single logic gate is called a universal gate because it alone can be used to build AND, OR and NOT gates?
- OR gate
- XOR gate
- NAND gate Correct answer.
- AND gate
Explanation
A universal gate can realise AND, OR and NOT by itself, so any Boolean function can be wired using only that gate. The NAND gate achieves this because a NAND with both inputs tied together behaves as a NOT, and combinations of such NANDs reproduce AND and OR.
Question 3Computer Organization and Fundamentals (hardware, memory, number systems, logic basics)
Which CPU register always holds the memory address of the next instruction to be fetched?
- Stack Pointer (SP)
- Accumulator (ACC)
- Program Counter (PC) Correct answer.
- Instruction Register (IR)
Explanation
The program counter is incremented after each fetch so that it always points to the address of the instruction that will be read next. The instruction register, by contrast, holds the opcode that is currently being decoded and executed.
Question 4Computer Organization and Fundamentals (hardware, memory, number systems, logic basics)
In an 8-bit two's complement representation, the range of decimal integers that can be stored is
- −128 to +128
- −127 to +127
- −128 to +127 Correct answer.
- 0 to 255
Explanation
In an n-bit two's complement system one code pattern is reserved for zero, so the negative side has one extra value. For 8 bits the smallest value is −2⁷ = −128 and the largest is +2⁷ − 1 = +127.
Question 5Computer Organization and Fundamentals (hardware, memory, number systems, logic basics)
According to De Morgan's first theorem, the complement of the Boolean product A·B is equal to
- A′ + B
- A′ · B′
- A′ + B′ Correct answer.
- A + B
Explanation
De Morgan's theorem states that the complement of a product equals the sum of the complements, so (A·B)′ = A′ + B′. This matches the NAND truth table, where the output is 1 whenever at least one of the inputs is 0.
Question 6Computer Organization and Fundamentals (hardware, memory, number systems, logic basics)
Which statement correctly describes cache memory in the memory hierarchy of a computer?
- It has a larger capacity than main memory but a slower access time.
- It is a small, fast memory placed between the CPU and main memory. Correct answer.
- It permanently stores the operating system and application programs.
- It is non-volatile and retains its contents after the power is switched off.
Explanation
Cache is a small, high-speed memory built from SRAM and placed between the processor and main memory. It keeps recently or frequently used blocks so that most references are served without waiting for the slower main memory, which raises the effective access speed of the system.
Question 7Computer Organization and Fundamentals (hardware, memory, number systems, logic basics)
Which sequence correctly lists the steps of the machine cycle used by a CPU to process one instruction?
- Decode → Fetch → Execute
- Fetch → Decode → Execute Correct answer.
- Fetch → Execute → Decode
- Execute → Fetch → Decode
Explanation
The processor first fetches the instruction from the address held in the program counter, then decodes the opcode to identify the operation, and finally executes it, storing any result before the next fetch begins. Decoding therefore always lies between fetching and execution.
Question 8Computer Organization and Fundamentals (hardware, memory, number systems, logic basics)
A half adder adds two input bits A and B. Which pair of expressions gives its Sum and Carry outputs?
- Sum = A·B, Carry = A ⊕ B
- Sum = A ⊕ B, Carry = A·B Correct answer.
- Sum = A ⊕ B, Carry = A + B
- Sum = A + B, Carry = A·B
Explanation
The sum output of a half adder is the exclusive-OR of the two bits, while the carry is their AND, because a carry is produced only when both bits are 1. Its truth table confirms that 1 + 1 gives sum 0 with carry 1, which is 10₂.
Question 9Computer Organization and Fundamentals (hardware, memory, number systems, logic basics)
The hexadecimal number 2F₁₆, when converted to the octal number system, is equal to
- 47
- 57 Correct answer.
- 56
- 75
Explanation
Each hexadecimal digit expands to four binary bits, so 2F₁₆ = 0010 1111₂ = 101111₂. Regrouping these bits in threes from the right gives 101 111₂ = 5 7₈, which is 57₈ and agrees with the decimal value 47.
Question 10Computer Organization and Fundamentals (hardware, memory, number systems, logic basics)
A processor has a 16-bit address bus. The maximum number of distinct memory locations it can address directly is
- 65,536 Correct answer.
- 32,768
- 1,048,576
- 16,384
Explanation
With n address lines the processor can generate 2ⁿ different addresses, so 2¹⁶ = 65,536 locations can be selected. If each location holds one byte, this gives 64 KB of directly addressable memory.
Question 11Computer Organization and Fundamentals (hardware, memory, number systems, logic basics)
Which type of computer memory loses all its stored contents when the power supply is switched off?
- ROM
- RAM Correct answer.
- EPROM
- PROM
Explanation
RAM is volatile semiconductor memory used for temporary storage of programs and data during execution, so it needs continuous power to retain its bits. ROM, PROM and EPROM are non-volatile memories and keep their contents even when power is removed.
Question 12Computer Organization and Fundamentals (hardware, memory, number systems, logic basics)
The octal number 57₈ is equivalent to which decimal number?
- 45
- 57
- 47 Correct answer.
- 53
Explanation
In the octal system each digit has a place value that is a power of 8, so 57₈ = 5 × 8¹ + 7 × 8⁰ = 40 + 7 = 47₁₀. The decimal value is therefore 47.
Question 13Computer Organization and Fundamentals (hardware, memory, number systems, logic basics)
Which logic gate produces a HIGH output only when its two inputs are different?
- AND
- NOR
- XOR Correct answer.
- OR
Explanation
The exclusive-OR gate gives output 1 for the input combinations 01 and 10, and output 0 for 00 and 11. An AND gate needs both inputs to be 1, an OR gate gives 1 when at least one input is 1, and a NOR gate is the complement of OR.
Question 14Computer Organization and Fundamentals (hardware, memory, number systems, logic basics)
The Boolean expression A + A'B simplifies to which of the following?
- AB
- A + B Correct answer.
- A' + B
- A'B'
Explanation
Using the identity A + A'B = (A + A')(A + B) = 1 · (A + B), the expression reduces to A + B. Checking the two cases also confirms it: when A = 0 the expression equals B, and when A = 1 it equals 1, matching A + B.
Question 15Computer Organization and Fundamentals (hardware, memory, number systems, logic basics)
The 8-bit two's complement representation of the decimal number −25 is
- 10011001
- 11100111 Correct answer.
- 11100110
- 00011001
Explanation
The positive value +25 in 8-bit binary is 00011001. Inverting all bits gives 11100110, and adding 1 produces 11100111, which is the two's complement code for −25.
Question 16Computer Organization and Fundamentals (hardware, memory, number systems, logic basics)
Which CPU register holds the data that is currently being read from or written to memory?
- PC
- MDR Correct answer.
- SP
- IR
Explanation
The Memory Data Register (MDR), also called the Memory Buffer Register, temporarily holds the data fetched from memory or the data to be stored in the addressed memory location. The PC holds an address, the IR holds the current instruction, and the SP points to the top of the stack.
Question 17Computer Organization and Fundamentals (hardware, memory, number systems, logic basics)
Which sequence arranges the following storage types in decreasing order of access speed?
- Registers → cache → main memory → secondary storage Correct answer.
- Main memory → cache → registers → secondary storage
- Secondary storage → main memory → cache → registers
- Cache → registers → secondary storage → main memory
Explanation
Registers are the fastest storage because they are inside the CPU, followed by cache memory, then main memory, and finally secondary storage such as a hard disk. As access speed decreases along this hierarchy, capacity usually increases and cost per bit usually falls.
Question 18Computer Organization and Fundamentals (hardware, memory, number systems, logic basics)
In ASCII, the decimal code for the character 'A' is 65. What is the hexadecimal ASCII code for the character 'F'?
- 47
- 44
- 46 Correct answer.
- 45
Explanation
ASCII codes for uppercase letters are consecutive, so 'F' is five places after 'A': 65 + 5 = 70 in decimal. Converting 70 to hexadecimal gives 4 × 16 + 6 = 70, which is 46₁₆.
Question 19Computer Organization and Fundamentals (hardware, memory, number systems, logic basics)
How many 2-input NAND gates are required to implement a 2-input XOR gate?
- 5
- 3
- 2
- 4 Correct answer.
Explanation
A standard XOR realization uses four 2-input NAND gates: two gates form NAND(A, B) and its complement used with A and B, and the final two gates combine those intermediate results. Fewer than four 2-input NAND gates cannot produce the XOR truth table.
Question 20Computer Organization and Fundamentals (hardware, memory, number systems, logic basics)
A 4-bit binary counter is cleared to 0000. After 13 clock pulses, what is its binary state?
- 1110
- 1001
- 1011
- 1101 Correct answer.
Explanation
A 4-bit binary counter increments by one on each clock pulse, so after 13 pulses its state is the binary equivalent of decimal 13. Since 13 = 8 + 4 + 1, the binary state is 1101₂.
Question 21Computer Organization and Fundamentals (hardware, memory, number systems, logic basics)
The BIOS firmware of a personal computer is normally stored permanently in which type of memory?
- ROM Correct answer.
- Virtual memory
- RAM
- Cache memory
Explanation
Firmware such as the BIOS must retain its contents when the computer is switched off, so it is stored in read-only memory (ROM), typically a flash or EEPROM chip on the motherboard. ROM is non-volatile and its stored program is available immediately at power-on.
Question 22Computer Organization and Fundamentals (hardware, memory, number systems, logic basics)
What is the sum of the binary numbers 1101₂ and 0110₂?
- 10001₂
- 10101₂
- 10011₂ Correct answer.
- 11001₂
Explanation
Adding from the least significant bit: 1+0=1, 0+1=1, 1+1=0 with a carry of 1, and 1+0+1=0 with a carry of 1, giving 10011₂. In decimal terms 13+6=19, and 10011₂ equals 19, which confirms the result.
Question 23Computer Organization and Fundamentals (hardware, memory, number systems, logic basics)
A processor is driven by a 2 GHz clock. How many clock cycles are completed in one microsecond?
- 200
- 2000 Correct answer.
- 20
- 20000
Explanation
A 2 GHz clock produces 2×10⁹ cycles per second, and one microsecond is 10⁻⁶ second. Multiplying gives 2×10⁹ × 10⁻⁶ = 2000 cycles in one microsecond.
Question 24Computer Organization and Fundamentals (hardware, memory, number systems, logic basics)
A 4-bit binary ripple counter is clocked at 64 kHz. What is the frequency of the output taken from its most significant flip-flop?
- 4 kHz Correct answer.
- 8 kHz
- 32 kHz
- 16 kHz
Explanation
Each flip-flop in a ripple counter divides the frequency of the preceding stage by 2. With four stages the overall division factor is 2⁴=16, so 64 kHz ÷ 16 = 4 kHz at the most significant output.
Question 25Operating Systems and File Management
Which task belongs to the file manager component of an operating system?
- Creating and managing directories Correct answer.
- Loading device drivers into memory
- Allocating the CPU to ready processes
- Translating logical to physical addresses
Explanation
The file manager creates and removes directories, allocates space to files, and controls access to them. CPU allocation belongs to the scheduler, address translation to the memory manager, and driver loading to the I/O subsystem.
Question 26Operating Systems and File Management
Which file attribute marks a file as protected so that its contents cannot be changed until the attribute is cleared?
- Archive
- Read-only Correct answer.
- Hidden
- System
Explanation
The read-only attribute tells the operating system to refuse write operations on the file until the attribute is removed. Hidden controls whether the name appears in a listing, archive marks files for backup, and system identifies operating-system files.
Question 27Operating Systems and File Management
In a hierarchical directory structure, which path begins at the root directory and is valid from any current directory?
- Relative path
- Absolute path Correct answer.
- Working path
- Shortcut path
Explanation
An absolute path starts at the root and lists every directory down to the target file, so it does not depend on the current working directory. A relative path is interpreted from the current directory, while a shortcut is only a pointer to another file.
Question 28Operating Systems and File Management
A file needs four contiguous disk blocks. The disk has four free blocks, but they are in separate non-adjacent locations, so the file cannot be stored. Which condition does this describe?
- External fragmentation Correct answer.
- Starvation of processes
- Internal fragmentation
- Thrashing of pages
Explanation
External fragmentation occurs when free disk space is broken into separate holes that are each too small for a file needing contiguous blocks, even though the total free space is sufficient. Internal fragmentation is wasted space inside an allocated block, and thrashing concerns excessive memory paging.
Question 29Operating Systems and File Management
In a FAT file system, what information does the file allocation table hold for each cluster?
- Names of subdirectories under the root
- Login names of users who may open the file
- Cluster numbers forming each file's chain Correct answer.
- Actual data bytes stored in each file
Explanation
The file allocation table keeps, for every cluster, the number of the next cluster in the file's chain, with a special marker for the end of the chain. File contents are stored in the data area, while directory entries hold names and starting cluster numbers.
Question 30Operating Systems and File Management
Which CPU scheduling policy can starve a long process because shorter jobs are always chosen first?
- Shortest Job First Correct answer.
- Longest Job First
- Round Robin
- First Come First Served
Explanation
Shortest Job First always selects the process with the smallest estimated CPU burst, so a long process can be overtaken repeatedly and may never get the CPU. First Come First Served follows arrival order, Round Robin gives every process a time slice, and Longest Job First favours long jobs.
Question 31Operating Systems and File Management
A process is in the ready state and the dispatcher selects it for the CPU. Which state transition occurs?
- Waiting → Ready
- Running → Ready
- Running → Terminated
- Ready → Running Correct answer.
Explanation
When the dispatcher gives the CPU to a ready process, the process moves from the ready state to the running state. Running to ready happens on preemption, waiting to ready on completion of I/O, and running to terminated on normal exit.
Question 32Operating Systems and File Management
On a command line, which wildcard represents any number of characters in a filename?
- Asterisk (*) Correct answer.
- Question mark (?)
- Backslash (\)
- Dot (.)
Explanation
The asterisk wildcard matches zero or more characters in a filename, so *.txt selects every text file in the directory. The question mark matches exactly one character, while a dot and a backslash are ordinary characters used for other purposes.
Question 33Operating Systems and File Management
A paging system uses a page size of 1024 bytes. For the logical address 2050, what are the page number and offset?
- Page 0, offset 2050
- Page 2, offset 1024
- Page 1, offset 1026
- Page 2, offset 2 Correct answer.
Explanation
Paging divides the logical address by the page size: the quotient is the page number and the remainder is the offset. Here 2050 divided by 1024 gives quotient 2 and remainder 2, so the page number is 2 and the offset is 2.
Question 34Operating Systems and File Management
Compared with linked allocation, what advantage does indexed allocation provide?
- It gives direct access to any block Correct answer.
- It removes the need for free-space management
- It stores file data inside the directory entry
- It guarantees contiguous disk blocks for every file
Explanation
Indexed allocation stores pointers to a file's blocks in an index block, so the system can jump directly to any block without following a chain. Linked allocation requires sequential traversal of the chain, and free-space management is still needed in both schemes.
Question 35Operating Systems and File Management
A process is waiting for a disk read to complete. The disk controller signals that the transfer has finished. From which state to which state does the operating system move the process at that moment?
- blocked to ready Correct answer.
- ready to running
- running to terminated
- running to blocked
Explanation
A process that is waiting for an I/O operation is in the blocked (waiting) state. When the I/O completes, the process becomes runnable and is moved to the ready state; the dispatcher later selects it for the CPU. It does not move directly to running because the CPU may be busy with another process.
Question 36Operating Systems and File Management
In a single-level directory system, all files of all users are kept in one directory. Which problem arises when two users create files with the same name?
- File access becomes faster because paths are short.
- The directory is converted into a tree automatically.
- The files are automatically merged into one file.
- The two files cannot share the same name. Correct answer.
Explanation
A single-level directory must keep every file name unique because names are the only way to identify files in that one directory. If two users choose the same name, a name collision occurs and one file must be renamed. This lack of name separation is a major limitation of the single-level structure.
Question 37Operating Systems and File Management
A student record file contains fixed-length records of 80 bytes. A program must read record number 500 without reading records 1 to 499. Which file access method is designed for this requirement?
- Indexed sequential access
- Direct access Correct answer.
- Chained access
- Sequential access
Explanation
Direct access, also called random access, allows the system to compute the location of a record from its number or key and jump to it without scanning earlier records. For fixed-length records, the offset of record 500 can be calculated directly. Sequential access would require reading the preceding records in order.
Question 38Operating Systems and File Management
In linked allocation, each file block stores a pointer to the next block of the file. Which operation becomes inefficient because of this design?
- Increasing the size of the file gradually
- Reading the nth block of a file directly Correct answer.
- Appending a new block at the end of the file
- Using disk space that is scattered across the disk
Explanation
Linked allocation supports sequential access well, but a direct jump to the nth block is not possible because the system must follow the chain of pointers from the first block. Each pointer gives only the next location, so reaching a later block can require many disk accesses. This is why linked allocation is poor for random access.
Question 39Operating Systems and File Management
A disk has 200 cylinders numbered 0 to 199. The read/write head is at cylinder 50. The pending requests, in arrival order, are 82, 170, 43, 140, 24, 16, and 190. Using Shortest Seek Time First (SSTF), what is the total head movement in cylinders?
- 208 cylinders Correct answer.
- 642 cylinders
- 166 cylinders
- 216 cylinders
Explanation
SSTF always serves the request nearest to the current head position. From 50 the order is 43 (7), 24 (19), 16 (8), 82 (66), 140 (58), 170 (30), and 190 (20). Adding these movements gives 7 + 19 + 8 + 66 + 58 + 30 + 20 = 208 cylinders.
Question 40Operating Systems and File Management
Which set lists the conditions that must all hold simultaneously for a deadlock to occur?
- Hold and wait, starvation, no preemption, and circular wait
- Mutual exclusion, hold and wait, no preemption, and circular wait Correct answer.
- Mutual exclusion, preemption, circular wait, and aging
- Mutual exclusion, hold and wait, preemption, and circular wait
Explanation
The four necessary conditions for deadlock are mutual exclusion, hold and wait, no preemption, and circular wait. All four must be present at the same time; preventing any one of them prevents deadlock. Preemption being allowed would break the no-preemption condition.
Question 41Operating Systems and File Management
Which operating system technique keeps several jobs in main memory and switches the CPU to another job when the running job waits for I/O?
- Spooling
- Virtual memory
- Time-sharing only
- Multiprogramming Correct answer.
Explanation
Multiprogramming keeps multiple jobs in memory so that when one job blocks for I/O, the CPU can execute another ready job. This overlap increases CPU utilization and reduces idle time. Spooling and virtual memory are related techniques but do not define this CPU-switching behavior.
Question 42Operating Systems and File Management
A process successfully opens an existing file. What does the operating system typically return to the process at that point?
- A file descriptor or handle Correct answer.
- The file's physical disk address
- A copy of the entire file in memory
- The file's absolute path name
Explanation
Opening a file creates an entry in the system's open-file table, and the process receives a small identifier called a file descriptor or file handle. Later read, write, and close operations use this identifier instead of repeating the path name. The descriptor refers to the open file; it is not the file's disk address or contents.
Question 43Operating Systems and File Management
A system has 12 instances of a single resource type. The current allocation is P1 = 3, P2 = 4, and P3 = 2. The maximum claims are P1 = 7, P2 = 6, and P3 = 10. Using the banker's algorithm, which sequence is safe?
- P2 → P3 → P1
- P2 → P1 → P3 Correct answer.
- P3 → P2 → P1
- P1 → P2 → P3
Explanation
Available resources are 12 − (3 + 4 + 2) = 3. The remaining needs are P1 = 4, P2 = 2, and P3 = 8, so only P2 can finish first. After P2 releases its 4 held instances, available becomes 7; P1 can then finish, raising available to 10, after which P3 can finish. Thus P2 → P1 → P3 is safe.
Question 44Operating Systems and File Management
A disk has a capacity of 1 GiB, which is 2^30 bytes, and uses blocks of 4 KiB, which is 2^12 bytes. A free-space bitmap uses one bit per block. How much memory does the bitmap require?
- 64 KiB
- 8 KiB
- 32 KiB Correct answer.
- 256 KiB
Explanation
The number of blocks is 2^30 ÷ 2^12 = 2^18 = 262,144 blocks. At one bit per block, the bitmap needs 262,144 bits. Dividing by 8 gives 32,768 bytes, which is 32 KiB.
Question 45Programming and Problem Solving (C/C++ constructs, control flow, functions)
Which header file must be included in a C++ program so that the library function strlen() can be used to find the length of a C-style string?
- <iostream>
- <cstring> Correct answer.
- <cmath>
- <cstdlib>
Explanation
The strlen() function is declared in the C++ header <cstring>, which is the C++ version of the C header <string.h>. This header supplies the character-string handling functions such as strlen(), strcpy() and strcmp(). <iostream> is for stream input and output, <cmath> for mathematical functions, and <cstdlib> for general utilities such as conversion and random-number functions.
Question 46Programming and Problem Solving (C/C++ constructs, control flow, functions)
In C++, how many times is the body of a do...while loop executed when the test condition is false the very first time it is evaluated?
- Exactly twice
- Exactly once Correct answer.
- Not at all
- Only if the body contains a break statement
Explanation
A do...while loop is an exit-controlled loop: the body runs first and the condition is tested afterwards. Therefore the body always executes at least once, even when the condition is false on its first evaluation. A while loop, by contrast, tests the condition before entering the body and would execute zero times in the same situation.
Question 47Programming and Problem Solving (C/C++ constructs, control flow, functions)
Which of the following statements correctly declares an integer variable named total and initialises it to zero in a C++ program?
- int total = 0; Correct answer.
- integer total = 0;
- int total := 0;
- total int = 0;
Explanation
In C++ a declaration begins with the data type, followed by the variable name and then the assignment of the initial value. So the valid form is: int total = 0; where int is the keyword for the integer type. The name must come after the type, and the assignment operator is the single equals sign, not := as used in some other languages.
Question 48Programming and Problem Solving (C/C++ constructs, control flow, functions)
What value is stored in the variable result after the following C++ statement is executed?
int result = 10 + 20 % 3 * 2;
- 20
- 24
- 16
- 14 Correct answer.
Explanation
The modulus operator % and the multiplication operator * have the same precedence, so they are evaluated from left to right: 20 % 3 gives 2, and 2 * 2 gives 4. Addition has lower precedence, so 10 + 4 yields 14. If addition were performed first the answer would differ, which is why precedence matters in arithmetic expressions.
Question 49Programming and Problem Solving (C/C++ constructs, control flow, functions)
What is printed by the following C++ code?\n\nint x = 2;\nswitch (x) {\n case 1: cout << "A";\n case 2: cout << "B";\n case 3: cout << "C"; break;\n default: cout << "D";\n}
- BC Correct answer.
- BCD
- C
- B
Explanation
The switch jumps directly to the matching case label, so execution begins at case 2 and prints B. Because that case has no break statement, control falls through into case 3 and prints C as well. The break in case 3 then terminates the switch, so D is never printed.
Question 50Programming and Problem Solving (C/C++ constructs, control flow, functions)
What is printed by the following C++ program?\n\nvoid change(int x) { x = x + 10; }\nint main() { int a = 5; change(a); cout << a; }
- 5 Correct answer.
- 15
- 0
- 10
Explanation
Parameters in C++ are passed by value by default, so the function receives a copy of the argument rather than the original variable. Modifying x inside change() affects only that local copy. When control returns to main(), a still holds its original value of 5.