Programming Fundamental MCQ’s

Programming Fundamentals – 300 MCQs

Programming Fundamentals

300 Unique Multiple Choice Questions – Complete Exam Preparation

Credit Hours: 4 (3-3) | Contact Hours: 3-3 | Pre-requisites: None

300 MCQs 12 Sections WordPress Ready Searchable + Interactive
300
Total MCQs
12
Sections
PF
Course
4 (3-3)
Credit Hours
SECTION 1: Problem Solving, Logic and Computing Basics (Q1-Q25)
Q1

The first step in solving a programming problem is usually to:

  • AWrite code immediately
  • BUnderstand and define the problem clearly
  • CCompile the program
  • DRun test cases
Q2

An algorithm is best described as:

  • AA programming language
  • BA step-by-step procedure to solve a problem
  • CA computer device
  • DA type of memory
Q3

A flowchart is used to:

  • AStore data permanently
  • BRepresent the logic of a solution visually
  • CTranslate code to machine language
  • DMeasure program speed
Q4

Pseudocode helps programmers by:

  • AReplacing hardware
  • BExpressing solution steps in simple structured language
  • CRemoving all bugs automatically
  • DCreating executable files
Q5

In problem solving, decomposition means:

  • ADeleting extra code
  • BBreaking a large problem into smaller parts
  • CCombining all files
  • DReducing RAM usage
Q6

The IPO model stands for:

  • AInput, Process, Output
  • BInitialize, Program, Operate
  • CInput, Print, Operate
  • DInspect, Process, Organize
Q7

A decision symbol in a flowchart usually represents:

  • AInput/output
  • BStart/end
  • CA condition or branching point
  • DA connector
Q8

A rectangle in a flowchart normally shows:

  • AA process or instruction
  • BA loop only
  • CA decision
  • DAn output device
Q9

The oval symbol in a flowchart is commonly used for:

  • AArithmetic operations
  • BStart and end
  • CVariable declaration
  • DComments
Q10

The purpose of tracing an algorithm is to:

  • AInstall the compiler
  • BFollow step execution using sample values
  • CCreate machine code
  • DIncrease processor speed
Q11

Von Neumann architecture is based on the idea that:

  • APrograms and data are stored in memory
  • BThe CPU is optional
  • COnly output matters
  • DEach device has its own language
Q12

Which of the following is a major part of the CPU?

  • AScanner
  • BArithmetic Logic Unit
  • CMonitor
  • DPrinter
Q13

The Control Unit is responsible for:

  • ADisplaying graphics
  • BDirecting and coordinating operations
  • CStoring files forever
  • DTyping source code
Q14

Main memory is primarily used to:

  • AStore currently running programs and data
  • BPrint reports
  • CSend emails
  • DScan documents
Q15

Input devices are used to:

  • AShow results
  • BEnter data into the computer
  • CStore backups offline
  • DCool the processor
Q16

Output devices are used to:

  • AReceive user data only
  • BDisplay processed results
  • CTranslate all programs
  • DControl loops
Q17

A programming language is called high-level because it:

  • AIs close to human language and easier to understand
  • BRuns only on high floors
  • CNeeds no translator
  • DIs part of hardware
Q18

Machine language consists of:

  • AEnglish commands
  • BBinary instructions understood directly by the computer
  • CFlowchart symbols
  • DMathematical formulas only
Q19

Source code refers to:

  • AThe translated machine code
  • BThe program written by a programmer
  • CThe output of the linker
  • DThe printed document
Q20

A syntax error occurs when:

  • ALogic is incorrect though code runs
  • BThe rules of the language are violated
  • CInput is too large
  • DA file is saved
Q21

A logic error means:

  • AThe compiler crashes
  • BThe program runs but produces wrong results
  • CThe keyboard is disconnected
  • DThe program cannot be loaded
Q22

Dry run testing is useful because it:

  • ARemoves the need for coding
  • BHelps verify logic before or during implementation
  • CAdds memory automatically
  • DConverts source to object code
Q23

A finite number of steps is an important property of:

  • APrinters
  • BAlgorithms
  • CKeyboards
  • DDatabases
Q24

A good algorithm should be:

  • AAmbiguous and lengthy
  • BClear, correct, and efficient
  • CDependent on one machine only
  • DImpossible to test
Q25

Abstraction in problem solving means:

  • AIgnoring everything always
  • BFocusing on important details while hiding unnecessary complexity
  • CWriting very long code
  • DAvoiding variables
SECTION 2: Programming, Translation Tools and Program Structure (Q26-Q50)
Q26

The main job of a compiler is to:

  • ACreate hardware circuits
  • BTranslate source code into machine/object code
  • CDisplay flowcharts
  • DStore files permanently
Q27

A linker is used to:

  • ATake user input
  • BCombine object files and libraries into an executable program
  • CEdit source code
  • DCompress images
Q28

An interpreter differs from a compiler because it:

  • AExecutes code line by line
  • BNeeds no source code
  • CWorks only for assembly
  • DProduces hardware output
Q29

Object code is:

  • AA flowchart drawing
  • BThe low-level translated form of source code
  • CAlways human-readable pseudocode
  • DA backup copy of RAM
Q30

A library in programming usually contains:

  • AOnly pictures
  • BReusable prewritten code or functions
  • CDamaged files
  • DCPU registers
Q31

Which phase usually detects syntax errors first?

  • ACompilation
  • BExecution
  • CPrinting
  • DFile saving
Q32

An executable file is a program that:

  • ACan be directly run by the operating system
  • BContains only comments
  • CMust always be interpreted manually
  • DStores only images
Q33

A token in programming is:

  • AA hardware chip
  • BA meaningful unit such as keyword, identifier, or operator
  • CAn output device
  • DA debugging tool
Q34

Reserved words in a language are:

  • AWords programmers may freely rename
  • BKeywords with special predefined meaning
  • CComments added by users
  • DVariable values
Q35

