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

PreviousNext

Q. 192901 The ? operator can be treated as an alternate to


A. Iteration statement.

B. switch statement.

C. do while statement.

D. If statement.

Right Answer is: D

SOLUTION

?: is conditional operator. It can be used as follows: expression1 ?expressiion 2: expression3;


Q. 192902 The example of a compound statement is


A. block statement.

B. set statement.

C. group statement.

D. collective statement.

Right Answer is: A

SOLUTION

Compound statement is a group of statements enclosed by a pair of braces ( { } ).


Q. 192903 Mark the invalid statement: Sum=0 int i=1; while(sum < 10000) {
sum=sum+i; i=i+1; }


A. int sum=0;

B. sum=(sum+i);

C. while(sum<10000);

D. i=i+1;

Right Answer is: A

SOLUTION

The invalid statement is Sum=0 It should be int sum = 0;


Q. 192904 Identify the possible errors in
do;
while {value >=9}


A. do terminating with  semicolon.

B. there should be space between do;

C. braces in 2nd statement.

D. ; should be removed and in place of{ } should have (  ).

Right Answer is: D

SOLUTION

Correct code is:

  do
  while(value >=9)


Q. 192905 To abandon execution of the rest of the program, we use


A. library function main.

B. break.

C. continue.

D. exit function.

Right Answer is: D

SOLUTION

exit( ) function is a standard library function that helps us break out of a program.


Q. 192906 Statement that can transfer control anywhere in the program is


A. if statements.

B. goto statements.

C. for statement.

D. do while statement.

Right Answer is: B

SOLUTION

goto is a jump statement. The taget destination of a goto statement is marked by label.


Q. 192907 Unconditional statements are called


A. assignment statements.

B. jump statements.

C. block statements.

D. break statement.

Right Answer is: B

SOLUTION

C++ has four statements that cause unconditionally branch: return, goto, break, and continue.


Q. 192908 Label is used with


A. If statement.

B. switch construct.

C. goto statement.

D. jump statement.

Right Answer is: C

SOLUTION

The target destination of a goto statement is marked by label.The target goto and label must appear in the same function.


Q. 192909 The statement- if(ans==’y’) is


A. testing truth value.

B. comparing two variables.

C. comparison with a literal.

D. none of the above.

Right Answer is: C

SOLUTION

Since ’y’ is character literal and we are comparing it with ans by using comparison operator(= =).


Q. 192910 The ? operator can be treated as an alternate to


A. Iteration statement.

B. switch statement.

C. do while statement.

D. If statement.

Right Answer is: D

SOLUTION

? is a conditional operator and checks whether condition is true or false. if condition is true following statements are executed otherwise not. thus it works similar to if statement.


Q. 192911 Iteration and Selection both depend upon


A. looping construct.

B. conditional expression.

C. do while  loop.

D. While loop.

Right Answer is: B

SOLUTION

Conditional expression is the basis for selection and iteration statements.


Q. 192912 Label is used with


A. If statement.

B. switch construct.

C. Go to statement.

D. jump statement.

Right Answer is: C

SOLUTION

A goto statement uses label. A goto statement causes your program to unconditionally transfer control anywhere in the program or to the statement associated with the label specified on the goto statement.


Q. 192913 Multiple expressions in "for loop" are separated by


A. semicolon.

B. double quotes.

C. comma.

D. single quotes.

Right Answer is: A

SOLUTION

The syntax of a for loop is: for (initialization expression; test expression; update expression) body of the loop;


Q. 192914 Statement unconditionally transfer program control is:


A. selection statement.

B. jump statement.

C. sequence statement.

D. iteration statement..

Right Answer is: B

SOLUTION

Jump statements are statements that unconditionally transfer program control. There are following jump statements: return, goto, continue, break.


Q. 192915 Time delay loop can be created by


A. putting semicolon after paranthesis in for statement.

B. terminating for loop by colon.

C. just by terminating paranthesis.

D. putting a fullstop after paranthesis.

Right Answer is: A

SOLUTION

Time delay or infinite loop can be created by for(; ; )


