Thanks to visit codestin.com
Credit goes to www.scribd.com

0% found this document useful (0 votes)
22 views2 pages

Functions C++ Class12 KPK

The document provides an overview of functions in C++ for Class 12 students, covering short questions and multiple choice questions. Key topics include function definitions, prototypes, overloading, recursion, and the differences between various types of variables. It serves as a study guide for understanding fundamental concepts related to functions in C++.

Uploaded by

asif905555
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
22 views2 pages

Functions C++ Class12 KPK

The document provides an overview of functions in C++ for Class 12 students, covering short questions and multiple choice questions. Key topics include function definitions, prototypes, overloading, recursion, and the differences between various types of variables. It serves as a study guide for understanding fundamental concepts related to functions in C++.

Uploaded by

asif905555
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

Functions in C++ - Class 12 (KPK Board)

Short Questions

1. What is a function in C++?


2. What are the types of functions in C++?
3. What is the purpose of a function prototype?
4. Explain the structure of a user-defined function.
5. What is the difference between a function definition and function call?
6. Define parameters and arguments with an example.
7. What is the purpose of the return statement in a function?
8. What is a void function?
9. What is function overloading?
10. Differentiate between call by value and call by reference.
11. What is recursion in C++?
12. Explain inline functions with example.
13. What are default arguments in functions?
14. Differentiate between local and global variables.
15. What are static variables and their use in functions?

Multiple Choice Questions (MCQs)

1. Which keyword is used to define a function that returns nothing?


A. return B. void C. int D. main
Answer: B

2. What is the correct syntax of a function prototype?


A. int function(a, b); B. function int(a, b); C. int function(int, int); D. function(int, int)
Answer: C

3. What is function overloading?


A. Function with same name and different parameters
B. Function inside function
C. Multiple return types
D. Function without return
Answer: A
4. What is recursion?
A. Function calling itself B. Function returning a pointer
C. Static function D. None of these
Answer: A

5. Which of the following passes values by reference?


A. int func(int x) B. int func(int &x) C. int &func(int x) D. func(int x)
Answer: B

6. Which function retains its value between calls?


A. Inline B. Virtual C. Static D. External
Answer: C

7. What is the default return type of a function if not specified?


A. void B. int C. float D. char
Answer: B

8. What type of function does not return a value?


A. Non-returning B. Void C. Null D. Static
Answer: B

9. Which of the following is a valid inline function?


A. inline int show() B. static inline show() C. int inline show() D. extern inline show()
Answer: A

10. Where are local variables declared?


A. Inside main() only B. Outside all functions C. Inside a function D. Anywhere
Answer: C

You might also like