CBSE - MCQ Question Banks (के. मा. शि. बो . -प्रश्नमाला )

PreviousNext

Q. 193101 Function that perform an action is:


A. Computational function.

B. Manipulative Functions.

C. Procedural Functions.

D. none of the above.

Right Answer is: C

SOLUTION

The function that perform an action and have no explicit return value is called a procedural function.


Q. 193102 Function can be invoked in


A. one way.

B. two ways.

C. three ways.

D. four ways.

Right Answer is: B

SOLUTION

A function can be invoked in two ways i.e. either by call by value or by call by reference method.


Q. 193103 Function call can be by..


A. only by value.

B. only by reference.

C. by value as well as by reference.

D. default.

Right Answer is: C

SOLUTION

Function call need not be purely by value, or by reference. Mix of the two is also possible.


Q. 193104 Through References only can be passed by


A. variables.

B. constants.

C. expressions.

D. all of the above.

Right Answer is: A

SOLUTION

Only variables can be passed by reference, not the constants or expressions.


Q. 193105 In call by reference method


A. the called  function can access and works with the original values using their references.

B. changes made are not reflected back to original value.

C.  values of variable is passed.

D. all of the above.

Right Answer is: A

SOLUTION

In call by reference method a reference to the original variable is passed and the called function can access and works with the original values using their references.


Q. 193106 What is the range of unsigned short integer?


A. -32768 to 32767

B. 0 to 65,535

C. -128 to 127

D. 0 to 255

Right Answer is: B

SOLUTION

The unsigned short int type can be used for variables which will have only positive and zero whole number values, within the range of the unsigned short type. It ranges from 0 to 65,535.


Q. 193107 In Call by value function...


A. under this, the changes are not reflected back to the original values.

B. function creates its own copy and uses the values.

C. the values of actual parameters into formal parameters.

D. all of the above.

Right Answer is: D

SOLUTION

What happens inside the function has no effect on the variables used in function call.


Q. 193108 In a function ending with return;


A. error occurs.

B. 0 is not returned.

C. calculated value is returned.

D. no value is returned.

Right Answer is: D

SOLUTION

A return statement is used to terminate a function whether or not it returns a value.


Q. 193109 Function cannot modify...


A. variables.

B. constant arguments.

C. variables with strings.

D. none of the above.

Right Answer is: B

SOLUTION

By constant argument, it is meant that there values can not be modified. That is why function cannot modify these arguments.


Q. 193110 When the same arguments are used always


A. default arguments cannot be used.

B. default arguments can be used.

C. the value has to be entered each time.

D. none of the above.

Right Answer is: B

SOLUTION

Default arguments are useful in situations where some arguments always have the same value.


Q. 193111 Default value of an argument is used...


A. when its matching value is missing in the function statement.

B. in a program when matching value is given.

C. by the program when it is not required.

D. none of these.

Right Answer is: A

SOLUTION

C++ allows us to assign default values to a function parameters which is useful in case a matching argument is not passed in the function call statements.


Q. 193112 Valid or Invalid and reason for it being so. 
   int area(length=3,breadth=1);


A. Valid. Syntax correct.

B. Invalid argument, syntax error as variables not declared.

C. Invalid as length value should not be given.

D. None of the above.

Right Answer is: B

SOLUTION

correct syntax is

int area(int length=3,int breadth=1);


Q. 193113 Default values to parameter list are...


A. passed in the function call statement.

B. not passed in the function call statement.

C. may or may not be passed in the calling statement.

D. none of the above.

Right Answer is: B

SOLUTION

Default values of parameter are specified at the time of function declaration, not at function call statement.


Q. 193114 Name the functions in the header file iostream.h.
A. passed in the function call statement.
B. not passed in the function call statement.
C. may or may not be passed in the calling statement.
D. none of the above.

Right Answer is:

SOLUTION

The functions in the header file iostream.h are: seekg(), put(), write(), seekp(), open(), close(), flush(), clear().


