Programming the Basic Computer - machine language, assembly language, assembler, program loops, subroutines, input-output programming - Question Bank

1. What is a 'jump' or 'branch' instruction used for in machine/assembly language?
A) To perform arithmetic operations
B) To load data into a register
C) To alter the sequential flow of program execution
D) To store data in memory
2. What is a 'buffer' in I/O programming?
A) A hardware device for input
B) A temporary storage area in memory used to hold data during input or output operations
C) A type of loop
D) A subroutine call instruction
3. What is a 'stack frame' or 'activation record'?
A) A single machine instruction
B) A data structure on the stack holding information about a single subroutine call
C) The entire program's memory layout
D) A temporary storage location for I/O data
4. Which loop structure guarantees that the loop body will execute at least once?
A) For loop
B) While loop
C) Do-while loop
D) If statement
5. What is the process of 'linking'?
A) Translating source code to object code
B) Combining multiple object files and library files into a single executable program
C) Debugging the program
D) Loading the program into memory
6. What is the main benefit of using assembly language over machine language?
A) Increased portability across different architectures
B) Easier to read, write, and debug due to mnemonics and labels
C) Higher level of abstraction
D) Automatic memory management
7. Which instruction format is directly executable by the CPU?
A) Assembly Language Instruction
B) Machine Language Instruction
C) High-Level Language Statement
D) Pseudocode
8. In the context of I/O programming, what is a 'device driver'?
A) A piece of hardware that controls I/O
B) A software component that translates generic I/O requests into specific commands for a hardware device
C) A programming language for I/O
D) A protocol for network communication
9. What is the 'call stack' primarily used for?
A) Storing global variables
B) Managing function calls and their local states
C) Buffering I/O operations
D) Caching frequently accessed data
10. An infinite loop is a loop whose condition:
A) Is never met
B) Is always met
C) Changes unpredictably
D) Is checked only once
11. What is the 'symbol table' used for during assembly?
A) To store the generated machine code
B) To keep track of labels and their corresponding memory addresses
C) To manage the flow of control
D) To report syntax errors
12. Assembly language mnemonics are symbolic representations of:
A) High-level language keywords
B) Machine code operations
C) Data structures
D) Memory addresses
13. Machine language is also known as:
A) Source code
B) Object code
C) High-level code
D) Pseudocode
14. Which I/O technique involves the CPU being notified by hardware when an I/O device is ready?
A) Programmed I/O (Polling)
B) Interrupt-driven I/O
C) Direct Memory Access (DMA)
D) Sequential I/O
15. What is the primary role of the stack in subroutine calls?
A) To store subroutine arguments only
B) To store the return address and local variables
C) To hold the program's entire state
D) To manage the CPU's registers
16. What is a 'nested loop'?
A) A loop that executes indefinitely
B) A loop placed inside another loop
C) A loop that uses a subroutine
D) A loop with a complex condition
17. In assembly language, what is the purpose of a 'pseudo-operation' or 'assembler directive'?
A) To perform arithmetic calculations
B) To control the assembly process itself, not executed by the CPU
C) To transfer data between registers
D) To branch to a different part of the code
18. What does the 'operand' field in a machine instruction typically specify?
A) The operation to be performed
B) The location of the data or address to be used in the operation
C) The next instruction's address
D) The program status
19. Which component translates assembly language into machine code?
A) Compiler
B) Interpreter
C) Assembler
D) Linker
20. What is Direct Memory Access (DMA)?
A) A method for the CPU to directly access I/O device registers
B) A method allowing I/O devices to transfer data directly to and from main memory without CPU intervention
C) A technique for managing memory allocation
D) A way to execute machine code instructions
21. What is 'recursion' in programming?
A) A loop that executes a fixed number of times
B) A function calling itself directly or indirectly
C) A subroutine that takes no arguments
D) A method for error handling
22. A 'do-while' loop is an example of what type of loop?
A) Entry-controlled loop
B) Exit-controlled loop
C) Count-controlled loop
D) Nested loop
23. Which of the following is a common assembler directive?
A) JMP (Jump)
B) ORG (Origin)
C) ADD (Add)
D) MOV (Move)
24. What is the main purpose of using labels in assembly language?
A) To define data types
B) To represent memory addresses for jumps and data references
C) To improve code readability with comments
D) To declare constants
25. Machine code instructions are specific to a particular what?
A) Operating System
B) Programming Language
C) Computer Architecture (Instruction Set Architecture)
D) Compiler
26. What does 'memory-mapped I/O' mean?
A) I/O devices are controlled using special I/O instructions
B) I/O devices are accessed using the same address space as memory
C) I/O operations are managed by the CPU exclusively
D) I/O data is stored in RAM
27. What happens when a subroutine 'returns'?
A) Control is transferred back to the instruction following the subroutine call
B) The program terminates
C) A new subroutine is called
D) The program enters an infinite loop
28. Which type of loop continues to execute as long as a specified condition remains true?
A) Fixed loop
B) Conditional loop
C) Infinite loop
D) Nested loop
29. What is the output of an assembler?
A) Executable machine code
B) Object code (relocatable machine code)
C) Source code with comments removed
D) A syntax error report
30. Assembly language provides a one-to-one or close-to-one mapping with what?
A) High-level language constructs
B) Machine language instructions
C) Data structures
D) Operating system calls
31. Which of the following is a typical operand in machine language?
A) A keyword like 'PRINT'
B) A memory address or a register number
C) A comment
D) A function name
32. What is an 'interrupt' in the context of I/O programming?
A) A signal from a device indicating it needs attention or has completed an operation
B) A program crash
C) A system reboot
D) A network connection failure
33. What is the process of 'calling' a subroutine?
A) Terminating the program
B) Transferring control to the subroutine and saving the return address
C) Defining a new variable
D) Executing a single instruction
34. A 'while' loop is an example of what kind of loop?
A) Count-controlled loop
B) Entry-controlled loop
C) Exit-controlled loop
D) Unconditional loop
35. An 'assembler directive' (or pseudo-operation) provides instructions for which entity?
A) The CPU during execution
B) The assembler program itself
C) The operating system
D) The user interface
36. Which mnemonic might represent the 'ADD' operation in assembly language?
A) MOV
B) ADD
C) JMP
D) SUB
37. What does the 'op-code' part of a machine language instruction specify?
A) The memory address of the operand
B) The operation to be performed
C) The data to be operated on
D) The next instruction's address
38. When programming input/output, what does 'polling' typically involve?
A) Waiting for an interrupt signal from the device
B) Continuously checking the status of an I/O device
C) Sending data directly to the device without checking status
D) Using a dedicated I/O processor
39. What is the main advantage of using subroutines?
A) Increased program size
B) Reduced code redundancy and improved modularity
C) Slower execution speed
D) Limited reusability
40. A 'for' loop is a common example of which type of loop?
A) Conditional loop
B) Unconditional loop
C) Count-controlled loop
D) Event-controlled loop
41. What is the role of a linker in the compilation process?
A) To convert source code into machine code
B) To combine multiple object files and resolve external references
C) To check for syntax errors
D) To optimize the generated code
42. Which of the following is a characteristic of assembly language?
A) Platform-independent
B) Requires extensive compilation
C) Closely tied to the specific computer architecture
D) Uses abstract data types extensively
43. Machine language instructions are typically represented in what format?
A) English words
B) Binary or Hexadecimal
C) Pseudocode
D) Flowcharts
44. Which type of programming involves writing instructions that directly interact with hardware devices?
A) High-Level Programming
B) Object-Oriented Programming
C) Input-Output Programming
D) Functional Programming
45. What is a subroutine in the context of programming?
A) A single, executable instruction
B) A block of code designed to perform a specific task and can be called from other parts of the program
C) A type of data storage
D) A way to declare variables
46. In programming, what is a 'program loop' primarily used for?
A) To perform a task only once
B) To repeat a block of code multiple times
C) To define variables
D) To handle errors
47. What is the primary function of an assembler?
A) To translate high-level code into machine code
B) To translate assembly language into machine code
C) To execute programs directly
D) To manage computer memory
48. Which programming language uses mnemonics to represent machine code instructions?
A) Machine Language
B) Assembly Language
C) Java
D) C++
49. What is the lowest level of programming language that a computer can directly understand and execute?
A) Assembly Language
B) High-Level Language
C) Machine Language
D) Python