Home Tuitions

Chapter-User Defined Functions

Important MCQ questions for Class 11 Computer Science Chapter-User Defined Functions

Get Important MCQ questions for Class 11 Computer Science Chapter-User Defined Functions with a detailed explanation of all the MCQ questions asked from Chapter-User Defined Functions prepared by the experts. 

Get Selected MCQ-based questions with solutions for Chapter-User Defined Functions

MCQ Questions set-1 for chapter-User Defined Functions class 11 Computer Science 

Computer Science - MCQ on User Defined Functions

Class XI

Q. 1. A named unit of a group of program statements that can be invoked from other parts of the program, is known as a

a. function.

b. prototype.

c. document.

d. argument.

Answer:

(a)

Explanation: A function is a subprogram that acts on the data and often returns a value.

Q. 2. A declaration that tells the program about the type of the return value of the function, is known as a

a. function.

b. prototype.

c. document.

d. argument.

Answer:

(b)

Explanation: A function prototype is a declaration of a function, that tells the program about the type of the value returned by the function and the number and type of arguments received by it.

Q. 3. A function prototype is also known as

a. function documentation.

b. function argument.

c. function declaration.

d. function reference.

Answer:

(c)

Explanation: A function prototype is a declaration of a function, that tells the program about the type of the value returned by the function and the number and type of arguments received by it.

Q. 4. A function declaration along with the body-of-the-function make the

a. function argument.

b. function documentation.

c. function definition.

d. function prototype.

Answer:

(c)

Explanation: The general form of a function definition is given by

type function-name(parameter list) {Body of the function}

Q. 5. The program part in which a particular piece of code or a data value can be accessed, is known as the

a. program prototype.

b. program declaration.

c. variable’s scope.

d. variable declaration.

Answer:

(c)

Explanation: The scope decides, in which part of the program a particular piece of code would be known and can be accessed therein.

Q. 6. The variables or values passed to a function are known as

a. parameters.

b. arguments.

c. formal parameters.

d. function call.

Answer:

(b)

Explanation:Actual parameters are the variables or expressions referenced in the parameter list of a subprogram call.

Q. 7. The variables that receive the incoming values in a function, are known as

a. actual parameters.

b. formal parameters.

c. functional parameters.

d. global parameters

Answer:

(b)

Explanation: Formal parameters are the variables declared in the parameter list of a subprogram (such as a procedure or a function) specification.

Q.8. A variable available to all the functions of a program, is known as a

a. global variable.

b. local variable.

c. reference variable.

d. variable’s scope.

Answer:

(a)

Explanation: In computer programming, a global variable is a variable that is accessible in every scope.

Q. 9. A variable available to a particular block only, is known as a

a. global variable.

b. local variable.

c. reference variable.

d. variable’s scope.

Answer:

(b)

Explanation: In computer science, a local variable is a variable that is given local scope. Such a variable is accessible only from the function or block in which it is declared.

Q. 10. Alias name of a variable, is known as

a. scope.

b. function.

c. reference.

d. prototype.

Answer:

(c)

Explanation: A reference is an alias or an alternative name for an object. All the operations applied to a reference act on the object to which the reference refers.

Q. 11. When the inside of a function is hidden from everything outside
it, then this is known as

a. closed function.

b. information hiding.

c. unclear function.

d. function encapsulation.

Answer:

(b)

Explanation: Information hiding in computer science is the principle of hiding of design decisions in a computer program, that are most likely to change, thus protecting other parts of the program from change, if the design decision is changed.

Q. 12. The number of kinds of scope, provided by C++ is

a. two.

b. three.

c. four.

d. five.

Answer:

(c)

Explanation: C++ provides four kinds of scope: local, function, file and class.

Q. 13. One of the kind of scope provided by C++, is

a. folder.

b. global.

c. object.

d. class.

Answer:

(d)

Explanation: The name of a class member has a class scope and is local to its class.

Q. 14) The time interval for which, a particular variable or data value lives in the memory is called

a. life scope of the variable.

b. active period of the variable.

c. lifetime of the variable.

d. timer of the variable.

Answer:

(c)

Explanation: A variable’s lifetime is its parent-block-run, i.e., as long as its parent block is executing, the variable lives in the memory.

Q. 15. The number of ways to change a variable in a statement that calls a function, are

a. two.

b. three.

c. four.

d. five.

Answer:

(a)

Explanation: The two ways are: using a reference parameter and using a value returning function with an assignment statement.

MCQ Questions set-2 for chapter-User Defined Functions class 11 Computer Science 

Q. 16. The three steps required in using a function in C++, are

a. function declaration, function definition, function prototype.