The purpose of comments in source code is to:

  • ASpeed up execution greatly
  • BImprove readability and documentation
  • CReplace variables
  • DGenerate machine code
Q36

A statement in a program is:

  • AA random memory cell
  • BA complete instruction for the computer
  • CAlways a function call
  • DOnly an arithmetic expression
Q37

Structured programming encourages:

  • AUncontrolled jumps everywhere
  • BClear sequence, selection, and repetition
  • CRemoving all functions
  • DUsing only one variable
Q38

Top-down design means:

  • AStarting from detailed code first
  • BBreaking the solution from general steps into smaller modules
  • CWriting from bottom of screen
  • DCompiling before analysis
Q39

The role of indentation in many languages is to:

  • ADamage program logic
  • BImprove readability and sometimes define blocks
  • CReplace semicolons in all languages
  • DCreate variables
Q40

A semantic error usually relates to:

  • AMeaning or valid use of constructs
  • BPrinter failure
  • CElectric power loss
  • DFont selection
Q41

Which one is not typically part of program development?

  • AProblem analysis
  • BAlgorithm design
  • CTesting and debugging
  • DIgnoring outputs
Q42

Debugging means:

  • ACreating new hardware
  • BFinding and fixing errors in a program
  • CTranslating source to assembly only
  • DMaking variables constant
Q43

A build process may include compiling and:

  • ARecycling memory
  • BLinking modules
  • CTyping faster
  • DChanging monitor settings
Q44

Modular design is preferred because it:

  • AMakes maintenance and testing easier
  • BForces one giant function
  • CPrevents reuse
  • DRemoves logic from programs
Q45

Portability of a program means:

  • AIt can run on different systems with little or no change
  • BIt fits in a small folder
  • CIt avoids input
  • DIt needs no compiler
Q46

One benefit of using meaningful identifiers is:

  • AMore confusing code
  • BBetter readability and maintainability
  • CFaster internet
  • DAutomatic bug removal
Q47

The entry point of many programs is:

  • AA loop body
  • BA main function or starting routine
  • CA comment block
  • DA string literal
Q48

Compilation errors must usually be fixed:

  • ABefore successful program execution
  • BAfter printing output
  • COnly on Friday
  • DBy changing hardware
Q49

An IDE mainly provides:

  • AOnly electricity
  • BEditing, building, and debugging tools in one environment
  • CA new programming language
  • DPermanent data storage
Q50

A warning message from a compiler often means:

  • AThe code is perfect
  • BThere may be a potential issue even if compilation succeeds
  • CThe program has been deleted
  • DRAM is full
SECTION 3: Data Types, Variables and Input/Output (Q51-Q75)
Q51

A variable is:

  • AA fixed value that never changes
  • BA named memory location used to store data
  • CA type of compiler
  • DAn output statement
Q52

Declaring a variable tells the compiler:

  • ATo delete memory
  • BIts name and data type
  • CTo run the program
  • DTo print the value
Q53

An integer data type is used for:

  • AWhole numbers
  • BText sentences
  • CTrue/false only
  • DDecimal fractions only
Q54

A floating-point type is mainly used for:

  • ACharacter storage
  • BNumbers with fractional parts
  • CFile names
  • DBoolean conditions
Q55

A character type usually stores:

  • AA single symbol such as 'A'
  • BA full paragraph
  • CA floating value
  • DMultiple arrays
Q56

A Boolean type commonly stores:

  • ALetters only
  • BTrue/false values
  • CDecimal numbers only
  • DFile handles
Q57

Initialization means:

  • ARemoving a variable
  • BGiving a variable its first value
  • CConverting code to binary
  • DReading a file
Q58

Which is the best description of a constant?

  • AA value that does not change during program execution
  • BA changing variable
  • CA temporary bug
  • DA loop counter only
Q59

An identifier should generally:

  • AStart with any punctuation mark
  • BBe meaningful and follow language rules
  • CContain spaces always
  • DMatch the answer key
Q60

Uninitialized variables may lead to:

  • AGuaranteed correct output
  • BUnpredictable results
  • CAutomatic optimization
  • DPermanent storage
Q61

Type casting is used to:

  • AAdd comments
  • BConvert one data type to another
  • CCreate a loop
  • DRead a file
Q62

User input is commonly used to:

  • AMake code shorter only
  • BProvide data during program execution
  • CTranslate the compiler
  • DBuild libraries
Q63

Output statements are used to:

  • ADisplay information to the user
  • BDeclare variables
  • CCreate processors
  • DDefine algorithms
Q64

A prompt message is helpful because it:

  • AConfuses the user
  • BTells the user what input is expected
  • CDeletes previous input
  • DStops execution
Q65

The value entered by a user is typically stored in:

  • AA monitor
  • BA variable
  • CA printer
  • DA compiler
Q66

A string differs from a character because a string:

  • AAlways holds numbers only
  • BContains a sequence of characters
  • CUses less memory than one char
  • DCannot be displayed
Q67

Which one is an example of invalid identifier style in many languages?

  • AtotalMarks
  • B_count
  • C2value
  • Dstudent_name
Q68

A data type determines:

  • AOnly screen color
  • BThe kind of values a variable can hold and related operations
  • CInternet speed
  • DWhether code has comments
Q69

Reading multiple values from input usually requires:

  • ANo variables
  • BSeparate variables or data structures
  • CA printer driver
  • DA linker option
Q70

Formatted output is useful for:

  • AOrganizing displayed values neatly
  • BCompiling faster
  • CRemoving syntax errors
  • DChanging the CPU
Q71

A literal value is:

  • AA value written directly in the program
  • BA memory leak
  • CAn external device
  • DA loop block
Q72

Which of the following is usually text data?

  • A98
  • B3.14
  • C"Hello"
  • Dfalse
Q73

Assignment stores a value:

  • AInto a variable
  • BInto the compiler
  • CInto the keyboard
  • DInto a flowchart
Q74

