Tuesday, March 4, 2014

4. FUNCTIONS

1. The building blocks of C++ programs are

(a) Functions (b) Arrays (c) Classes (d) Statements

2. Which of the following statements marks the end of the function and also transfers control to the statement after call statement?

(a) return (b) continue (c) main 
(d) break

3. Which induce the reusability of the code?

(a) Variables (b) Functions (c) Keywords 
(d) Instructions

4. A function can be called or invoked from another function by using its

(a) Parameters (b) Name (c) Reference (d) All the other three choices

5. Which of the following can be shared by other programs by compiling and loading them together?

(a) Function (b) Variable (c) Statement (d) Token

6. Parameters are separated or delimited by

(a) scope resolution operator (b) period (c) commas (d) semicolon

7. Which communicates with the function through arguments or parameters?

(a) data type (b) call statement (c) name (d) variable

8. What are channels through which data flows from the call statement to the function?

(a) Parameters (b) Function names (c) Operators (d) Data types

9. In how many ways functions that have arguments can be invoked?

(a) 3 (b) 2 (c) 1 (d) 4

10. The parameters associated with function header is called as

(a) Function (b) Formal parameters (c) Actual parameters (d) Arguments

11. The function that returns no value is declared

(a) void (b) float (c) int (d) default

12. Which of the following refers to the accessibility of a variable?

(a) void (b) storage class (c) Scope (d) inline

13. How many scopes are there in C++?

(a) 3 (b) 1 (c) 2 (d) 4

14. Which operator reveals the hidden scope of a variable?

(a) Scope (b) Relational (c) Assignment (d) Binary

15. Which of the following act as place holders in function prototype?

(a) Statements (b) Constants (c) Variables (d) Keywords

16. The calling function parameters are called as

(a) duplicate parameters (b) actual parameters (c) dummy parameters (d) formal parameters

17. Which of the following reduce the size of the program?

(a) Variables (b) Functions (c) Arrays (d) Classes

18. In which method, any change made in the formal parameter is not reflected back to the actual parameters?

(a) void (b) inline (c) call by value (d) call by reference

19. Which functions execute faster but require more memory space?

(a) regular (b) normal (c) void (d) inline

20. The return type of the function prototype float power (float, int) is

(a) double (b) float (c) char (d) int

21. Which of the following keywords is just a request to the compiler?

(a) inline (b) extern (c) auto (d) register

22. Which scope variable’s life time is the life time of a program?

(a) Function (b) Local (c) File (d) Class

23. In which method, any change made in the formal parameter is reflected back in the actual parameter?

(a) call by reference (b) inline (c) call by value (d) void

24. Which looks like a normal function in the source file but inserts the function’s code directly into the calling program?

(a) inline (b) main (c) scope (d) void

25. Which variables die when its block execution is completed?

(a) Function (b) Local (c) File (d) Class

26. Which scope is valid within block and all sub-blocks of function?

(a) Function (b) Class (c) File (d) Local

27. Which operator is used to distinguish local and file scope variables having the same name?

(a) Relational (b) Binary (c) Assignment (d) Scope

28. The default return data type of a function, if no data type is explicitly mentioned is

(a) double (b) char (c) int (d) float

29. Which of the following is NOT true, related to functions ?

(a) The default value in the formal parameters can be given in the form of variable initialization

(b) The default value for an argument can be given in between the argument list

(c) The actual parameters can be passed in the form of constants to the formal parameters of value type

(d) The actual parameters can be passed only as variables to formal parameters of reference type

30. In the following code, the scope of the variable 'a' is

if (x < y)
{
int a;
a++;
}

(a) File scope (b) Function scope (c) Class scope (d) Local scope

31. The scope of any variable used in the entire program is

(a) Class (b) Function (c) File (d) Local

32. The variable declared above all blocks and functions is called as

(a) Class Scope (b) File Scope (c) Local Scope (d) Function Scope

33. Which scope is not known outside their own code block?

(a) Class (b) Local (c) Function (d) File

34. Which is used to help the compiler to check the data requirements of the function?

(a) Function prototype (b) Function calling (c) Function Definition (d) Header files

35. In which method, the called function creates new variables to store the value of the arguments passed to it?

(a) Formal parameter (b) Call by value (c) Call by reference (d) Actual parameter

36. In C++, what can be assigned to the formal parameters of a function prototype?

(a) Values (b) Program (c) Default values (d) Default arguments

37. Parameters that are associated with function call statement are

(a) global parameters (b) local parameters (c) formal parameters (d) actual parameters

38. The prototype of the over loaded member function must differ

(a) both by the number of its arguments and their data types

(b) both by the number of its formal parameters and their data types

(c) either by the number of its arguments or their data types

(d) either by the number of its formal parameters or their data types

39. Which of the following is used to separate a set of actual parameter function?

(a) & (b) ;(semi-colon) (c) .(dot) (d) ,(comma)

40. The return type of the function prototype fact( float, char, double ); is

(a) flaot (b) double (c) int (d) char

41. Which of the following is called scope resolution operator?

(a) ?: (b) :: (c) & (d) *

No comments:

Post a Comment