PRACTICE • LEARN • GROW
Module 3 Final Quiz: Functions & Arrays MCQs
Solve topic-wise placement questions and improve your skills.
Module 3 Final Quiz: Functions & Arrays Progress
0 of 12 completed
0%
Topic Track
You are viewing MCQs in preview mode. Log in to select options, submit answers, and track your progress.
Log In to Answer
1
What four parts comprise every standard C++ function definition?
A.
Class, object, pointer, reference
B.
Return type, function name, parameter list, and body
C.
Header, footer, body, namespace
D.
Constructor, destructor, operator, template
Explanation & Key
Correct Answer:
2
What criteria must be met for valid function overloading in C++?
A.
Functions must have different return types only
B.
Functions must share the same name but differ in parameter count or parameter types
C.
Functions must belong to different namespaces
D.
Functions must have different inline specifiers
Explanation & Key
Correct Answer:
3
What happens when a caller omits an argument that has a defined default value?
A.
The compiler throws an error
B.
The parameter takes the default fallback value specified in the function declaration
C.
The parameter receives null or garbage memory
D.
The function body does not execute
Explanation & Key
Correct Answer:
4
What is pushed onto the Call Stack when a C++ function is invoked?
A.
A new thread
B.
A stack frame (activation record) containing parameters, local variables, and return address
C.
The entire source code of the program
D.
A heap allocation table
Explanation & Key
Correct Answer:
5
Why does infinite or excessively deep recursion lead to a crash?
A.
The heap runs out of memory
B.
The fixed-size call stack exhausts its allocated memory, causing a 'stack overflow'
C.
The operating system terminates the process due to a missing semicolon
D.
The CPU cache overheats
Explanation & Key
Correct Answer:
6
What is the defining memory characteristic of a C++ array?
A.
Elements are scattered across heap memory connected via pointers
B.
Elements of the same type are stored in one contiguous, back-to-back block of memory
C.
Array size can grow dynamically at runtime
D.
Elements can hold different data types simultaneously
Explanation & Key
Correct Answer:
7
Given int arr[5] stored starting at memory address 1000 (where sizeof(int) == 4), what is the memory address of arr[3]?
A.
1003
B.
1008
C.
1012
D.
1016
Explanation & Key
Correct Answer:
8
What character terminates every C-style string in memory?
A.
'\n'
B.
'\0' (null character)
C.
' ' (space)
D.
EOF
Explanation & Key
Correct Answer:
9
What is the primary advantage of std::string over raw C-style char arrays?
A.
std::string uses less memory than char arrays
B.
std::string automatically manages its own heap memory, resizes dynamically, and provides built-in concatenation and bounds checking
C.
std::string cannot be modified after creation
D.
std::string compiles faster than char arrays
Explanation & Key
Correct Answer:
10
Given int grid[2][3] = {{1, 2, 3}, {4, 5, 6}};, what does grid[1][0] evaluate to?
A.
1
B.
2
C.
4
D.
5
Explanation & Key
Correct Answer:
11
What is the return type of a function that does not return any value back to its caller?
A.
null
B.
void
C.
int
D.
empty
Explanation & Key
Correct Answer:
12
What is the output of the following code snippet?
int arr[] = {10, 20, 30};
cout << sizeof(arr) / sizeof(arr[0]);
A.
3
B.
12
C.
4
D.
Compilation Error
Explanation & Key
Correct Answer:
Question Palette
Answered
Current
Not Attempted
Wrong