The statement x = x + 1 typically means:

  • Ax becomes zero
  • Bx is increased by one
  • Cx is compared with one
  • Dx is printed
Q75

Input validation is performed to:

  • AAccept every value blindly
  • BCheck whether entered data is reasonable and correct
  • CConvert source to object code
  • DAvoid all variables
SECTION 4: Operators and Expressions (Q76-Q100)
Q76

An arithmetic operator is used to:

  • AMake decisions only
  • BPerform mathematical calculations
  • CRead files
  • DCreate comments
Q77

Which operator gives the remainder after division?

  • A+
  • B%
  • C=
  • D&&
Q78

The result of 17 % 5 is:

  • A2
  • B3
  • C4
  • D5
Q79

Comparison operators are used to:

  • AStore files
  • BCompare two values
  • CCreate loops only
  • DCompile code
Q80

The expression 8 > 3 evaluates to:

  • Afalse
  • Btrue
  • C8
  • D3
Q81

Logical AND returns true when:

  • AAt least one condition is true
  • BBoth conditions are true
  • CBoth conditions are false
  • DOnly the first is true
Q82

Logical OR returns false when:

  • ABoth conditions are false
  • BAt least one condition is true
  • CBoth conditions are true
  • DOnly one is true
Q83

Logical NOT is used to:

  • AAdd numbers
  • BReverse a Boolean value
  • CStore strings
  • DMultiply values
Q84

Operator precedence determines:

  • AWhere output appears
  • BWhich operator is evaluated first
  • CHow files are opened
  • DHow many variables exist
Q85

Parentheses in expressions are useful because they:

  • AAlways slow programs
  • BMake intended evaluation order clear
  • CRemove variables
  • DReplace assignment
Q86

The assignment operator commonly:

  • ACompares two values
  • BStores the right-hand value in the left-hand variable
  • CEnds a loop
  • DStarts a function
Q87

Which of the following is a relational operator?

  • A*
  • B<=
  • C%
  • D+
Q88

The expression 5 == 5 is usually:

  • Afalse
  • Btrue
  • C5
  • Dan error always
Q89

Which expression checks if age is between 18 and 60 inclusive?

  • Aage > 18 || age < 60
  • Bage >= 18 && age <= 60
  • Cage = 18 to 60
  • D18 <= age or 60
Q90

Integer division commonly discards:

  • AThe quotient
  • BThe remainder or fractional part
  • CThe dividend
  • DThe operator
Q91

The result type of an expression may depend on:

  • AOnly comments
  • BThe operand types and operators used
  • CMonitor size
  • DFile name
Q92

Incrementing a variable means:

  • AReducing it by one
  • BIncreasing it by one
  • CMaking it constant
  • DConverting it to text
Q93

Compound assignment like x += 3 means:

  • Ax = x + 3
  • Bx == 3
  • Cx = 3 only
  • Dx is Boolean
Q94

A short-circuit logical operator may:

  • AEvaluate all operands always
  • BStop evaluation once the result is known
  • CDelete the second condition
  • DPrint the answer
Q95

Which of the following can cause overflow?

  • AUsing comments
  • BStoring a very large value in a small integer type
  • CDeclaring a string
  • DReading a small number
Q96

An expression is:

  • AA named memory block only
  • BA combination of values, variables, and operators that produces a result
  • CA hardware device
  • DA complete flowchart
Q97

The expression !(x > 0) means:

  • Ax is positive
  • Bx is not greater than zero
  • Cx becomes zero
  • Dx is printed
Q98

Which operator is commonly used for multiplication?

  • Ax
  • B*
  • C^
  • D@
Q99

Floating-point comparison may require care because:

  • ADecimals cannot exist
  • BRepresentation can introduce precision issues
  • CCompilers forbid it
  • DBooleans change it
Q100

The expression (a > b) ? a : b conceptually returns:

  • AThe smaller of a and b
  • BThe larger value if a>b else b
  • CA Boolean only
  • DNothing
SECTION 5: Conditional Statements and Execution Flow (Q101-Q125)
Q101

A conditional statement is used to:

  • AStore files
  • BMake decisions in a program
  • CCreate arrays only
  • DTranslate source code
Q102

The simplest selection structure is:

  • Aif statement
  • Bfor loop
  • Carray
  • Dfunction parameter
Q103

An if statement executes its block when the condition is:

  • Afalse
  • Btrue
  • Cempty
  • Dnegative only
Q104

The purpose of else is to:

  • ARepeat the condition
  • BProvide an alternate block when condition is false
  • CEnd the program
  • DCreate a variable
Q105

An else-if ladder is useful when:

  • AOnly one condition exists
  • BMultiple conditions must be tested in sequence
  • CNo condition is required
  • DUsing strings only
Q106

Nested if statements are:

  • Aif statements placed inside another if or else block
  • BAlways invalid
  • CUsed only in hardware
  • DThe same as comments
Q107

A switch-like construct is best suited for:

  • AComplex floating arithmetic only
  • BSelecting among many discrete cases of one expression
  • CAllocating memory
  • DReading files
Q108

A default case in switch is executed when:

  • AThe first case matches
  • BNo listed case matches
  • CEvery case matches
  • DThe loop ends
Q109

The condition inside an if statement should usually evaluate to:

  • AA string
  • BA Boolean result
  • CA file pointer
  • DAn array
Q110

Which structure best models pass/fail decision?

  • ASelection
  • BRecursion
  • CLinking
  • DCompilation
Q111

Dangling else problems are reduced by:

  • ARemoving indentation
  • BUsing clear block structure and braces
  • CUsing more comments only
  • DAvoiding all if statements
Q112

When multiple if statements are independent, they:

  • AMust always be nested
  • BCan all be tested separately
  • CNever execute
  • DBecome loops
Q113

A guard condition is commonly used to:

  • AHandle exceptional or invalid cases early
  • BIncrease RAM
  • CPrint the compiler
  • DStore arrays
Q114