Q. 192916 The exit( ) function is defined under header file


A. iostream.h.

B. conio.h.

C. process.h.

D. ostream.h.

Right Answer is: C

SOLUTION

exit( ) function causes the program to terminate, as soon as it is encountered, no matter where it appears in the program listing.


Q. 192917 Continue statement can be used with


A. while loop.

B. for loop.

C. do while loop.

D. if loop.

Right Answer is: C

SOLUTION

Continue statement forces the next iteration of the loop to take place, skipping any code in between.


Q. 192918 Block is treated as a


A. multiple statements unit.

B. single unit.

C. selection unit.

D. two statements unit.

Right Answer is: B

SOLUTION

Any number of statements can be written inside a block and it is treated as a single unit, which may appear anywhere in the program.


Q. 192919 what is the output of
   int i;    i=1;    for(;i<2;i++)    {    cout << ”square of ” << i <<  ”is”  <<  i*i;    }


A. error message.

B. square of 2 is 4.

C. square of 1 is 1.

D. square of i is i.

Right Answer is: C

SOLUTION

When loop executed once then i=1 so 1*1= 1
Now according to test condition i<2 the loop is terminated so output is: square of 1 is 1.  


Q. 192920 The value of variable J at the end of the loop in for(j=0; j<29;++j) is


A. 29

B. 30

C. 31

D. 28

Right Answer is: D

SOLUTION

Loop started at 0 and will print values for 29 iterations so the terminal value of J is = 28


Q. 192921 Predict the output
  {
    int a=5,b=5;     if (a = = 5)     b=a++-1;    cout<< ”a = “<< a << endl;    cout<< ”b=”<< b;      }


A. a=8 b=6

B. a=0 b=5

C. a=6 b=4

D. a=5 b=5  

Right Answer is: C

SOLUTION

Since if condition is true
so b= a++-1 = 5-1= 4(post increment of a is done after assignment)
now a become 6(as it is incremented).


