Programming Fundamentals – 300 MCQs
Course-Aligned Multiple Choice Questions for Exam Preparation
Problem Solving, Programming Basics, Conditions, Loops, Arrays, Functions, Strings, Memory and File I/O
The first step in solving a programming problem is to:
An algorithm is best described as:
Which feature is essential for a good algorithm?
Pseudocode is mainly used to:
A flowchart uses diamonds to represent:
A rectangle in a flowchart usually represents:
The oval symbol in a flowchart commonly represents:
Breaking a large problem into smaller subproblems is called:
In top-down design, developers usually start with:
A test case is used to:
Dry run means:
An input to a program is:
The result produced by a program is called:
Which is a valid characteristic of problem-solving logic?
The IPO model stands for:
An algorithm should produce the same correct result for the same valid input, which shows:
The Von Neumann architecture stores instructions and data in:
Which unit performs arithmetic and logical operations in a computer?
The control unit mainly:
Main memory in Von Neumann architecture is used to store:
Which of the following is an input device?
The CPU is primarily made up of:
A compiler translates:
A linker is responsible for:
A syntax error is usually detected by the:
A logic error means the program:
A runtime error occurs:
Which tool typically translates and runs one statement at a time?
Source code is written by programmers in:
Object code is:
The purpose of comments in a program is to:
Which of the following is not part of basic problem analysis?
Trace tables are useful for:
The sequence structure in programming means:
Selection structure is used when:
Iteration structure means:
A well-defined algorithm must have:
Refining an algorithm into more detail is called:
Which is the best reason to design before coding?
A variable appearing in an algorithm before coding usually represents:
The basic fetch-decode-execute cycle is performed by the:
Which statement about high-level languages is true?
In problem solving, constraints are:
Which one is an example of an algorithmic step?
A program is:
Which testing approach uses normal, boundary, and invalid inputs?
The linker usually works after the:
A machine instruction is directly understood by the:
Abstraction in problem solving helps by:
A correct algorithm must terminate after:
A variable is:
A constant is:
Which of the following is a valid reason to use meaningful variable names?
An integer data type is generally used to store:
A floating-point data type is commonly used for:
A character data type usually stores:
A Boolean type usually has values:
Declaring a variable means:
Initialization means:
Which operator is commonly used for assignment?
The expression a + b uses + as a(n):
Which operator gives the remainder after division?
If x = 7 and y = 2, the value of x / y in integer division is often:
Which operator is used to compare equality?
The expression x > y uses > as a:
Logical AND is true when:
Logical OR is false when:
Logical NOT does what?
Operator precedence determines:
Parentheses in expressions are useful because they:
An expression is:
The value entered by a user at runtime is usually stored in a:
Type conversion means:
Implicit type conversion is:
Explicit type conversion is often called:
Overflow occurs when:
Underflow commonly refers to:
Which of these is a unary operator?
Incrementing a variable means:
Decrementing a variable means:
Which statement about identifiers is true?
A reserved keyword is:
Input statements are used to:
Output statements are used to:
Concatenation in output often means:
A newline in output is useful for:
Which of the following is a relational operator?
Which of the following is a logical operator?
The result of a comparison expression is usually:
Short-circuit evaluation in logical expressions means:
An lvalue generally refers to:
A literal is:
Which of the following is a numeric literal?
A string literal is typically enclosed in:
Reading input without validating it can cause:
Which choice best describes debugging?
A semicolon or similar terminator missing in some languages often causes:
The expression 5 < 8 && 2 < 1 evaluates to:
If a = 5, then a += 3 usually means:
The main purpose of data types is to:
A conditional statement is used to:
The simplest selection structure checks:
An if statement executes its block when the condition is:
An if-else statement provides:
An else-if ladder is useful when:
Nested if statements mean:
The condition in a selection statement should evaluate to:
Which operator checks whether two values are not equal?
A compound condition combines simpler conditions using:
Which statement is true about if-else chains?
The dangling else problem is related to:
A switch-style statement is most suitable when:
A switch/case statement commonly uses:
The default branch in a switch usually executes when:
Break in a switch often prevents:
Fall-through in a switch means:
Which of the following is a valid use of decision making?
A relational expression such as x >= 10 is often used as:
In many languages, 0 in a condition is treated as:
An if block with no braces in some languages typically controls:
A common reason to use braces even for one statement is to:
Which is an example of a mutually exclusive decision set?
The expression !(x < 5) means:
To check whether a number is between 1 and 10 inclusive, a suitable condition is:
Which branch executes if all previous if and else-if conditions are false?
A common logic error in conditions is:
Nested decisions are often used when:
Guard conditions are helpful because they:
Comparing strings in many languages should be done:
A menu-driven program often uses:
Boolean variables can improve readability in conditions by:
Which operator has higher precedence in many languages?
A ternary conditional operator usually provides:
The condition x % 2 == 0 checks whether x is:
When validating user input, conditionals are used to:
An example of range checking is:
Which is true about indentation?
A switch statement often cannot directly use:
Comparing floating-point values for exact equality can be risky because:
A condition is said to be exhaustive when:
Which construct is most suitable for deciding pass or fail?
Decision tables can help with:
The statement if (score >= 50) likely means:
Short-circuit behavior in conditions can help avoid:
A nested if inside an else branch indicates:
Testing boundary values for conditions means trying:
Which is a practical use of a multi-way decision?
A truth table for a compound condition helps to:
A well-written condition should be:
Conditional execution changes:
A loop is used to:
A while loop typically repeats while its condition is:
A do-while style loop differs from while because it:
A for loop is often preferred when:
Initialization, condition, and update commonly appear together in a:
An infinite loop is a loop that:
The loop variable in counting loops is commonly called:
An accumulator variable is used to:
A sentinel-controlled loop ends when:
A flag-controlled loop uses:
Which statement immediately exits the nearest loop in many languages?
Which statement skips the rest of the current iteration and proceeds to the next?
An off-by-one error in loops means:
The condition i < n in a counting loop usually causes i to take values:
Nested loops are loops:
A common use of nested loops is to:
Loop tracing helps to:
The update step of a loop is important because it:
A pre-test loop checks its condition:
A post-test loop checks its condition:
To sum numbers from 1 to n, a variable often initialized to 0 is:
To count how many times an event occurs, use a variable often initialized to:
Which is a loop invariant?
A common cause of infinite loops is:
The loop condition should eventually become false for:
Which loop is most suitable for reading until end-of-file or sentinel?
The body of a loop contains:
A loop that processes every element of an array often uses:
Loop unrolling generally refers to:
Which statement about for and while loops is true?
A dry run of a loop usually records:
When should break be used carefully?
A loop controlled by user choice often depends on:
The expression i++ or similar usually means:
Reverse iteration over an array means:
The main reason to avoid unnecessary nested loops is:
A loop over a fixed number of times is often called:
A loop whose number of repetitions depends on data is:
An index out of range inside a loop can cause:
The continue statement usually affects:
Choosing correct initial values for counters and accumulators is important because:
Which is an example of repetition?
A for-each style loop is often used to:
A loop condition based on user input should be re-evaluated:
The statement total += value inside a loop is usually:
A loop can be replaced by recursion in some problems, but loops are often:
Which testing values are especially useful for loops?
A nested loop printing a multiplication table most naturally uses:
A loop’s time complexity often depends on:
Good loop design requires clear initialization, condition, body, and:
A list or array is primarily used to:
Array elements are typically stored in:
The first element of an array in many languages has index:
An array index is used to:
The length or size of an array means:
Accessing an index outside valid bounds can cause:
Traversing an array means:
Which loop is commonly used to process all array elements?
A two-dimensional array is useful for representing:
The element at row i and column j in a 2D array is often written as:
Multidimensional arrays are often stored in memory using:
Searching an unsorted array for a value using one-by-one checking is:
Binary search requires the array to be:
Swapping two array elements is common in:
A string in many languages is:
The length of a string usually means:
Concatenating strings means:
A substring is:
String comparison is used to:
In many languages, strings may require a special terminator or metadata to indicate:
A character array used as a string often ends with:
Copying one array to another usually requires:
The average of n numbers stored in an array is found by:
A common reason to use arrays is to:
An array declaration typically specifies:
Which of the following is a common array operation?
A jagged array generally means:
The main diagonal of a square matrix contains elements where:
Initializing an array means:
A frequency table can be implemented using:
Which of the following best describes an index variable?
A common bug with arrays is:
Sorting arranges data in:
Bubble sort repeatedly:
Selection sort repeatedly selects:
An array passed to a function often provides:
A matrix addition algorithm usually uses:
To find the maximum element in an array, you usually:
A string traversal loop processes:
Whitespace handling in strings can matter because:
A palindrome check on a string often compares:
Which data structure is closest to a fixed-size list in basic programming?
An array element can usually be updated by:
A row-major traversal of a 2D array processes:
The total number of elements in a 2D array with r rows and c columns is:
A list in higher-level languages may differ from a basic array because it can often:
Parallel arrays mean:
A common operation on strings is parsing, which means:
The memory organization of arrays helps make indexed access:
When copying strings in low-level languages, special care is needed to avoid:
A function is primarily used to:
Function modularity helps by:
A function definition contains:
A function call does what?
The values supplied to a function when it is called are:
The variables listed in the function definition are:
A return value is:
A void function typically:
Local variables are usually accessible:
Global variables are variables that are:
Which is a good reason to avoid excessive global variables?
A function prototype or declaration tells the compiler/interpreter about:
Pass by value means:
Pass by reference means:
Recursion is when a function:
A recursive function needs a base case to:
The call stack is used to store:
Stack unwinding in recursion occurs when:
A pointer usually stores:
Dereferencing a pointer means:
A null pointer/reference typically indicates:
Dynamic memory allocation is useful when:
Static memory allocation generally means memory size is determined:
Heap memory is commonly associated with:
A memory leak occurs when:
Dangling pointer/reference refers to:
Which operation is common with files?
File I/O stands for:
Before reading or writing a file, a program usually needs to:
Closing a file after use is important to:
Text files store data as:
Binary files store data in:
End-of-file indicates:
Which function design principle is good practice?
Parameter names in a function definition are:
Returning multiple results from a function can be done in some languages by:
A library function is:
Modular programming improves testing because:
A stack overflow can occur with recursion when:
Which best describes scope?
Lifetime of a variable refers to:
A reference parameter can allow a function to:
A pointer arithmetic mistake can lead to:
Which of the following is a common string function category?
Reading a full line of text instead of a single word is useful when:
When writing records to a file, consistent format is important for:
A function should ideally communicate with the rest of the program through:
Dynamic arrays/vectors are helpful because they:
Error handling in file operations should check whether:
A command-line argument is an example of:



Conditional Statements, Comments and Syntax in C++