In a switch statement, break is commonly used to:

  • ACreate recursion
  • BPrevent fall-through to the next case
  • CRead input
  • DInitialize variables
Q115

Fall-through occurs when:

  • AA function returns a value
  • BExecution continues into the next case without stopping
  • CA variable changes type
  • DThe monitor turns off
Q116

A Boolean flag variable is often used to:

  • AStore decimal fractions only
  • BRemember whether a condition/event has occurred
  • CReplace all loops
  • DOpen files
Q117

Conditional expressions help choose:

  • AA device driver
  • BOne of two values based on a condition
  • COnly loop counts
  • DObject files
Q118

To test whether a number is even, the condition commonly checks:

  • An % 2 == 0
  • Bn / 2 == 0
  • Cn > 2
  • Dn += 2
Q119

A menu-driven program often uses:

  • AOnly arrays
  • BSelection structures to respond to user choice
  • CNo input
  • DOnly comments
Q120

Which is the most appropriate construct for checking grade ranges?

  • Aif-else ladder
  • BSingle character variable only
  • CFile pointer
  • DLinker
Q121

Short nested conditions can often be improved by:

  • AMaking them deeper
  • BUsing clearer combined or structured conditions
  • CRemoving all comparisons
  • DAdding hardware
Q122

A condition such as marks >= 50 means:

  • Amarks is assigned 50
  • Bmarks is at least 50
  • Cmarks becomes Boolean
  • Dmarks is less than 50
Q123

The outcome of program flow in selection depends on:

  • APrinter model
  • BTruth value of conditions
  • CKeyboard color
  • DFile size
Q124

Selection structures help model real-world rules such as:

  • ATyping speed
  • BDiscount eligibility or admission criteria
  • CProcessor manufacturing
  • DNetwork cables
Q125

An unreachable branch is a branch that:

  • AAlways executes
  • BCan never execute because of program logic
  • CContains a loop
  • DReads input
SECTION 6: Repetition, Loops and Iterative Logic (Q126-Q150)
Q126

A loop is primarily used to:

  • ATranslate source code
  • BRepeat a set of statements
  • CStore images
  • DDeclare constants
Q127

A while loop usually continues as long as:

  • AThe condition is true
  • BThe condition is false
  • CThe file is closed
  • DThe compiler warns
Q128

A for loop is especially useful when:

  • AThe number of iterations is known or controlled by a counter
  • BNo repetition is needed
  • CWriting comments
  • DDeclaring arrays only
Q129

A do-while loop differs because it:

  • ANever checks a condition
  • BExecutes the body at least once
  • CCannot use conditions
  • DRuns only ten times
Q130

An infinite loop occurs when:

  • AThe loop condition never becomes false
  • BThe compiler is updated
  • CThe output is correct
  • DA function is declared
Q131

The loop control variable is used to:

  • AOpen files
  • BTrack progress of repetition
  • CStore only strings
  • DCompile modules
Q132

Initialization in a counted loop usually happens:

  • ABefore iterations begin
  • BAfter the program ends
  • CInside comments
  • DInside the linker
Q133

Updating the loop variable is important to:

  • AAvoid all output
  • BMove toward loop termination
  • CIncrease syntax errors
  • DCreate arrays
Q134

A nested loop is:

  • AA loop inside another loop
  • BA loop with no body
  • CA wrong program always
  • DA file operation
Q135

Which statement is commonly used to exit a loop early?

  • Aprint
  • Bbreak
  • Cchar
  • Dconst
Q136

Which statement is commonly used to skip the rest of the current iteration?

  • Acontinue
  • Breturn type
  • Ccompile
  • Dlink
Q137

A sentinel-controlled loop stops when:

  • AThe user enters a special terminating value
  • BThe CPU shuts down
  • CA compiler warning appears
  • DA library is missing
Q138

An accumulator variable is often used to:

  • AStore final code only
  • BKeep a running total
  • CCreate comments
  • DCount files
Q139

A counter variable is commonly used to:

  • AMeasure monitor size
  • BCount how many times something occurs
  • CStore strings
  • DAllocate memory
Q140

Which loop is best for reading input until -1 is entered?

  • ASentinel-controlled while loop
  • BSwitch statement
  • CArray declaration
  • DFunction prototype
Q141

Off-by-one errors in loops often happen because of:

  • AWrong monitor brightness
  • BIncorrect start or stop conditions
  • CToo many comments
  • DFile permissions
Q142

A loop invariant is a condition that:

  • ANever matters
  • BRemains true before and after each iteration
  • CEnds the loop instantly
  • DStores dynamic memory
Q143

Which task naturally uses repetition?

  • AFinding sum of 100 numbers
  • BDeclaring one variable
  • CWriting a comment
  • DClosing a file once
Q144

The time a loop runs depends on:

  • AThe loop condition and updates
  • BOnly variable names
  • COnly comments
  • DThe color theme
Q145

To compute factorial iteratively, a loop commonly uses:

  • AAn accumulator multiplied each iteration
  • BOnly input statements
  • CA switch with no cases
  • DA file pointer
Q146

When a loop condition is checked before the body, the loop may execute:

  • AAt least once
  • BZero times
  • CExactly once
  • DInfinite times only
Q147

A body of a nested inner loop completes:

  • ABefore the outer loop starts
  • BFor each iteration of the outer loop
  • COnly once at the end
  • DNever
Q148

Which loop is usually preferred for traversing indices from 0 to n-1?

  • Afor loop
  • Bswitch statement
  • Ccomment block
  • Dlinker phase
Q149

A repeated input-validation pattern commonly uses:

  • AA loop until valid data is entered
  • BOnly a constant
  • CA pointer arithmetic rule
  • DA header file
Q150

The statement total += value inside a loop typically:

  • AReduces total randomly
  • BAdds each new value to a running sum
  • CCreates a new variable each time
  • DEnds the loop
SECTION 7: Lists, Arrays and Multidimensional Lists (Q151-Q175)
Q151