Q. 192922 what is the output of int i,j; for(i=2;i<=2;i++) {
j=3-1; cout << i* << j  <<  "is = ” <<  i*j; }


A. 4

B. 2

C. 3

D. i

Right Answer is: A

SOLUTION

Since initial value of i is 2 and j is 2 so i*j = 2*2 =4
and according to test expression i<=2 the loop is terminated so output is 4.  


Q. 192923 The optional expression/expressions in for loop is/are


A. initialization expression only.

B. test expression only.

C. update expression only.

D. initialization expression, test expression, and update expression.

Right Answer is: D

SOLUTION

Example of an infinite loop. for(; ;) cout<< "Ëndless for loop" << "/n"


Q. 192924 Missing test expression can be found in a/an


A. empty for loop.

B. infinite for loop.

C. invalid for loop.

D. do while loop.

Right Answer is: B

SOLUTION

Example: for (j=23; ;--i) as there is no test condition so loop will executed infinite times.


Q. 192925 The loop which is executed at least once is called


A. for loop.

B. while loop.

C. do while loop.

D. do loop.

Right Answer is: C

SOLUTION

In do-while loop, the condition is checked at the end of the loop. So, the loop will be evaluated at least once, even if the condition is false.


Q. 192926 In nested loops, the inner loop terminates


A. before the outer loop terminates.

B. after the outer loop terminates.

C. with the outer loop termination.

D. only if the outer loop terminate.

Right Answer is: A

SOLUTION

In a nested loop, one loop is inside another loop body. Here, outer loop cannot terminate before inner loop.


Q. 192927 If(ans = = 'y') is


A. testing truth value.

B. comparing two variables.

C. comparison with a literal.

D. assigning value y to ans.

Right Answer is: C

SOLUTION

== is a relational operator, whereas = is an assignment operator.


Q. 192928 The body of the loop may not be executed even once in a


A. while loop.

B. do loop.

C. do while

D. test loop.

Right Answer is: A

SOLUTION

In while loop first the condition is evaluated, then loop execution takes place. If loop condition is false it will not be executed even once.


Q. 192929 Goto cannot forward jump over a


A. constant.except in a block.

B. switch statement.except in a block.

C. break statement.except in a block.

D. variable definition except in a block.

Right Answer is: D

SOLUTION

A goto statement can transfer the program conrol anywhere in the program.


Q. 192930 Identify the error

int i;
for(i =1, i>10; i =i+1)
{
........
}


A. int i;

B. i=1,

C. i=i+1

D. i>10;

Right Answer is: B

SOLUTION

In for loop every expression is separated by semicolon (;). So correct syntax of for loop is: for(i=1;i>10;i=i+1)


Q. 192931 If and Switch statements together are referred to as


A. selection statements.

B. jump statements.

C. repetitive statements.

D. loop statements.

Right Answer is: A

SOLUTION

They are together referred to as selection construct. It means the execution of statement depending upon a condition test. It evaluates its truth value. It can also use a conditional statement viz., a decision making statement.


Q. 192932 return ,goto, break and continue are all


A. general statements.

B. selection Statements.

C. iteration statements.

D. jump statements.

Right Answer is: D

SOLUTION

The jump statements unconditionally transfer program control within a function.


Q. 192933 for,while, do while statements are


A. Selection statements.

B. Iteration statements.

C. Conditional statements.

D. Decision making statements.

Right Answer is: B

SOLUTION

Iteration construct depends upon condition test, which can be either true or false.


Q. 192934 The statement in which the test expression is evaluated at the beginning is


A. do-while loop.

B. if-else condition.

C. while loop.

D. do statement.

Right Answer is: C

SOLUTION

In a while loop, the test expression is evaluated at the beginning of the loop. If the test expression is false, the loop body won't be executed.


Q. 192935 Continue statement causes a break in


A. switch statement.

B. If else.

C. current iteration.

D. current program.

Right Answer is: C

SOLUTION

continue is a jump statement,which instead of forcing termination, forces the next iteration of the loop to take place, skipping any code in between.


Q. 192936 Continue statement


A. forces termination.

B. forces next iteration.

C. forces exit and continue.

D. forces next termination.

Right Answer is: B

SOLUTION

Continue statement continues executing the next code.


Q. 192937 Give the output of the code
   int i=1;    for(i=2;i>=2;i--)    cout<< i<< endl;


A. 1

B. 3

C. 2

D. 6

Right Answer is: C

SOLUTION

initial value of i= 2 and test condition evaluates only once so output is 2


Q. 192938 Selection statement(s) is(are)


A. If and If else

B. If else If ladder

C. The switch statement and nested switch

D. All of the above

Right Answer is: D

SOLUTION

All these statements provide selection control structures to execute a section of code if and only if an explicit run-time condition is met.  For the if statement, if-else statement, and if -else-if ladder statement the condition is an expression which evaluates to a boolean value, that is, either true or false.  For the switch statement, the selector is an expression which evaluates to an integral value. Selection statements are also referred to as conditional statements.


Q. 192939 Identify the error
   {
   int i=1;
   while (i<10)
   {
    cout<<” 5*”i;
    i++;
    }
      }


A. while i<10;

B. opening and terminating braces.

C. cout<<”5*”i;

D. Braces problem.

Right Answer is: C

SOLUTION

The incorrect statement is (c). It should be written as---- cout<<5*i;


Q. 192940 Output of the following code will be for(i=1;i<=10;i++); cout << i ;


A. 12345678910

B. 10

C. 11

D. 1

Right Answer is: C

SOLUTION

The semicolon is used to terminate the for loop so control will go to cout statement when the for loop will terminate.


Q. 192941 Display the output of the following program.
               int i=10;                while(i>=6)                {                    cout << i < < endl ;                    i - -;                    i - -;                         }  
Right Answer is:

SOLUTION


    10
    8
    6
         


Q. 192942 In the following segment, can the  loop mentioned,  be used as time delay loop ?
           Lwait=0;             while(++Lwait<500000)                  ;                  ;
Right Answer is:

SOLUTION

Yes, it can be used as delay loop. It is doing nothing else as it has null statements.


Q. 192943 List the variations of the While loop?
Right Answer is:

SOLUTION

The variations are:-
          Do while loop

          While loop

We can also consider- Null statement loop eg delay loop

 


Q. 192944 Give the output of the following code.
          int i=1;             for(;;)             {             cout << i++ << ” “ ;             if(i>5)              break;             }
Right Answer is:

SOLUTION

The output of the above code segment is
1 2 3 4 5

 


Q. 192945 Give the output of the following code:
int i=10;
for(i=10;i>=7;i- -)
cout<< i << endl;
Right Answer is:

SOLUTION

The output of the above program segment is

10

9

8

7


Q. 192946 Explain the update expression in the for loop?
Right Answer is:

SOLUTION

1.The update expression(s) change the value(s) of loop variable(s).
2.The update 
expression(s) is carried out at the end of the loop, after the loop body is executed.

 


Q. 192947 What is the Nested if structure?
Right Answer is:

SOLUTION

Nested if means the if within another if statement. This type of if statement has more than one condition dependent on each other.

if (condition)
{
if (condition)
{
---statement--;
}
}


Q. 192948 Mention two differences between if and conditional operator?
Right Answer is:

SOLUTION

a) A conditional operator has a more clear, concise and compact code but it is less obvious compared to if.
b) A conditional operator when used in nested forms becomes complex and difficult to understand but in case of if statement it is not so.

 