b. function declaration, function definition, function call.

c. function declaration, function creation, function prototype.

d. function declaration, function deletion, function prototype.

Answer:

(b)

Explanation: Function declaration is required to specify the function’s interface to a program. Function definition is required to tell the program about what and how a function is doing. Function call is required to invoke the function.

Q. 17. The types of functions in C++ are

a. two.

b. three.

c. four.

d. five.

Answer:

(b)

Explanation: There are three types of functions in C++ - computational functions, manipulative functions and procedural functions.

Q. 18. The functions that perform an action and have no explicit return value, are known as

a. computational functions.

b. manipulative functions.

c. procedural functions.

d. declarative functions.

Answer:

(c)

Explanation: When the function performs some action and has no return type, it is known as a procedural function. For example: exit( ) function.

Q. 19. The functions that change the information and return a success or failure code, are known as

a. computational functions.

b. manipulative functions.

c. procedural functions.

d. declarative functions.

Answer:

(b)

Explanation: Manipulative functions are the functions that manipulate the information and return a success or failure code. If 0 is returned it denotes successful operation, any other number denotes failure.

Q. 20. The functions that calculates some value and return a calculated value, are known as

a. computational functions.

b. manipulative functions.

c. procedural functions.

d. declarative functions.

Answer:

(a)

Explanation: The functions that compute some value and return the calculated value, are known as computational functions. For example, sqrt( ) and cos( ).

Q. 21. A fast automatic variable that is stored inside a CPU register rather in memory is known as

a. global variable.

b. local variable.

c. register variable.

d. static variable.

Answer:

(c)

Explanation: Register variables are a special case of automatic variables. Automatic variables are allocated storage in the memory of the computer; however, for most computers, accessing data in memory is considerably slower than processing in the CPU.s

Q. 22. A local variable that is not destroyed on exit from the function and retains its value throughout the program run is called

a. referenced variable.

b. static variable.

c. private variable.

d. protected variable.

Answer:

(b)

Explanation:A static variable, also referred to as a class variable, is a variable, which exists across an instance of a class.

Q. 23. The statement which is used to terminate a function whether it returns a value or not, is known as

a. break statement.

b. reverse statement.

c. return statement.

d. default statement.

Answer:

(c)

Explanation: In computer programming, a return statement causes execution to leave the current subroutine and resume at a point in the code immediately after, where the subroutine was called— known as its return address.

Q.24. The first line of a function definition is the

a. function space.

b. function declarator.

c. function initiator.

d. function definition.

Answer:

(b)

Explanation: A function declarator is the function name followed by a parenthesised list of parameter types and names of each parameter that the function expects.

Q.25. The number of values, a function can return is

a. one.

b. two.

c. zero.

d. infinite.

Answer:

(a)

Explanation: All functions except those of the type void return a value. The return statement explicitly specifies this value.

Q.26. A static automatic variable is used to

a. make a variable visible to several functions.

b. make a variable visible to only one function.

c. conserve memory when a function is not executing.

d. retain a value when a function is not executing.

Answer:

(d)

Explanation: A special type of local variable, called a static local, is available in many mainstream languages, including C/C++, Visual Basic and VB.NET, which allows a value to be retained from one call of the function to another.

Q.27. A default argument value is used inside a function, if

a. its corresponding value is missing in its function call.

b. the variable name in the function prototype is specified.

c. the function accesses the argument’s original value in the calling program.

d. a temporary variable is created in the calling program to hold the argument’s value.

Answer:

(a)

Explanation: For some functions, one may want to make some of its parameters as optional and use the default values, if the user does not want to provide values for such parameters. This is done with the help of default argument values.

Q. 28. A function appears on the left side of an assignment statement, when

a. it returns a rvalue.

b. it returns a lvalue.

c. it returns a rlvalue.

d. it returns a lrvalue.

Answer:

(b)

Explanation: The left-hand side of an assignment statement must consist only of a single, previously declared, variable. The left-hand side of an assignment is called the target -- the variable whose contents are changed as a result of the assignment.

Q. 29. A programming language construct used to tell a compiler that it should perform an in-line expansion on a particular function, is known as an

a. online function.

b. inclined function.

c. inline function.

d. outline function.

Answer:

(c)

Explanation: An inline function is that which is not involved at the time of function call, rather its code replaces the function call that invokes it, in the program. Thus, inline functions save the overhead of a function call.

Q. 30. A static function has

a. program scope.

b. file scope.

c. function scope.

d. loop scope.

Answer:

(b)

Explanation: A static function is a function whose scope is limited to the current source file. A static function has a file scope instead of program scope.