An array or list stores:

  • AOnly one value always
  • BMultiple values of the same general type under one name
  • COnly characters
  • DOnly files
Q152

Elements in an array are usually accessed by:

  • APassword
  • BIndex or position
  • CCompiler phase
  • DFile extension
Q153

In many languages, the first array index is:

  • A1
  • B0
  • C-1
  • DDepends only on hardware
Q154

Array elements are typically stored in memory:

  • ARandomly
  • BContiguously
  • COnly in ROM
  • DInside comments
Q155

The size of a fixed array commonly means:

  • AIts color
  • BNumber of elements it can hold
  • CIts address
  • DIts data type only
Q156

Accessing an array out of bounds may:

  • AAlways be safe
  • BCause errors or undefined behavior
  • CPrint the entire array
  • DIncrease speed
Q157

Traversing an array means:

  • ADeleting it
  • BProcessing elements one by one
  • CCompiling it
  • DLinking libraries
Q158

A common use of arrays is to:

  • AStore a collection of marks or prices
  • BReplace all conditions
  • CTranslate source code
  • DControl the printer
Q159

The length of an array is important because it:

  • ADetermines safe iteration limits
  • BChanges the keyboard layout
  • CMakes all values equal
  • DRemoves loops
Q160

Searching an unsorted array linearly means:

  • AChecking elements one by one
  • BUsing only recursion
  • CComparing first and last only
  • DSorting automatically
Q161

Updating one array element requires:

  • AThe correct index
  • BA new compiler
  • CA file stream
  • DNo assignment
Q162

A two-dimensional array can represent:

  • AOnly a sentence
  • BA table or matrix of rows and columns
  • CA single Boolean
  • DA compiled executable
Q163

In matrix notation, arr[i][j] commonly refers to:

  • AOne row only
  • BElement at row i and column j
  • CEntire file
  • DA function call
Q164

Row-major style access generally processes:

  • AColumns first always
  • BAll columns of a row before moving to the next row
  • CRandom cells only
  • DOnly diagonal values
Q165

A list operation that adds an item at the end is called:

  • AAppend/insert at end
  • BCompile
  • CDereference
  • DDeallocate
Q166

Parallel arrays are used when:

  • ARelated information is stored in separate arrays with matching indices
  • BArrays are always unequal
  • CFiles are merged
  • DUsing recursion only
Q167

The average of values in an array is computed by:

  • AMultiplying all values
  • BSumming values then dividing by count
  • CTaking the first value
  • DUsing a switch
Q168

An array name often represents:

  • AThe address/location of the first element
  • BThe last element only
  • CA compiler error
  • DA string constant only
Q169

Which structure is suitable for storing marks of 5 students in 3 subjects?

  • A3×5 or 5×3 two-dimensional array
  • BSingle Boolean variable
  • COnly one integer
  • DA switch statement
Q170

Copying all values from one array to another usually requires:

  • AElement-wise processing or a built-in copy mechanism
  • BNo effort
  • COnly a comment
  • DA linker
Q171

Sorting an array means:

  • ADeleting repeated elements always
  • BArranging elements in a desired order
  • CPrinting one value
  • DReading from file
Q172

The highest valid index of an array of size n in many languages is:

  • An
  • Bn+1
  • Cn-1
  • D1
Q173

A jagged list differs from a rectangular 2D array because:

  • AAll rows have exactly same length
  • BRows may have different lengths
  • CIt stores only strings
  • DIt cannot be traversed
Q174

When passing an array to a function, programmers often also pass:

  • AThe monitor size
  • BIts length/size information
  • CA printer command
  • DOnly comments
Q175

A histogram of frequencies can be implemented using:

  • AAn array of counts
  • BA single if statement
  • COnly a string
  • DNo memory
SECTION 8: Functions, Modular Programming and Program Stack (Q176-Q200)
Q176

A function is used to:

  • ABreak a program into reusable modules
  • BReplace all variables
  • CStore images only
  • DStop compilation
Q177

Function definition contains:

  • AOnly the function name
  • BThe code that specifies what the function does
  • COnly comments
  • DOnly return statement
Q178

A function call means:

  • ADeleting the function
  • BInvoking the function to execute
  • CChanging hardware
  • DSaving a file
Q179

A parameter is:

  • AA value supplied to printer
  • BA variable in the function header receiving input
  • CAn output window
  • DA bug type
Q180

An argument is:

  • AThe actual value passed to a function
  • BThe same as comment
  • CA reserved keyword always
  • DA stack frame only
Q181

A return value is:

  • AText written in comments
  • BThe result sent back by a function
  • CAlways an integer
  • DThe function name
Q182

A void function generally:

  • AReturns no explicit value
  • BReturns many values
  • CCannot be called
  • DMust read files
Q183

Modular programming improves:

  • ACode organization and reusability
  • BSyntax errors
  • CHardware temperature
  • DTyping noise
Q184

Local variables are typically accessible:

  • AEverywhere in the program
  • BOnly inside the function/block where they are declared
  • COnly in libraries
  • DOnly after compilation
Q185

Global variables are generally accessible:

  • AWithin a wider program scope
  • BOnly inside one loop
  • COnly in comments
  • DNever
Q186

Recursion occurs when a function:

  • ACalls itself directly or indirectly
  • BContains no parameters
  • CUses only arrays
  • DHas no return value
Q187

A base case in recursion is important because it:

  • AMakes recursion infinite
  • BStops recursive calls eventually
  • CStores global memory
  • DCreates object code
Q188

The call stack is used to keep track of:

  • APrinters and scanners
  • BActive function calls and local data
  • COnly global variables
  • DComments
Q189

Stack unwinding in recursion happens when:

  • ANew calls are added
  • BFunctions finish and return back through previous calls
  • CA file is opened
  • DThe program is compiled
Q190

Function prototype or declaration tells the compiler:

  • AThe full algorithm always
  • BThe function name, return type, and parameters before use
  • CThe file path
  • DThe monitor model
Q191