Q. 192949 What is nested if ?
Right Answer is:

SOLUTION

A nested if is the statement which contains if and else in its body. The nested if can be written in various ways.
The syntax of nested if is as follows:

if (condition)
{
if (condition)
{
--statement--;
}
else
{
--statement--;
}
}


Q. 192950 What is the result of if condition ending with ; semicolon.
Right Answer is:

SOLUTION

If a semicolon is put after the test condition , the if statement ends there. The block or statement following is no more a part of if in such cases.
For example

if(a>5);
{
cout<<"Hello";
}


Now the statement
cout<<"Hello"; is not a part of if condition


Q. 192951 Explain the if –else statement?
Right Answer is:

SOLUTION

'if-else' is a conditional statement. In an if-else statement, if the condition is true the code associated with if is executed otherwise if the condition is false the code associated with else is executed.

 


Q. 192952 Give an example of a test condition comparing it with a literal using If construct?
Right Answer is:

SOLUTION

if (grade=’A’)
cout<<”Grade received is A”;

Above condition test for a character literal.


Q. 192953 What is the following segment checking ?  if (ch=’ ‘) Spaces ++;
Right Answer is:

SOLUTION

It checks if the character variable stores a space or not. If it does, the number of spaces are incremented by 1.

 


Q. 192954 What is the syntax of the if statement ?
Right Answer is:

SOLUTION

The syntax of if statement is as follows:

if (condition)
{
--Statement; --}
else
{
---Statement; ---}

Here, the statement, may consist of a Single or a Compound  or Null (no statement).

 

 


Q. 192955 What does iteration mean?
Right Answer is:

SOLUTION

Iteration construct means repetition of a set of statements depending upon a condition test.

 


Q. 192956 How is a block statement written ?
Right Answer is:

SOLUTION

A Block or Compound statements are written within a pair of braces { }.


Q. 192957 When is a null or empty statement required ?
Right Answer is:

SOLUTION

Null or empty statement is used when the logic of the program does not require the statement but the Syntax of the programming language needs it.


Q. 192958 What kind of actions can statements perform  ?
Right Answer is:

SOLUTION

Statements can move data, make decisions and take up repetitive actions.


Q. 192959 List any 3 variations in the for loop?
Right Answer is:

SOLUTION


i) More than one variable may be initialized outside the loop.

ii) The loop index may be initialized outside the loop

iii) Increment or Decrement to loop index outside the for statement

 


Q. 192960 Explain S1, R and R2 in the following for loop statement?
 for(S1;R;R2)
Right Answer is:

SOLUTION

S1 is the statement which initializes the loop index.
R determines if the statement in the loop is to be revisited or test any condition.
R2 updates the loop index


