Programming Fundamentals MCQs (Set-3)

What does a function help provide?

A Permanent data storage
B Reusable named behavior
C A processor instruction set
D A network connection

What is recursion?

A A function calls itself
B A loop assigns a value
C An array stores text
D A compiler reads a file

What must recursion include to stop?

A A base case
B A global variable
C A nested class
D A file handle

What may happen without a reachable base case?

A The compiler sorts variables
B Calls continue until resources fail
C The array becomes immutable
D The loop skips its body

What does a call stack track?

A Sorted array values
B Open network routes
C Compiled source files
D Active function calls

What is an array?

A Single Boolean value
B Function parameter list
C Indexed collection of elements
D Program execution trace

In a zero based array, what is the first index?

A 1
B 0
C Minus one
D Array length

What is an array bound?

A Valid index range
B Number of source files
C Function's return type
D Loop's update rule

What is an out of bounds access?

A Reading a valid input
B Calling a declared function
C Using an invalid array index
D Comparing equal values

What is a string commonly used for?

A A single Boolean state
B A loop counter only
C A memory address only
D A sequence of characters

Why can string length differ from visible symbols?

A Strings always end in spaces
B Letters have different colors
C Encoding uses multiple units
D A string stores one symbol

What does a string terminator indicate in C?

A Start of a function
B Maximum array index
C End of character sequence
D Compiler warning level

What is a pointer in languages such as C?

A A loop control keyword
B A text encoding
C A Boolean operator
D Value that stores an address

What does dereferencing a pointer do?

A Changes the source language
B Accesses the pointed to value
C Counts array elements
D Terminates the program

What is a null pointer used to represent?

A The first array element
B No valid object address
C A true Boolean value
D A function return code only

What is a dangling pointer?

A Valid array pointer
B Pointer passed as an argument
C Pointer with a constant address
D Expired object address

What is a memory leak?

A Comment syntax issue
B A slow network connection
C Oversized source file
D Unreleased unreachable allocation

What is parameter passing by value?

A Function receives source text
B Function always edits caller variable
C Receives copied value
D Function skips the parameter

What may pass by reference allow?

A Function to modify caller's object
B Function to erase source code
C Function to skip execution
D Change function return type

What does a pure function avoid?

A Observable side effects
B Input parameters
C Return values
D Local expressions

What does a function prototype provide in C?

A Executable machine code
B Array contents
C Function signature declaration
D A debugger breakpoint

What is an overload in languages that support it?

A Same name, different signatures
B Function calling itself
C Function without a body
D Variable with multiple values

What is a default argument?

A Value returned by every function
B Compiler's default file
C A global loop counter
D Argument value used when omitted

What does a lambda commonly represent?

A Small anonymous function
B Named storage device
C Infinite loop
D Array boundary

What is an exception?

A A normal function parameter
B Signal representing an abnormal condition
C An array dimension
D A compile time constant