Passing by value means:

  • AThe function receives a copy of the argument
  • BThe original variable is always changed
  • CNo memory is used
  • DOnly arrays can be passed
Q192

Passing by reference/address allows a function to:

  • AIgnore the argument
  • BModify the original variable
  • CRun without parameters
  • DAvoid return statements
Q193

A pure function is desirable when it:

  • AProduces output without side effects for same input
  • BUses global variables heavily
  • CAlways reads files
  • DNever returns a result
Q194

The main benefit of helper functions is that they:

  • AIncrease duplication
  • BEncapsulate repeated tasks
  • CPrevent testing
  • DReplace loops
Q195

Which function design is better?

  • AOne giant function of 500 lines
  • BSmall focused functions with clear purpose
  • CA function with no name
  • DOnly recursive functions
Q196

To compute the area of a circle several times, the best approach is to:

  • ARewrite formula everywhere
  • BCreate a reusable function
  • CUse only global variables
  • DUse switch
Q197

Default parameters, where supported, allow:

  • AArguments to be omitted when suitable default values exist
  • BFunctions to return multiple types always
  • CNo compilation
  • DNo parameters ever
Q198

Function overloading, where supported, means:

  • AOne name can have multiple parameter variations
  • BA function crashes the stack
  • CFunctions use too much memory
  • DThe linker is skipped
Q199

A stack overflow may happen because of:

  • AVery deep or infinite recursion
  • BToo many comments
  • CUsing constants
  • DReading one integer
Q200

Returning early from a function is often useful to:

  • AHandle invalid cases clearly
  • BAvoid all logic
  • CReplace parameters
  • DCreate dynamic memory
SECTION 9: Strings and String Operations (Q201-Q225)
Q201

A string is:

  • AA single numeric value
  • BA sequence of characters
  • CA Boolean flag
  • DA loop counter
Q202

The null terminator in C-style strings is used to:

  • ADouble the length
  • BMark the end of the string
  • CStore the first character
  • DBegin a file
Q203

The length of a string usually means:

  • AIts memory address
  • BNumber of characters it contains
  • CIts first index only
  • DIts file size
Q204

Concatenation means:

  • AComparing two strings
  • BJoining strings together
  • CSorting characters
  • DDeleting spaces
Q205

String comparison checks whether:

  • ATwo strings have same or ordered content
  • BBoth are integers
  • CThey use same memory size only
  • DA file exists
Q206

A substring is:

  • AA whole program
  • BA part of a string
  • CA compiler message
  • DA type of pointer only
Q207

Iterating through a string means:

  • ADeleting the string
  • BProcessing characters one by one
  • CConverting to float only
  • DOpening a text file
Q208

Which task is a common string operation?

  • ACounting vowels
  • BAllocating CPU
  • CLinking modules
  • DChanging RAM type
Q209

Whitespace in a string may include:

  • AOnly letters
  • BSpaces, tabs, and newline characters
  • CNumbers only
  • DComments only
Q210

A common issue while reading strings is:

  • ABuffer size limitations or leftover newline input
  • BThe CPU disappears
  • CFunctions stop existing
  • DArrays cannot store chars
Q211

Case conversion changes:

  • ANumbers to files
  • BUppercase letters to lowercase or vice versa
  • CStrings to arrays only
  • DPointers to references
Q212

A palindrome string reads:

  • ADifferently backward
  • BThe same forward and backward
  • COnly left to right
  • DOnly in binary
Q213

Lexicographic order for strings is similar to:

  • ARandom order
  • BDictionary order
  • CReverse memory order
  • DLoop order
Q214

Trimming a string usually removes:

  • AAll characters
  • BUnwanted spaces from beginning/end
  • CThe null terminator only
  • DMiddle letters only
Q215

Inputting a full sentence may require:

  • AReading until whitespace only
  • BA method that accepts spaces
  • COnly integer input
  • DNo variables
Q216

A mutable string is one that:

  • ACannot be changed
  • BCan be modified after creation
  • CExists only in files
  • DIs always global
Q217

String indexing accesses:

  • AOnly the last character
  • BIndividual characters by position
  • CThe compiler state
  • DThe function return type
Q218

Escaped characters such as \n are used for:

  • AMemory allocation
  • BSpecial character representations like newline
  • CArray sorting
  • DLogical operations
Q219

To count words in a sentence, a program often examines:

  • AOnly the first character
  • BSpaces/separators and transitions between words
  • COnly digits
  • DThe linker output
Q220

A common use of strings in real applications is:

  • AUser names and messages
  • BCPU clock speed
  • CPrinter cables
  • DHeat sink design
Q221

Copying one string into another must consider:

  • AEnough storage space in the destination
  • BOnly screen size
  • COnly compiler version
  • DNothing
Q222

String parsing means:

  • AReading and extracting meaningful pieces from text
  • BDeleting all text
  • CCompiling comments
  • DClosing files
Q223

Which structure is often used to store a line of text?

  • ACharacter array or string object
  • BOnly integer variable
  • CSwitch case
  • DA pointer to CPU
Q224

A delimiter in text processing is:

  • AA hidden bug
  • BA character separating parts, such as comma
  • CA loop index
  • DA return type
Q225

Reversing a string produces:

  • AA sorted list
  • BThe characters in opposite order
  • CA numeric result only
  • DA file stream
SECTION 10: Pointers, References and Static Memory Concepts (Q226-Q250)
Q226

A pointer stores:

  • AA character only
  • BThe address of another variable
  • CA compiled program
  • DA loop condition
Q227

The address-of operator is commonly used to:

  • AGet the memory address of a variable
  • BMultiply values
  • CCreate files
  • DDisplay output
Q228

Dereferencing a pointer means:

  • ADestroying it
  • BAccessing the value stored at the pointed address
  • CCompiling it
  • DComparing it with a string
Q229

A null pointer is a pointer that:

  • APoints to valid data
  • BDoes not currently point to a valid object
  • CStores text
  • DAlways points to zero index array
Q230