Q. 193115 What is the difference between C standard library and C++ standard library?
A. passed in the function call statement.
B. not passed in the function call statement.
C. may or may not be passed in the calling statement.
D. none of the above.

Right Answer is:

SOLUTION

The C standard library consists of a set of sections of the ANSI C standard which describes collections of headers and library routines, whereas C++ library consists of a collection of functions, constants, objects and templates.


Q. 193116 Give the description of any two functions in the header file stdlib.h.
A. passed in the function call statement.
B. not passed in the function call statement.
C. may or may not be passed in the calling statement.
D. none of the above.

Right Answer is:

SOLUTION

Two functions of header file stdlib.h are:
1. malloc: Allocates a block of size bytes of memory
2. free: A block of memory previously allocated using a call to malloc, calloc or realloc is deallocated, making it available again for further allocations.


Q. 193117 What is the output of the following ?
            #include< iostream.h >             #include< math.h >             void main( )             {             cout<< pow(4,2) ;             }  
A. passed in the function call statement.
B. not passed in the function call statement.
C. may or may not be passed in the calling statement.
D. none of the above.

Right Answer is:

SOLUTION

The output of the program is 16.
 It is calculating the square of 4 or the value of (4)2.


Q. 193118 What is string.h ?
A. passed in the function call statement.
B. not passed in the function call statement.
C. may or may not be passed in the calling statement.
D. none of the above.

Right Answer is:

SOLUTION

String is treated by c++ as an array which is terminated by null character ‘0;
The prototype required for this is string.h as the header file.


Q. 193119 Write the functions for the following:
i. isalnum()
ii. isalpha() function
A. passed in the function call statement.
B. not passed in the function call statement.
C. may or may not be passed in the calling statement.
D. none of the above.

Right Answer is:

SOLUTION

i. isalnum() function is a character function and it checks whether its argument is alpahnumeric or not.
ii. isalpha() function isa character function and it checks whether its argument is alphabetic or not.


Q. 193120 What is the function of strcmp?
A. passed in the function call statement.
B. not passed in the function call statement.
C. may or may not be passed in the calling statement.
D. none of the above.

Right Answer is:

SOLUTION

The strcmp( ) function compares two strings. It returns less than zero value to the string which is shorter. It returns zero, if two strings are equal.

 


Q. 193121 Distinguish between tolower ( c ) and islower ( c ) ?
A. passed in the function call statement.
B. not passed in the function call statement.
C. may or may not be passed in the calling statement.
D. none of the above.

Right Answer is:

SOLUTION

islower(c) means c is a lowercase character.
tolower( ) converts uppercase(C) character tolower case(c).


Q. 193122 Name the header files to which these in-built functions belong-
i) eof
ii) puts
iii) strcmp
iv) get
A. passed in the function call statement.
B. not passed in the function call statement.
C. may or may not be passed in the calling statement.
D. none of the above.

Right Answer is:

SOLUTION

The inbuilt functions belong to the following header files:
i) eof belongs to the header file iostream.h.
ii) puts belongs to the header file stdio.h.
iii) strcmp belongs to the header file string.h.               
iv) get belongs to header file iostream.h.


Q. 193123 Which are the two functions used to convert between letter cases?
A. passed in the function call statement.
B. not passed in the function call statement.
C. may or may not be passed in the calling statement.
D. none of the above.

Right Answer is:

SOLUTION

The two functions used to convert between letter cases are:
1. tolower: Converts uppercase letter to lowercase. 
2. toupper: Converts lowercase letter to uppercase.


Q. 193124 Write a program in C++ to generate random numbers.
A. passed in the function call statement.
B. not passed in the function call statement.
C. may or may not be passed in the calling statement.
D. none of the above.

Right Answer is:

SOLUTION

A program to generate random numbers from 0-10:

#include < iostream.h>

#include < stdlib.h >

#include < conio.h >

int main()

{

clrscr();

int random_integer= rand();

cout< < random_integer;

getch();

return 0;

}

Output:


Q. 193125 Write a program in C++ to check the size of a string.
A. passed in the function call statement.
B. not passed in the function call statement.
C. may or may not be passed in the calling statement.
D. none of the above.

Right Answer is:

SOLUTION

A program in C++ to check the size of the string:

#include< iostream.h >

#include< conio.h >

#include< string.h >

int main()

{

char str1[100];

cout < < "enter a string: ";

cin > > str1;

cout < < " The size of str1 is " < < strlen(str1) < < " characters";

getch();

return 0;

}

Output:


Q. 193126 Write a program in C++ to compare two strings.
A. passed in the function call statement.
B. not passed in the function call statement.
C. may or may not be passed in the calling statement.
D. none of the above.

Right Answer is:

SOLUTION

A program in C++ to compare two strings:

#include< iostream.h>

#include< conio.h>

#include< string.h>

main()

{

char first[50], second[50];

cout<<"enter first string:";

cin>> first;

cout<<" enter second string: ";

cin>> second;

if(strcmp (first, second)==0)

{

cout<<"n the strings are equal";

}

else cout<<"strings are not equal";

getch();

}

Output:


Q. 193127 What are the three predefined streams of stdio.h?
A. passed in the function call statement.
B. not passed in the function call statement.
C. may or may not be passed in the calling statement.
D. none of the above.

Right Answer is:

SOLUTION

The three predefined streams of stdio.h are as follows:
1.  stdin: It is a standard input stream. By default, the input is taken from the keyboard.
2.  stdout:  It is a standard output stream. By default, stdin corresponds to the screen. 
3. stderr: It is a standard error stream. It is an output stream used specifically to find out the errors.


Q. 193128 Write a program in C++ to check whether an alphabet is in lowercase or in uppercase.
A. passed in the function call statement.
B. not passed in the function call statement.
C. may or may not be passed in the calling statement.
D. none of the above.

Right Answer is:

SOLUTION

A program to check whether an alphabet is in lowercase or in uppercase:

#include< iostream.h >

#include< conio.h >

#include< string.h >

#include< ctype.h >

int main()

{

clrscr();

char ch;

cout< < " Enter an alphabet";

cin > > ch;

if(isalpha(ch))

{

if(islower(ch))

cout< < " lowercase alphabets";

else if (isupper (ch))

cout< < " uppercase alphabets";

}

else

cout< < "Not an alphabet";

getch();

return 0;

}

Output:


Q. 193129 Write a C++ program that reads a string.
A. passed in the function call statement.
B. not passed in the function call statement.
C. may or may not be passed in the calling statement.
D. none of the above.

Right Answer is:

SOLUTION

          #include< iostream.h>

          #include< conio.h>

          #include< string.h>

          int main()

           {

           clrscr();

           char str[20];

       cout<<”n Enter a string”;

       cin.getline (str,20);

       return 0;

      }

         Output:



Q. 193130 Which C++ header(s) will be essentially required to be included to run/execute the following C++ code:
void main( )
{
  char Msg[ ] = "Sunset Gardens";
  for(int i=5; i   puts(Msg);
}  
A. passed in the function call statement.
B. not passed in the function call statement.
C. may or may not be passed in the calling statement.
D. none of the above.

Right Answer is:

SOLUTION

The required header files are:
string.h for strlen()
stdio.h for puts()


Q. 193131 What are mathmetical functions ? Name any 4 mathemetical functions.
A. passed in the function call statement.
B. not passed in the function call statement.
C. may or may not be passed in the calling statement.
D. none of the above.

Right Answer is:

SOLUTION

Mathematical functions help in mathematical calculations. The header file used for these functions is math.h. These functions performs mathmetical calculations and conversions.
Some of the mathmetical functions are sqrt(), log(), pow(), sin() etc.


Q. 193132 What is standard library and why is it needed ?
A. passed in the function call statement.
B. not passed in the function call statement.
C. may or may not be passed in the calling statement.
D. none of the above.

Right Answer is:

SOLUTION

The C++ language contains some statements only and not any built-in functions. A library is a collection of subprograms used to develop other programs and software. Libraries are not independent programs but act as helper codes used in other independent programs. The C++ library of functions stores functions of same category (e.g., mathematical functions, string functions etc.) under separate files known as header files. 

 


Q. 193133 Explain the character functions used in the header file ctype.h.
A. passed in the function call statement.
B. not passed in the function call statement.
C. may or may not be passed in the calling statement.
D. none of the above.

Right Answer is:

SOLUTION

The character functions used in the header file ctype.h are as follows:

Function

Description

isalpha

Tests for alphabetic characters

isalnum

Tests for alphanumeric characters

islower

Tests for lowercase letter

isupper

Tests for uppercase letter

tolower

Converts character to lowercase

toupper

Converts character to uppercase

 


Q. 193134 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.

Right Answer is: D

SOLUTION

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. 193135 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.

Right Answer is: B

SOLUTION

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. 193136 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.

Right Answer is: C

SOLUTION

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. 193137 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.

Right Answer is: B

SOLUTION

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. 193138 The arguments are passed by value when


A. the changes occurring during the called function’s execution are not to be reflected back to the original variables.

B. the default argument value is missing its function call.

C. the entire function call can be assigned to a variable.

D. the function returns a value.

Right Answer is: A

SOLUTION

The main benefit of call by value method is, that we cannot alter the variables that are used to call the function, because any changes that occurs inside function is on the function’s copy of the argument value.


Q. 193139 When an argument is passed by reference,


A. a variable is created in the function to hold the argument’s value.

B. the function cannot access the argument’s value.

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

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

Right Answer is: D

SOLUTION

In call by reference method, a reference to the original variable is passed. A reference is an alias for a predefined variable.


Q. 193140 The difference between static variable and a static function  is


A. a static variable has a function scope but the static function has a program scope.

B. a static variable has a file scope but the static function has a program scope.

C. a static variable has a function scope but the static function has a file scope.

D. a static variable has a file scope but the static function has a function scope.

Right Answer is: C

SOLUTION

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.


Q. 193141 We use functions in a program to


A. increase complexity.

B. increase ambiguity.

C. increase program size.

D. reduce program size.

Right Answer is: D

SOLUTION

Functions make program handling easier, as only a part of the program to deal with.


Q. 193142 All variables by default are...


A. global.

B. external.

C. static.

D. auto.

Right Answer is: D

SOLUTION

The auto storage-class specifier declares an automatic variable, a variable with a local lifetime. It is the default storage-class specifier for variables.


Q. 193143 Reference to a function...


A. cannot be passed as arguments.

B. can be passed as arguments.

C. can not be passed.

D. none of the above.

Right Answer is: B

SOLUTION

When a variable is passed by reference we are not passing a copy of its value, but we are somehow passing the variable itself to the function and any modification that we do to the local variables will have an effect in their counterpart variables passed as arguments in the call to the function.


Q. 193144 Memory location is shared as alias by


A. constant.

B. variable.

C. reference variable.

D. constant variable.

Right Answer is: C

SOLUTION

A reference is an alternative name for an object. A reference variable provide an alias for a previously defined variable.


Q. 193145 Permanent change in memory address is made by


A. call by reference.

B. call by value.

C. changing parameter.

D. changing argument.

Right Answer is: A

SOLUTION

In call by reference method, a reference to the original variable is passed and changes made in these variable reflected back to the memory address. thus permanent change in memory address is done.


Q. 193146 Specifier that specifies that variable has already been defined in the program is...


A. extern.

B. static.

C. register.

D. auto.

Right Answer is: A

SOLUTION

External variables are globally accessible. They remains in existence permanently as they retain their values even after the functions that set them was returned. i.e. why these variables specifies that they are already been defined in the program.


Q. 193147 scope of variable used by a function is...


A. local scope.

B. function scope.

C. class scope.

D. file scope.

Right Answer is: B

SOLUTION

The variables declared and used in the function have function scope.


Q. 193148 Auto variable with faster access is...


A. static.

B. extern.

C. register.

D. auto.

Right Answer is: C

SOLUTION

The C++ register keyword can be used as a hint to the compiler that the declared variable is to be accessed very often during program execution, and hence, require faster access.  


Q. 193149 By default all local variables are


A. extern.

B. static.

C. register.

D. auto.

Right Answer is: D

SOLUTION

The auto storage-class specifier declares an automatic variable, a variable with a local lifetime. It is the default storage-class specifier for variables.


Q. 193150 The various kind of scope is/are


A. local.

B. function.

C. file and class.

D. all of the above

Right Answer is: D

SOLUTION

There are four kinds of scope in C++: local, function, file and class.


Q. 193151 To terminate function ..... is used


A. exit( ).

B. return.

C. stop.

D. end.

Right Answer is: B

SOLUTION

The return statement terminates the execution of a function and returns control to the calling function.


Q. 193152 functions may be


A. one type.

B. Two types.

C. Three types.

D. four types.

Right Answer is: C

SOLUTION

There may be three types of functions in c++:
(1) Computational functions.
(2) Manipulative functions.
(3) Procedural functions.    


Q. 193153 Arrays are


A. passed as value generally.

B. passed as reference.

C. cannot be passed.

D. none of the above.

Right Answer is: B

SOLUTION

you must pass arrays by reference; you'll get a syntax error if you try to pass an array by value. Because arrays are passed by reference, you can pass an array to another procedure to be modified, and then continue working with the modified array in the calling procedure.


Q. 193154 Explain the header files used in C++ language.
A. passed as value generally.
B. passed as reference.
C. cannot be passed.
D. none of the above.

Right Answer is:

SOLUTION

The following header files are used in C++ language:
1. stdio.h: This header file defines types and macros needed for the standard I/O packages. It also defines the standard I/O predefined streams. 
2. string.h: It declares several string manipulation and memory manipulation routines. The following are the functions contained in string.h: memccpy, strcmp, strcat, strcpy, strncpy etc.
3. math.h: This header file declares prototypes for the math functions and math error handlers. 
4. stdlib.h: This header file declares several commonly used routines like conversion routines, search/sort routines and other miscellaneous things.


Q. 193155 Explain the functions which are used to generate random numbers.
A. passed as value generally.
B. passed as reference.
C. cannot be passed.
D. none of the above.

Right Answer is:

SOLUTION

The functions which are used to generate random numbers are as follows:
1.  rand()
2.  srand()
3.  random()
4.  randomize()
5.  rand_max()
rand(): The rand function returns a “random” positive integer from 0 to a large value (atleast 32767) everytime it is called. To scale the value into the range, use the mod (%) operator and addition.

rand_max(): Value of rand_max() varies between compilers and

can be as low as 32767 which would give a range from 0 to 32767 for

rand().

random(): random(num) generates a random number within 0 to

num-1, For example, random(10) will generate random numbers from

0 to 9.

randomize(): initializes / seeds the random number generator with a

random number. 

srand(): srand() is used to prevent the repetition of random numbers whenever the program is executed.


Q. 193156 What is stdlib.h? Briefly explain some of the stdio.h functions.
A. passed as value generally.
B. passed as reference.
C. cannot be passed.
D. none of the above.

Right Answer is:

SOLUTION

stdlib.h is the header file that declares several commonly used routines like conversion routines, search and sort routines etc. 
Some of the functions of stdio.h are _fullpath, _makepath, _search.h, _splitpath.

fullpath: function formulates the full pathname for a file from its relative path relPath argument and stores the result in absPath, returning a pointer to the resulting string.

makeapath: builds a path from components path.

search.h: Some search types are-
bsearch performs a binary search.
lsearch performs a linear search
searchenv searches on environment path for a file
.

splitpath: splits a full path into its components.

 


Q. 193157 Memory location is shared as alias by


A. constant.

B. variable.

C. reference variable.

D. constant variable.

Right Answer is: C

SOLUTION

A reference is an alternative name for an object.


Q. 193158 The difference between function definition and prototype declaration is that


A. prototype declaration has no body.

B. prototype declaration cannot access the argument’s value.

C. prototype declaration is optional to gives function prototype.

D. prototype declaration has its code.

Right Answer is: A

SOLUTION

The prototype declaration looks just like a function definition except that it has no body.


Q. 193159 The benefit of using functions is


A. to reduce the program size.

B. non-readable to the user.

C. to increase ambiguity.

D. a complex program handling.

Right Answer is: A

SOLUTION

Use of function avoids ambiguity. It reduces the program size and thus, makes the program more readable and understandable to the programmer.


Q. 193160 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.

Right Answer is: C

SOLUTION

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. 193161 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.

Right Answer is: A

SOLUTION

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. 193162 A local variable that, is not destroyed on exit from the function and retains its value throughout the program run, is called as


A. referenced variable.

B. static variable.

C. private variable.

D. protected variable.

Right Answer is: B

SOLUTION

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


Q. 193163 The part of a program 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.

Right Answer is: C

SOLUTION

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


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


A. function argument.

B. function documentation.

C. function definition.

D. function prototype.

Right Answer is: C

SOLUTION

The general form of a function definition is given by type function-name(parameter list)
{
Body of the function
}  


Q. 193165 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.

Right Answer is: B

SOLUTION

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. 193166 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.

Right Answer is: A

SOLUTION

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


Q. 193167 A static function has a


A. program scope.

B. file scope.

C. function scope.

D. loop scope.

Right Answer is: B

SOLUTION

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


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


A. function space.

B. function declarator.

C. function initiator.

D. function definition.

Right Answer is: B

SOLUTION

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


Q. 193169 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.

Right Answer is: C

SOLUTION

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.


Q. 193170 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.

Right Answer is: A

SOLUTION

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


Q. 193171 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.

Right Answer is: B

SOLUTION

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


Q. 193172 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.

Right Answer is: C

SOLUTION

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


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


A. two.

B. three.

C. four.

D. five.

Right Answer is: B

SOLUTION

The three types of functions in C++ are: computational functions, manipulative functions and procedural functions.


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


A. function declaration, function definition and function prototype.

B. function declaration, function definition and function call.

C. function declaration, function creation and function prototype.

D. function declaration, function deletion and function prototype.

Right Answer is: B

SOLUTION

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. 193175 The number of ways to change a variable in a statement that calls a function, are


A. two.

B. three.

C. four.

D. five.

Right Answer is: A

SOLUTION

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


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


A. folder.

B. global.

C. object.

D. class.

Right Answer is: D

SOLUTION

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


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


A. two.

B. three.

C. four.

D. five.

Right Answer is: C

SOLUTION

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


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


A. scope.

B. function.

C. reference.

D. prototype.

Right Answer is: C

SOLUTION

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. 193179 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.

Right Answer is: B

SOLUTION

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. 193180 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.

Right Answer is: A

SOLUTION

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


Q. 193181 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.

Right Answer is: B

SOLUTION

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


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


A. parameters.

B. arguments.

C. formal parameters.

D. function call.

Right Answer is: B

SOLUTION

Actual parameters are the variables or expressions referenced in the parameter list of a subprogram call. They are also known as arguments.


Q. 193183 When a function returns a value, the entire function can be assigned to a/an


A. constant.

B. variable.

C. entity.

D. register.

Right Answer is: B

SOLUTION

All the functions except those of type void, return a value. The return statement explicitly specifies this value. When a value is returned, the entire function can be assigned to a variable.


Q. 193184 An inline function is that which is


A. invoked at the time of function call.

B. not invoked at the time of function call.

C. modified by the function.

D. declared with an empty argument list.

Right Answer is: B

SOLUTION

An inline function is that which is not invoked at the time of function call rather its code replaces the very function call that invokes it, in the program.


Q. 193185 The significance of the empty parenthesis in a function declaration is that the


A. function pass actual parameters.

B. function pass formal parameters.

C. function pass informal parameters.

D. function does not pass parameters.

Right Answer is: D

SOLUTION

A function declared with an empty argument list as void display(); means that the function does not pass any parameters. It is identical to the statement void display(void);


Q. 193186 The lifetime of local variables having function scope is the


A. program-run.

B. function-run.

C. block-run.

D. scope-run.

Right Answer is: B

SOLUTION

A variabless lifetime is its parent-block-run. Therefore, the lifetime of local variables having function scope is the function-run.


Q. 193187 The global variable's lifetime is the


A. program-run.

B. function-run.

C. block-run.

D. scope-run.

Right Answer is: A

SOLUTION

A variable's lifetime is its parent-block-run. The global variable's lifetime is the program-run, i.e., the time during which the program executes.


Q. 193188 To differentiate the normal functions from the member functions of the class, one needs to use the


A. file scope operator.

B. function scope operator.

C. scope resolution operator.

D. block resolution operator.

Right Answer is: C

SOLUTION

To differentiate from the normal functions with the member functions of the class, one needs to use the scope resolution operator (::) in between the class name and the member function name i.e. ship::foo() where the ship is the class and the foo() is the member function in the ship.


Q. 193189 The operator denoted by :: is known as


A. file scope operator.

B. function scope operator.

C. scope resolution operator.

D. block resolution operator.

Right Answer is: C

SOLUTION

The scope resolution operator (::) in C++ is used to define the already declared member functions (in the header file with the .hpp extension) of the class.


Q. 193190 The lifetime of local variables having block scope is the


A. program-run.

B. function-run.

C. block-run.

D. scope-run.

Right Answer is: C

SOLUTION

A variable's lifetime is its parent-block-run. Therefore, the lifetime of local variables having block scope is the block-run.


Q. 193191 A function prototype is also known as


A. function documentation.

B. function argument.

C. function declaration.

D. function reference.

Right Answer is: C

SOLUTION

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. 193192 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.

Right Answer is: C

SOLUTION

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. 193193 The number of values, a function can return is


A. one.

B. two.

C. zero.

D. infinite.

Right Answer is: A

SOLUTION

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


Q. 193194 Return value must always be used


A. to reside.

B. to print.

C. to manipulate.

D. either of the above

Right Answer is: D

SOLUTION

Return value can be used for different purposed such as to reside, manipulate or to print.


Q. 193195 Functions having returning value


A. can be used in expressions.

B. none of these.

C. cannot be used in expressions.

D. cannot be used in calculations.

Right Answer is: A

SOLUTION

Expressions generally use the functions that  have returning value.


Q. 193196 .............. is/are Related to functions.


A. function prototyping.

B. function definition.

C. function calling.

D. all of the above.

Right Answer is: D

SOLUTION

Functions are made up of three parts
(1) Function Declaration.
(2) Function Definition.
(3) Function calling.  


Q. 193197 Parameters are enclosed in...


A. Parentheses.

B. Braces.

C. Quotation marks.

D. Any of the above.

Right Answer is: A

SOLUTION

Parameter that we pass in function is enclosed in parenthesis'('  ')'

for example:   int func(int a, int b)
                         {
                            }
a and b are parameters.


Q. 193198 Function call and function prototype both should end with...


A. Parenthesis ( )

B. Semicolon ( ; ) 

C. Braces { }

D. Quotes

Right Answer is: B

SOLUTION

Eg:-  Function prototype:      int area(int, int);   Function call:               area(x,y); 
Both the above statements ends with semicolon.           


Q. 193199 A function can be of....


A. one type.

B. two type.

C. three type.

D. four type.

Right Answer is: C

SOLUTION

Function can be of three types:
(1) Computational Functions
(2) Manipulative Functions
(3) Procedural Functions  


Q. 193200 if a function has four return statements, then how many of them are executed


A. all four.

B. only two.

C. only one.

D. only three.

Right Answer is: C

SOLUTION

A function may contain several return statements. However, only one of them gets executed because the execution of the function terminates as soon as a return is encountered.


PreviousNext