Q. 192961 Give examples of  3 test conditions which work with If.
a)  comparing a literal b)  comparing  2 variables c)  testing truth value of a variable  
Right Answer is:

SOLUTION

a) if(answer="y")  ---- comparing with a literal
b) If(a>b)      ------ comparing variables

c) if (x)         ----testing truth value of a variable

         


Q. 192962 State any three  difference between switch statement and if-else statement ?
Right Answer is:

SOLUTION

Following are the various points of differences:
i) The switch statement can only test for equality, whereas, if-else can evaluate for Relational or Logical conditions.

ii) If-else  is more versatile ie it can handle ranges whereas, switch cannot.

iii) If-else can handle floating point, integer  and character tests   whereas, Switch cannot handle floating point tests.   

 


Q. 192963 Elaborate the structure of a Switch statement?
Right Answer is:

SOLUTION

The switch statement starts with the keyword switch followed by a variable in parenthesis.This is known as switch variable. The switch variablr can be integer or character.
switch(switch variable)

The switch block consists of as number of case blocks and each is associated with case constant.

Each of the case constant s followed by a colon.
case 1: statement;
break;
case 2: statement;

break;

.

.

so on

Compiler searches for case constant  matching case variable. When a match is found the statement associated with that constant are executed.


Note: If the case block does not end with a break statement the control will be passed on to next case block.

                    


Q. 192964 How can the statements of a program be executed ?
Right Answer is:

SOLUTION

Statements can be executed :-
i) Sequentially.

ii) Selectively.

iii) Iteratively.

 


Q. 192965 Write a program to evaluate the factorial of a number ?
Right Answer is:

SOLUTION

#include < iostream.h >
#include < conio.h >

main()

{

clrscr();

int n,i;

long int fact;

cout<<"enter the no whose factorial is required ";

cin>>n;

fact=1;

i=1;

do

   {

          fact=fact*i

          i++;

          }  while (i <= n );

cout<< ”factorial of “<< n<< ”is = ”<< fact << endl;

getch();

}

 

output:

enter the no whose factorial is required 5
factorial of 5 is = 120


Q. 192966 What is the difference between if-else and switch ?
Right Answer is:

SOLUTION

1.The switch statement can only test for equality. Whereas if can evaluate a Rational or logical expression ie multiple conditions.
2. The switch statement selects its branches by testing the same value of same variable (against a set of constants) whereas, if else construct lets you use a series of expressions that may involve unrelated variables and complex expressions.

3. If-else is more versatile than switch.

4. Switch statement is more efficient in terms of code.

5. If-else can handle floating point apart from handling integers and character tests, whereas a switch cannot.

         

 


Q. 192967 When we include < iostream.h > in our program the file that, automatically gets included in our program, is


A. < conio.h>.

B. < stdio.h>.

C. < stdlib.h>.

D. < iomanip.h>.

Right Answer is: B

SOLUTION

This is because the stdio.h defines the standard I/O pre-defined streams. Example :stdin, stdout, stdprn, and stderr.


Q. 192968 The function that checks, whether the given character is a lowercase letter or not, is


A. islower().

B. tolower().

C. lower().

D. lowercase().

Right Answer is: A

SOLUTION

islower() function returns true (non-zero), if it is a lowercase alphabet.


Q. 192969 The function that converts the given character to lowercase letter is


A. islower().

B. tolower().

C. lower().

D. lowercase().

Right Answer is: B

SOLUTION

Nothing is changed, if we pass a lowercase letter or a non-alphabetic character to this function.


Q. 192970 The header file in which, the built-in function cos() is defined, is


A. < iomanip.h>.

B. < math.h>.

C. < string.h>.

D. < ctype.h>.

Right Answer is: B

SOLUTION

The header file math.h contains all the mathematical functions including the arithmetic and trigonometric functions. With the help of these library functions, mathematical operations can be performed directly.


Q. 192971 The header file in which, the built-in function toupper() is defined, is


A. < iomanip.h>.

B. < math.h>.

