Programming Fundamentals MCQs (Set-4)

What is a test case?

A A source code comment
B Inputs and expected behavior
C A processor clock cycle
D A variable naming rule

What is unit testing?

A Testing one small program component
B Testing only full network traffic
C Measuring CPU temperature
D Checking spelling in comments

What is an assertion in a test?

A An instruction to repeat forever
B Expected condition
C A source code file type
D A memory allocation method

What is a breakpoint used for?

A Speed up a loop
B Compile source into bytecode
C Delete a stack frame
D Pause execution during debugging

What does a debugger's step over do?

A Restarts the whole program
B Deletes the next statement
C Compiles every source file
D Executes call without entry

What is input validation?

A Encrypting every program variable
B Sorting a function's parameters
C Checking data before using it
D Converting source to machine code

Why handle invalid input?

A To make all inputs identical
B To disable error messages
C To skip program documentation
D Avoid unsafe behavior

What is a build process?

A A method for sorting arrays
B A way to declare variables
C Source to executable steps
D A network authentication protocol

What does a linker commonly combine?

A User input and comments
B Compiled object files and libraries
C Loop counters and conditions
D Pixels and display colors

What is a runtime error?

A Grammar error found before running
B Failure occurring during execution
C A naming convention violation
D A formatting choice in comments

What does program output represent?

A Results for users
B Only data entered by user
C The source code's indentation
D The compiler's grammar rules

What is standard input commonly used for?

A Writing compiler warnings
B Storing executable files
C Drawing a flowchart
D Receiving program input

What is standard output commonly used for?

A Writing normal program results
B Receiving keyboard input only
C Storing a processor register
D Declaring a function type

What is a library in programming?

A A hardware power source
B A loop termination condition
C A variable scope region
D Reusable code collection

What is an API?

A Defined interface for software interaction
B An array index type
C A processor's arithmetic unit
D A source code comment

What is version control used for?

A Executing source code faster
B Validating every runtime input
C Tracking and managing code changes
D Converting characters to numbers

What does a code review examine?

A Proposed code changes
B Only the user interface colors
C Processor temperature readings
D The disk's physical sectors

What is a naming convention?

A A method of sorting files
B Consistent rule for identifier names
C A compiler optimization pass
D A fixed processor opcode

What does Big O notation describe?

A The exact program output
B A programming language syntax
C A variable's storage address
D Resource growth with input

What is constant time complexity?

A Fixed work as input grows
B Work doubles with every item
C Work equals input squared
D Memory always equals input size

What does linear search do?

A Sorts values by halves
B Hashes every key to memory
C Checks items sequentially
D Builds a binary tree

What precondition enables binary search?

A Data contains no duplicates
B Data is stored as text
C Data is sorted
D Data has exactly two items

Why use meaningful variable names?

A Clarify code intent
B Reduce source file bytes
C To prevent compiler optimization
D To replace input validation

What is refactoring?

A Adding a new user feature
B Removing all test cases
C Improving structure without changing behavior
D Changing input to output

What does maintainability describe?

A Maximum processor clock speed
B Ease of changing software
C Number of program variables
D Size of an executable only