Using an uninitialized pointer can:

  • ABe perfectly safe always
  • BCause serious runtime errors
  • CImprove efficiency
  • DRemove syntax errors
Q231

Pass-by-reference is useful when:

  • AA function should modify the original argument efficiently
  • BNo parameters exist
  • COnly strings are used
  • DWriting comments
Q232

A reference in C++ is best thought of as:

  • AAnother name for an existing variable
  • BA new unrelated variable
  • CA file descriptor
  • DA keyword for loops
Q233

Pointer arithmetic depends on:

  • AOnly keyboard type
  • BThe size of the pointed data type
  • CComment length
  • DCompiler theme
Q234

An array name in many contexts can decay to:

  • AA Boolean value
  • BA pointer to its first element
  • CA string literal
  • DA file stream
Q235

The expression *p = 10 means:

  • APointer p becomes ten
  • BThe value at address stored in p becomes 10
  • Cp is compared with 10
  • DA file is closed
Q236

Which is a safe practice with pointers?

  • ADereference before initialization
  • BInitialize pointers properly before use
  • CPoint to random memory
  • DIgnore null checks
Q237

A dangling pointer refers to:

  • AA pointer to currently valid memory
  • BA pointer to memory that is no longer valid
  • CA pointer stored globally
  • DA constant pointer only
Q238

A constant pointer commonly means:

  • AThe value pointed to cannot change
  • BThe pointer address itself cannot change after initialization
  • CIt stores only constants
  • DIt cannot be dereferenced
Q239

A pointer to constant commonly means:

  • AThe pointed value should not be modified through that pointer
  • BThe pointer cannot move
  • CThe address is zero
  • DThe data is dynamic
Q240

References are often considered safer than raw pointers because they:

  • ACan be null freely
  • BUsually must refer to a valid object once bound
  • CUse no memory
  • DReplace arrays
Q241

Which situation needs a pointer most naturally?

  • AStoring an address for dynamic memory
  • BAdding two integers
  • CWriting a comment
  • DDisplaying a menu
Q242

The symbol -> is commonly used to:

  • ASubtract numbers
  • BAccess members through a pointer to a structure/object
  • CCreate loops
  • DOpen files
Q243

Memory aliasing occurs when:

  • ATwo names refer to the same memory location
  • BA variable becomes constant
  • CA string is reversed
  • DA file is renamed
Q244

A static local variable usually:

  • AIs recreated from scratch on every call only
  • BRetains its value between function calls
  • CExists only in arrays
  • DCannot be initialized
Q245

Automatic storage duration typically belongs to:

  • ALocal non-static variables
  • BExecutable files
  • CGlobal constants only
  • DHeaders
Q246

Which mistake can lead to segmentation faults?

  • AProper initialization
  • BDereferencing null or invalid pointers
  • CUsing comments
  • DDeclaring integers
Q247

Swapping two values inside a function without return values often uses:

  • APointers or references
  • BOnly comments
  • CA compiler flag
  • DA string literal
Q248

The size of a pointer is generally:

  • AIndependent of pointed value content but dependent on platform
  • BAlways 1 byte
  • CAlways equal to array length
  • DAlways larger than RAM
Q249

A pointer variable itself is stored:

  • ANowhere
  • BIn memory like other variables
  • COnly in the CPU forever
  • DInside the linker
Q250

Before freeing or deleting memory, programmers should ensure:

  • AThe pointer refers to dynamically allocated valid memory
  • BThe value is printed
  • CThe compiler is closed
  • DThe monitor is on
SECTION 11: Dynamic Memory Allocation and File I/O (Q251-Q275)
Q251

Dynamic memory allocation allows memory to be obtained:

  • AOnly at compile time
  • BAt runtime as needed
  • COnly from ROM
  • DOnly by the linker
Q252

One reason to use dynamic memory is when:

  • AThe required size is known exactly at compile time always
  • BData size is determined during execution
  • CNo variables exist
  • DOnly integers are used
Q253

A memory leak happens when:

  • AAllocated memory is not released after it is no longer needed
  • BA file is renamed
  • CThe compiler optimizes code
  • DA loop ends
Q254

Deallocating dynamic memory is important to:

  • AWaste resources
  • BReturn memory to the system
  • CCreate strings
  • DStart recursion
Q255

Which is a common danger after freeing memory?

  • AThe pointer becomes longer
  • BUsing the freed memory again through a dangling pointer
  • CComments disappear
  • DArrays become 2D
Q256

A dynamic array is useful when:

  • AArray size must change or be decided at runtime
  • BThe size is always fixed and tiny
  • CNo loops are used
  • DOnly chars are stored
Q257

A file is a means of:

  • ATemporary CPU storage only
  • BStoring data permanently on secondary storage
  • CCompiling code
  • DDrawing flowcharts
Q258

Opening a file in read mode allows a program to:

  • ACreate new processor instructions
  • BRetrieve data from an existing file
  • COnly write data
  • DDelete memory
Q259

Opening a file in write mode commonly:

  • ALeaves contents unchanged always
  • BCreates a new file or overwrites existing content
  • CReads without change only
  • DRuns the compiler
Q260

Append mode is used to:

  • AAdd new data at the end of an existing file
  • BRead only the first line
  • CDelete the file
  • DAllocate RAM
Q261

Before reading or writing a file, a program should:

  • ACheck that the file opened successfully
  • BRestart the computer
  • CCreate recursion
  • DSort arrays
Q262

EOF in file processing stands for:

  • AEnd of File
  • BError on Format
  • CEntry of Function
  • DExecution of File
Q263

Text files store data mainly as:

  • AHuman-readable characters
  • BRaw machine addresses only
  • CGPU signals
  • DPointers only
Q264

Binary files differ from text files because they:

  • ACannot store data
  • BStore raw bytes in compact form
  • CUse only strings
  • DNeed no opening
Q265

A file pointer/stream keeps track of:

  • AThe current position and state during file operations
  • BOnly file size
  • COnly variable names
  • DThe compiler version