C. < string.h>.

D. < ctype.h>.

Right Answer is: C

SOLUTION

The header file toupper() is a function that converts a string to uppercase. Therefore, it is included in string.h.


Q. 192972 The header file in which, the built-in function isalnum() is defined, is


A. < iomanip.h>.

B. < math.h>.

C. < string.h>.

D. < ctype.h>.

Right Answer is: D

SOLUTION

This header file provides interfaces, for developing multi-threaded applications.


Q. 192973 The header file in which, the built-in function gets() is defined, is


A. < iostream.h>.

B. < stdio.h>.

C. < string.h>.

D. < ctype.h>.

Right Answer is: B

SOLUTION

The stdio.h is a standard input output header file.


Q. 192974 The functions pow() and ceil() are defined in


A. < stdio.h>.

B. < string.h>.

C. < iomanip.h>.

D. < math.h> .

Right Answer is: D

SOLUTION

The routines in math.h perform mathematical calculations and conversions.


Q. 192975 The function endl(), which is used to flush the buffer is present in the header file


A. iostream.h.`

B. string.h.

C. stdio.h.

D. iomanip.h.

Right Answer is: D

SOLUTION

It declares the C++ streams I/O manipulators and contains macros for creating parameterized manipulators.


Q. 192976 The function endl() uses


A. istream.

B. ostream.

C. fstream.

D. byte stream.

Right Answer is: B

SOLUTION

The function endl inserts a new line character and flushes the buffer, i.e., it writes all the unwritten characters in the buffer to the output sequence.


Q. 192977 The terms cerr , cin and cout present in iostream.h header file are called


A. classes.

B. programs.

C. objects.

D. functions.

Right Answer is: C

SOLUTION

These are the objects used to perform input and output operations on the standard input and output.


Q. 192978 The global functions modifying the properties and formatting settings of the streams are present in


A. iostream.h.

B. sstream.h.

C. fstream.h.

D. iomanip.h.

Right Answer is: D

SOLUTION

These functions are manipulators like endl() and hex().


Q. 192979 The manipulator used to insert a null character is


A. endl().

B. ends().

C. flush().

D. fixed().

Right Answer is: B

SOLUTION

The manipulator ends() is used to insert a null character (‘0’). We should not confuse it with endl, which is used to insert a new line character.


Q. 192980 The function which sets the format flags specified by a parameter mask are present in header file


A. < iostream.h>.

B. < stdlib.h>.

C. < stdio.h>.

D. < iomanip.h>.

Right Answer is: D

SOLUTION

The function is setiosflags. Other parameterized manipulators are: resetiosflags, setbase, setfill etc.


Q. 192981 The functions malloc() and calloc() are present in the header file


A. < iostream.h>.

B. < iomanip.h>.

C. < stdlib.h>.

D. < stdio.h>.

Right Answer is: C

SOLUTION

These are functions for memory allocation and deallocation , and are present in standard library.


Q. 192982 The functions strnlen(), strcat() are present in


A. < iostream.h>.

B. < iomanip.h>.

C. < stdlib.h>.

D. < string.h>.

Right Answer is: D

SOLUTION

It declares several string manipulation and memory manipulation routines.


Q. 192983 The function open() is present in the header file


A. < string.h>.

B. < stdio.h>.

C. < iomanip.h>.

D. < fstream.h>.

Right Answer is: D

SOLUTION

The header file open() is used to open a file.


Q. 192984 The function random() present in the header file is


A. < stdlib.h>.

B. < string.h>.

C. < fstream.h>.

D. < stdio.h>.

Right Answer is: A

SOLUTION

It is used for random number generation.


Q. 192985 If we want to generate different random numbers every time, then we use


A. any srand () or rand().

B. randoms().

C. srand().

D. rand().

Right Answer is: C

SOLUTION

The srand() function starts or speeds the random-number generator, from a point that depends on the value we pass to srand() as an argument.


Q. 192986 The function that is used to generate random numbers within range 0-9 is


A. rand(0).

B. random(10).

C. random(9).

D. random(11).

Right Answer is: B

SOLUTION

random(num) is used to generate random numbers within range 0 to num-1. For example, random (10) will generate random numbers within range 0 - 9. To generate random numbers within a specific range (L to U) though random (), we need to change the use of random() to : random (U - L + 1) + L.


Q. 192987 The function, that returns true (nonzero), if it is a digit from 0 to 9 , or an alphabetic character ( either uppercase or lowercase), is


A. isalpha().

B. isalnum().

C. isdigit().

D. isupper&lower&digit().

Right Answer is: B

SOLUTION

It returns false, if anything other than the digit or alphabet is passed to this function.  


Q. 192988 The function that converts the given character to uppercase letter is


A. isupper().

B. toupper().

C. upper().

D. uppercase().

Right Answer is: B

SOLUTION

toupper()converts its arguments to uppercase letter if its argument is a letter.


Q. 192989 The header file in which, the built-in function open() is defined, is


A. < istream.h>.

B. < ostream.h>.

C. < fstream.h>.

D. < stdlib.h>.

Right Answer is: C

SOLUTION

The fstream provides an interface to read and write data from files as input/output streams.


Q. 192990 In our human body, we have brain, that stores all the functions to be performed by our body. For C++ these functions are stored in


A. header files.

B. library functions.

C. iostream.

D. main().

Right Answer is: A

SOLUTION

A header file is a file containing C++ declarations and macro definitions to be shared between several source files. They supply the definitions and declarations required to invoke system calls and libraries.


Q. 192991 For using putchar( ) the header  file to be included is


A. console I/O function.

B. < iostream.h>.

C. < stdio.h> .

D. unformatted string function.

Right Answer is: C

SOLUTION

putchar() is a standard library function which is present in the standard input output library.


Q. 192992 Header file that contains console I/O function is


A. < string.h>.

B. < iostream.h>.

C. istream.

D. ostream.

Right Answer is: B

SOLUTION

all the console I/O functions are contained in the iostream header file as it deals with all the input and output functions.


Q. 192993 Function write is invoked with


A. cout stream.

B. cin and a line of text.

C. cout stream with a line of text on the screen.

D. cin stream with a line of string on the screen.

Right Answer is: C

SOLUTION

write is a function present in the output stream. It is invoked when a line of text is written on the screen.


Q. 192994 write( ) handles


A. input function.

B. input line oriented function.

C. line oriented output function.

D. output function.

Right Answer is: C

SOLUTION

write is used to handle the output function when a line of text is entered.


Q. 192995 getchar( ) is defined in the  header file


A. < stdio.h>.

B. < conio.h>.

C. < iostream.h>.

D. < string.h>.

Right Answer is: A

SOLUTION

getchar() is a library function which is defined in standard input output library to take a single charcter as an input.


Q. 192996 get( ) and put( ) are used with the stream objects


A. cin and cout.

B. cin only.

C. cout only.

D. Cin and Cout.

Right Answer is: A

SOLUTION

get() is used to input data so it is used with the cin stream object while put() is used to output a string so it is used with the cout stream object.


Q. 192997 write( ) function handles


A. text oriented input function.

B. line oriented input function.

C. input oriented function.

D. line oriented output function.

Right Answer is: D

SOLUTION

write() is an output function used to display text from a file one line at a time.


Q. 192998 Unformatted console I/O function puts( ) is


A. write a character.

B. write string of characters at console.

C. read a character.

D. read a string.

Right Answer is: B

SOLUTION

puts() displays a string of characters on the screen which is a console.


Q. 192999 Unformatted stream I/O functions are


A. fabs().

B. sqrt().

C. write( ).

D. pow().

Right Answer is: C

SOLUTION

write() is a function used to operate on strings and is unformatted as there is no control on the number of characters which would be processed.


Q. 193000 Console I/O functions are performed by


A. standard input device.

B. standard output device.

C. standard input and standard output device.

D. memory.

Right Answer is: C

SOLUTION

standard input and output devices are the peripherals or console required to perform the console i/o operations.


PreviousNext