Skip to main content

Functions And Procedures In C Plus Plus — Part 1 MCQs with Explanations

Practice high-yield Programming & Software Development MCQs on Functions And Procedures In C Plus Plus — Part 1 with worked academic solutions for FPSC, PPSC, NTS, NITB, PTS.

Questions
40
Difficulty Level
Exam-Level
Target Exams
FPSC, PPSC, NTS...
Estimated Time
48 mins
Exam-Level FPSC PPSC NTS NITB PTS
Verified for Commission Syllabus • Oct 14, 2026
40

Verified Practice Questions

Interactive test mode with detailed academic worked solutions

Live Progress | 0/40 answered
✓ 0 correct ✗ 0 wrong 0% score
Question 1 of 40
★ FPSC ★ PPSC

What is the output of the following code: int square(int x) { return x * x; } int main() { cout << square(3) + square(2); } in C++?

Question 2 of 40
★ FPSC ★ PPSC

What will be the output of the following code: int max(int a, int b) { return (a > b) ? a : b; } cout << max(5, 3); in C++?

Question 3 of 40
★ FPSC ★ PPSC

What is the correct syntax for defining a function in C++?

Question 4 of 40
★ FPSC ★ PPSC

What is the purpose of a function prototype in C++?

Question 5 of 40
★ FPSC ★ PPSC

Which keyword is used to define a function in C++ that does not return any value?

Question 6 of 40
★ FPSC ★ PPSC

What is the correct way to call a function named "add" that takes two parameters in C++?

Question 7 of 40
★ FPSC ★ PPSC

What does the 'return' statement do in a function in C++?

Question 8 of 40
★ FPSC ★ PPSC

What is the output of the following code: int sum(int a, int b) { return a + b; } cout << sum(3, 5); in C++?

Question 9 of 40
★ FPSC ★ PPSC

Which of the following is true about function overloading in C++?

Question 10 of 40
★ FPSC ★ PPSC

What is the purpose of default arguments in C++ functions?

Question 11 of 40
★ FPSC ★ PPSC

What is the correct syntax for declaring a function prototype in C++?

Question 12 of 40
★ FPSC ★ PPSC

What is the purpose of passing arguments by reference in C++ functions?

Question 13 of 40
★ FPSC ★ PPSC

What is the correct syntax for defining a recursive function in C++?

Question 14 of 40
★ FPSC ★ PPSC

What is the purpose of a function header in C++?

Question 15 of 40
★ FPSC ★ PPSC

Which of the following is true about function recursion in C++?

Question 16 of 40
★ FPSC ★ PPSC

What is the purpose of a function in C++?

Question 17 of 40
★ FPSC ★ PPSC

Which of the following is true about function parameters in C++?

Question 18 of 40
★ FPSC ★ PPSC

What is the correct way to declare a function in C++ that takes no parameters and returns an integer?

Question 19 of 40
★ FPSC ★ PPSC

What is the purpose of the 'void' keyword in a function declaration in C++?

Question 20 of 40
★ FPSC ★ PPSC

What is the output of the following code: int multiply(int x, int y) { return x * y; } int main() { cout << multiply(3, 4); } in C++?

Question 21 of 40
★ FPSC ★ PPSC

Which of the following is a valid function declaration in C++?

Question 22 of 40
★ FPSC ★ PPSC

What is the purpose of function overloading in C++?

Question 23 of 40
★ FPSC ★ PPSC

What does the 'inline' keyword do in C++ function declaration?

Question 24 of 40
★ FPSC ★ PPSC

What is the output of the following code: int max(int a, int b) { return (a > b) ? a : b; } int main() { cout << max(5, 5); } in C++?

Question 25 of 40
★ FPSC ★ PPSC

In C++, how are function arguments passed by default?

Question 26 of 40
★ FPSC ★ PPSC

What is the purpose of the 'static' keyword in a function declaration in C++?

Question 27 of 40
★ FPSC ★ PPSC

What is the syntax for defining a recursive function in C++?

Question 28 of 40
★ FPSC ★ PPSC

What will be the output of the following code: int add(int x, int y) { return x + y; } int main() { cout << add(2); } in C++?

Question 29 of 40
★ FPSC ★ PPSC

What is the purpose of the 'extern' keyword in a function declaration in C++?

Question 30 of 40
★ FPSC ★ PPSC

What is the correct way to pass an array to a function in C++?

Question 31 of 40
★ FPSC ★ PPSC

What is the purpose of the 'static' keyword in a C++ function?

Question 32 of 40
★ FPSC ★ PPSC

What does the 'void' keyword represent in the function declaration in C++?

Question 33 of 40
★ FPSC ★ PPSC

Which of the following is true about inline functions in C++?

Question 34 of 40
★ FPSC ★ PPSC

What is the output of the following code: int add(int a, int b) { return a + b; } int sum = add(3, 5); cout << sum; in C++?

Question 35 of 40
★ FPSC ★ PPSC

In C++, what is the significance of the function return type 'auto'?

Question 36 of 40
★ FPSC ★ PPSC

What is the purpose of the 'friend' keyword in a C++ function declaration?

Question 37 of 40
★ FPSC ★ PPSC

What is the syntax for declaring a function that takes a variable number of arguments in C++?

Question 38 of 40
★ FPSC ★ PPSC

What is the output of the following code: int x = 5; cout << "Before: " << x; changeValue(x); cout << "After: " << x; in C++?

Question 39 of 40
★ FPSC ★ PPSC

What is the correct syntax for defining a function template in C++?

Question 40 of 40
★ FPSC ★ PPSC

What is the purpose of the 'const' keyword in a function parameter list in C++?

✓ Link copied to clipboard
Continue Your Practice

Advance Html — Part 1

Master the next curriculum module with 40 exam-standard MCQs.

Next Practice Set →

💡 Examiner's Advisory for Programming & Software Development

In competitive commission exams (FPSC, PPSC, KPPSC, SPSC, CSS, PMS), questions are frequently phrased with distractor options designed to catch rote learners. Whenever you answer an MCQ, read the Detailed Academic Explanation and Conceptual Anchor to understand why the remaining options are incorrect.

More Modules in Programming & Software Development

View All →
📚

Study Guides

Topic summaries and syllabus breakdown

Explore Guides →
🎯

Complete Library

Search through 78,000+ verified MCQs

Browse Library →
📱

Mobile App

Offline mock tests and instant bookmarks

Get Mobile App →