Q266

Reading records from a file often uses:

  • AA loop until end of file or read failure
  • BA switch with no cases
  • COnly recursion
  • DNo variables
Q267

Writing program output to a file is useful for:

  • APersistent reports and saved data
  • BReducing algorithm logic
  • CDeleting memory
  • DAvoiding all debugging
Q268

Closing a file after use is good practice because it:

  • AMay flush buffers and release resources
  • BCreates a syntax error
  • CDeletes all data automatically
  • DPrevents any output
Q269

Serialization in simple terms means:

  • ATurning structured data into a storable/transmittable format
  • BSorting only numbers
  • CCreating arrays
  • DCompiling libraries
Q270

Which file operation is safest before processing user-provided filename?

  • ABlind trust
  • BBasic validation and error handling
  • CPointer arithmetic only
  • DIgnoring existence
Q271

Dynamic memory is often accessed through:

  • APointers
  • BComments
  • CSwitch labels
  • DOnly constants
Q272

Reallocating memory for a larger block may require:

  • AMoving/copying existing data to a new location
  • BDeleting all variables
  • CUsing only files
  • DChanging comments
Q273

A common real-world use of files in PF is:

  • ASaving student marks or inventory records
  • BCooling the CPU
  • CProducing machine code
  • DReplacing operators
Q274

Reading structured data from a file usually requires:

  • AParsing according to the stored format
  • BOnly a monitor
  • CNo loops
  • DNo variables
Q275

Failing to close output files may sometimes result in:

  • ABuffered data not being fully written
  • BImproved security
  • CNo effect ever
  • DCompiler warnings only
SECTION 12: Mixed Concepts, Tracing and Real-World Algorithm Design (Q276-Q300)
Q276

To find the largest of three numbers, an algorithm primarily needs:

  • ASelection logic
  • BOnly file I/O
  • COnly recursion
  • DA pointer to char
Q277

A program that calculates average marks should first compute:

  • AThe product of marks
  • BThe sum of marks and divide by count
  • COnly the maximum
  • DOnly the minimum
Q278

To count how many entered numbers are negative, the program needs:

  • AA counter and repetition
  • BOnly a switch
  • CNo variables
  • DOnly dynamic memory
Q279

When designing a menu-based calculator, the user choice is best handled by:

  • ASelection structure
  • BPointer arithmetic
  • CFile append only
  • DStatic memory
Q280

To reverse digits of an integer like 123 into 321, an algorithm commonly uses:

  • ALoop with remainder and division
  • BOnly arrays
  • COnly recursion always
  • DFile reading
Q281

A student result program may classify grades using:

  • Aif-else ranges
  • BOnly a compiler flag
  • COnly string trimming
  • DPointer subtraction
Q282

To test whether a year is leap year, the algorithm uses:

  • ASpecific divisibility conditions
  • BOnly addition
  • COnly file mode
  • DA random choice
Q283

A frequency-counting problem often needs:

  • AAn array of counters
  • BOnly one Boolean
  • CNo loops
  • DOnly comments
Q284

Binary search requires the data to be:

  • AUnsorted
  • BSorted
  • CStored in a file only
  • DIn two dimensions
Q285

Linear search is preferred when:

  • AData is unsorted or small
  • BData is always huge and sorted
  • CNo comparison is needed
  • DOnly files are used
Q286

Tracing a nested loop table helps determine:

  • AExecution count and logic correctness
  • BOnly variable names
  • COnly font style
  • DLinker options
Q287

A test case should ideally include:

  • ARepresentative input and expected output
  • BOnly variable declarations
  • COnly comments
  • DA new compiler
Q288

Boundary value testing focuses on:

  • ARandom colors
  • BValues near the limits of valid input
  • COnly strings
  • DOnly null pointers
Q289

An algorithm for ATM withdrawal should first check:

  • AWhether amount meets valid conditions such as balance and limits
  • BOnly output color
  • CThe file extension
  • DThe array index
Q290

To remove duplicate adjacent values from a sorted list, the algorithm commonly compares:

  • ACurrent item with previous or next item
  • BOnly the first and last item
  • COnly file names
  • DOnly pointers
Q291

A running maximum algorithm updates max when:

  • AA larger value is found
  • BA smaller value is found
  • CThe loop ends
  • DA file opens
Q292

The best structure for processing each row and column of a matrix is:

  • ANested loops
  • BSingle if statement
  • COnly recursion
  • DString concatenation
Q293

A real-world inventory algorithm may use files to:

  • APersist item names, quantities, and prices
  • BIncrease CPU cores
  • CReplace all functions
  • DAvoid input
Q294

Breaking a project into input, validation, processing, and reporting modules demonstrates:

  • AModular design
  • BMachine language
  • COnly dynamic memory
  • DA syntax error
Q295

When debugging wrong totals, a good first step is to:

  • ATrace variable values through iterations
  • BDelete all loops
  • CRewrite in assembly immediately
  • DIgnore test data
Q296

A login checker that allows three attempts naturally uses:

  • AA counted loop with condition
  • BOnly arrays
  • COnly a pointer
  • DA static file
Q297

To store names entered until user types STOP, a program may use:

  • ARepetition and a sentinel value
  • BNo input
  • COnly recursion
  • DOnly switch
Q298

An efficient design choice in beginner programming is to:

  • AReuse tested functions for repeated tasks
  • BCopy-paste logic everywhere
  • CAvoid meaningful names
  • DIgnore edge cases
Q299

When algorithm output is wrong only for zero or negative inputs, the issue is often:

  • AA missed edge case
  • BThe monitor brightness
  • CThe linker version
  • DA comment format
Q300

A complete solution to a real-world PF problem should ideally include:

  • ACorrect logic, testing, and readable implementation
  • BOnly a final answer without code
  • COnly diagrams without logic
  • DOnly file output

10 Comments

Leave a Reply

Your email address will not be published. Required fields are marked *