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

PreviousNext

Q. 193601 The Size and range of data type


A. does not vary with compiler.

B. vary with each processor type &  implementation of C++ compiler.

C. varies with processor.

D. various with interpretrator.  

Right Answer is: B

SOLUTION

Data types are means to identify the type of data and associated operations of handling it. its size and range vary with processor and c++compiler.


Q. 193602 Char is equivalent to


A. integer code.

B. float code.

C. decimal code.

D. hexadecimal code.

Right Answer is: A

SOLUTION

Letters,symbols etc are characters and are represented in memory by number codes.


Q. 193603 Total number of ASCII codes for characters are


A. 215

B. 250

C. 256

D. 253

Right Answer is: C

SOLUTION

Characters refer to letters, digits, symbls, nongraphic characters etc. ASCII codes stores number codes for 256 known characters.


Q. 193604 Double quotes represents a


A. integer.

B. character.

C. string.

D. float.

Right Answer is: C

SOLUTION

Data can be of many types, any data that is enclosed in double quotes represents a string.


Q. 193605 Character consist of


A. letters.

B. symbols.

C. digits.

D. all of above

Right Answer is: D

SOLUTION

letters, digits, symbols and nongraphic characters etc. together form characters.


Q. 193606 Data type means


A. polymorphism.

B. type of data.

C. operations.

D. type of data & operations.

Right Answer is: D

SOLUTION

Data types are means to identify the type of data and associated operations of handling it.


Q. 193607 Output can be formatted by


A. printf( ).

B. setw( ).

C. cout.

D. cin.

Right Answer is: B

SOLUTION

Output can be formatted by manipulators, setw( ) is one of the manipulator offered by C++.


Q. 193608 User defined data type are


A. int.

B. structure.

C. void.

D. char.

Right Answer is: B

SOLUTION

User defined data type are the data types that are derived from fundamental data types(i.e int, char, float, double and void).


Q. 193609 built in derived  data type is(are)


A. int.

B. void.

C. char.

D. reference.

Right Answer is: D

SOLUTION

Build in data type are the data types that are derived from fundamental data types(i.e int, char, float, double and void).


Q. 193610 Ivalue and Rvalue  refer to


A. memory address.

B. data value of the variable.

C. variable’s name.

D. both a and b.

Right Answer is: D

SOLUTION

A variable has two associated values: (1) rvalue: which is data value. (2) lvalue: which is location value or memory address.


Q. 193611 The data type that specifies an empty set of values:


A. integer

B. float

C. char

D. void

Right Answer is: D

SOLUTION

The void type specifies an empty set of values. It is used as the return type for functions that do not return a value.


Q. 193612 Data type modifiers are


A. signed and unsigned.

B. long.

C. short.

D. all of the above

Right Answer is: D

SOLUTION

modifiers are used to alter the meaning of the base type. The list of modifiers are: (1) signed (2) unsigned (3) long (4) short


Q. 193613 char data type can store


A. any member of c++ basic character set.

B. character value is equivalent to the integer code of that character.

C. an identifier declared as char becomes a character variable.

D. all of the above.

Right Answer is: D

SOLUTION

The char type is really another integer type. It represent the basic character set (letters, digits, punctuation etc.)


Q. 193614 What is an array? Also discuss its various types.
A. any member of c++ basic character set.
B. character value is equivalent to the integer code of that character.
C. an identifier declared as char becomes a character variable.
D. all of the above.

Right Answer is:

SOLUTION

An array is a collection of variables of the same type that are referenced by a common name.

There are two types of arrays -

(i) Single-Dimensional Array - An array with only one dimension and comprised of finite homogeneous elements.

(ii) Multi-Dimensional Array - An array with more than one dimension where each element is itself an array. Two-dimensional array is one of the simplest form of multi-dimensional array.


Q. 193615 Discuss array of strings with example in C++.
A. any member of c++ basic character set.
B. character value is equivalent to the integer code of that character.
C. an identifier declared as char becomes a character variable.
D. all of the above.

Right Answer is:

SOLUTION

An array of strings is a two-dimensional character array. The size of first index(rows) determines the number of strings and the size of second index(columns) determines maximum length of each string.

The following code declares an array of 10 strings, each of which can hold maximum 15 valid characters -

char strings[10][15];

 


Q. 193616 Determine the number of bytes required to store an integer array "A[10]", if the int size is 4 bytes?
A. any member of c++ basic character set.
B. character value is equivalent to the integer code of that character.
C. an identifier declared as char becomes a character variable.
D. all of the above.

Right Answer is:

SOLUTION

The formula to be used here is -
Total bytes=sizeof (base-type) * size of the array

Therefore the total number of bytes will be,

= 4 * 10

= 40 bytes


Q. 193617 Write a program code in C++ to concatenate two strings.      
A. any member of c++ basic character set.
B. character value is equivalent to the integer code of that character.
C. an identifier declared as char becomes a character variable.
D. all of the above.

Right Answer is:

SOLUTION

void main() {

        char str1[10],str2[10],str3[20];

        int i,k,x1;

        cout<<”Enter first string: n”;

        cin.getline(str1,10);

        cout<<”Enter second string: n”;

        cin.getline(str2,10);

        for(i=0; str1[i] != ‘0’; ++i)    //Concatenation

              str3[i] = str1[i];            //Copy first string      

        for(k=0; str2[k]!= ‘0’; ++k)

              str3[i+k] = str2[k];      //Copy second string 

       str3[i + k] = ‘0’;               //Put the null character

       x1 = strlen(str3);

       cout<<”n The concatenated string is: n”;

       cout.write(str3,x1);

}


Q. 193618 Write a code segment for calculating sum of the diagonal elements of a matrix?
A. any member of c++ basic character set.
B. character value is equivalent to the integer code of that character.
C. an identifier declared as char becomes a character variable.
D. all of the above.

Right Answer is:

SOLUTION

void main()
{
int i,j,n=5;
int sum=0;
int x[5][5];
for(i=0;i< n;i++)
for(j=0;j< n;j++)
cin >>x[i][j];
if(i==j)
sum=sum+x[i][j];
cout<<"Sum of the diagonal elements of the matrix is ="< }


Q. 193619 How does C++ calculate the size of an unsized array? Discuss it with the help of examples.
A. any member of c++ basic character set.
B. character value is equivalent to the integer code of that character.
C. an identifier declared as char becomes a character variable.
D. all of the above.

Right Answer is:

SOLUTION

C++ provides the facility to skip the size of an array at the time of initialization. In such 
cases, C++ automatically calculates the size of the array on the basis of its type and dimension.

 

Some Example of unsized array are -

(i)   int total[ ] = {5,6,7,1} 

(ii) char S[ ]= "the string is" 

(iii) int cube[ ][2] 

 

              


Q. 193620 What is a vector?
A. any member of c++ basic character set.
B. character value is equivalent to the integer code of that character.
C. an identifier declared as char becomes a character variable.
D. all of the above.

Right Answer is:

SOLUTION

Generally speaking, a vector is frequently represented by a line segment connecting the initial point A with the terminal point B.where both length and direction is known.


In C++ it is represented as
X=[x1,x2,x3,……xn]

A matrix with one row (column) may be viewed as a vector and similarly, a vector may be viewed as a matrix with one row (column).

 


Q. 193621 Differentiate between sized array initialization and unsized array initialization?
A. any member of c++ basic character set.
B. character value is equivalent to the integer code of that character.
C. an identifier declared as char becomes a character variable.
D. all of the above.

Right Answer is:

SOLUTION

C++ provides the facility of array initialization at the time of declaration. The arrays are initialized in the same way as other variables are. The general form of array initialization is as shown below -

type array-name[size 1].....[size N] = {value list};

In sized array initialization we mention the size of the array. For Ex -

int A[5] = {2,4,3,78,31};

In unsized array initialization we can skip the size of the array. Here compiler automatically calculates the size of the array. For Ex-

int A[ ] = {2,4,3,78,31};

 

 


Q. 193622 How does a single-dimensional array represented in the memory? Also discuss its properties.
A. any member of c++ basic character set.
B. character value is equivalent to the integer code of that character.
C. an identifier declared as char becomes a character variable.
D. all of the above.

Right Answer is:

SOLUTION

Single-dimensional arrays are stored as contiguous memory locations in the in order of their index.
A character array requires 1 byte for each character. In the same way an integer array requires 2 bytes to store each element of the array.

The amount of storage required to hold an array is directly related to its type and size.

Some of the properties of one-dimensional arrays are -

(i)  Homogeneous

(ii) Contiguous

(iii) Ordered or Indexed



Q. 193623 Discuss two-dimensional array with example. Also write a program to read sales of 5 salesmen in 12 months and to print total sales made by each salesman.
A. any member of c++ basic character set.
B. character value is equivalent to the integer code of that character.
C. an identifier declared as char becomes a character variable.
D. all of the above.

Right Answer is:

SOLUTION

A two-dimensional array is the simplest form of multi-dimensional array in which each element is an array. The general form of a two-dimensional array declaration is as follows -

type array-name[rows] [columns];

Example -

int sales[5][12];

Program to read sales of 5 salesmen in 12 months and to print total sales made by each salesman -

#include < iostream.h>

#include < conio.h>

void main()

{

clrscr();

int sales[5][12];

int i,j,total;

for(i=0;i<5;i++)

{

total = 0;

cout<<" n Enter sales for salesman"<

for(j=0;j<12;j++)

{

cout<<"Month"<

cin>>sales[i][j];

total=total + sales[i][j];

}

cout<<"n";

cout<<"Total sales of salesman"<

}

getch();

}


Q. 193624 Explain the declaration statement of single-dimensional array and two-dimensional array with example.
A. any member of c++ basic character set.
B. character value is equivalent to the integer code of that character.
C. an identifier declared as char becomes a character variable.
D. all of the above.

Right Answer is:

SOLUTION

A single-dimensional array is an array of only one dimension. The general form of declaration of a single-dimensional array is -

type array-name[size];

where,

type - specifies the base-type or data-type of the array

array-name - specifies the name of the array

size - specifies the total number of elements of the array.

 

Example - int A[10];

The above statement declares a single-dimension array A which can hold 10 integer type variables.

A two-dimensional array is an array in which each element is itself an array. The syntax to declare a two-dimensional array is -

type array-name[row-size][column-size];

where,

type - specifies the base-type or data-type of the array

array-name - specifies the name of the array

row-size - specifies the number of rows

column-size - specifies the number of columns

 

Example - int A[3][3];

The above statement declares a two-dimensional array "A" which can hold 9 integer type variables in the form of rows and columns.

 

 


Q. 193625 Write a C++ code fragment to print the squares of diagonal elements of a given matrix X[p][q]. The given matrix is already a created one.
A. any member of c++ basic character set.
B. character value is equivalent to the integer code of that character.
C. an identifier declared as char becomes a character variable.
D. all of the above.

Right Answer is:

SOLUTION

The diagonal elements of matrix X[p][q] are:

1st diagonal : A00, A11, A22, . . . , Ap-1,p-1

2nd diagonal : A0q-1, A1q-2, A2q-3, . . . , Ap-1q-p+1

The code fragment for this is as follows:

cout<<”The square of first diagonal elements n”;

for(int i=0; i< p; i++)

cout<<”n”<< A[i][i] * A[i][i];

cout<<”n The squares of second diagonal elements (off diagonal) elements n”;

for(i=0; i< p; i++)

       cout<<”n”<< A[i] [q-i+1] * A[i] [q-1+1];


Q. 193626 The statement which is valid or legal in C++ is


A. A reference can be used without proper initialization.

B. Array of references is legal in c++.

C. Char, int pointers can refer to null pointers but null pointers cannot refer to other pointers.

D. Array of pointers is not legal in c++.

Right Answer is: C

SOLUTION

A reference has to be properly initialized, otherwise it will result in an error. In C++ , special care is taken for assignment of void pointers to other pointer types. While, we can assign a pointer of any type to a void pointer but, the reverse is not true until, we do explicit typecasting.


Q. 193627 The correct statement according to the code below is
          struct aditi {
           union {
             int i;
        char ch[2];
                     } ;   
                             };


A. this would give an error as no union name defined.

B. It would give output null.

C. the code is correct and legal in C++.

D. The code is correct and legal in C and C++.

Right Answer is: C

SOLUTION

The code is  legal in C++ but not in C. Unions, which do not have a class name, they are anonymous union.


Q. 193628 The error in the code below ismain( )
{
int i, j;
int *ip;
i=j=ip=0;
}


A. pointer cannot be used in assignment statement.

B. ip is a pointer and cannot be used as an integer.

C. pointer should not be initialized.

D. pointer can not be equal to zero.

Right Answer is: B

SOLUTION

A pointer points to the address of a variable. It cannot be used as integers.


Q. 193629 The correct output of the below code is#include < iostream.h> void main() { int i=5; if (i<=2) {cout<<”hello”; } else cout<<”this is end”; }


A. print this is end.

B. print hello one time.

C. compiler error.

D. run time error.

Right Answer is: A

SOLUTION

It will print this is end because if condition is wrong hence the else part is executed.


Q. 193630 A structure is declared with the keyword


A. structure.

B. struct.

C. define.

D. tag.

Right Answer is: B

SOLUTION

A structure is declared using keyword struct. Example 
struct names
 { int class;
int rollno;
float marks;
char grade;
};


Q. 193631 The invalid form of a real constant is


A. -0.00625.

B. 35.66.

C. + 5.0.

D. 15,356.30.

Right Answer is: D

SOLUTION

Basic real constant is an optional sign, an integer part, a decimal point and a fractional part. Commas(,) are not allowed in real constant.


Q. 193632 Manipulator that is used to set the width of the field in C++ is


A. setw.

B. setiosflags.

C. setprecision.

D. endl.

Right Answer is: A

SOLUTION

The setw( ) manipulator sets the width of the field assigned for output. It takes the size of the field as a parameter.


Q. 193633 The function of endl is


A. same as 'n'.

B. to send a newline character 'n' and then, flush the output buffer.

C. it flushes the output buffer.

D. to send a newline character 'n' but, does not flush the output buffer.

Right Answer is: B

SOLUTION

'n' and endl manipulator sends a new line character 'n', but endl also flushes the output buffer whereas, 'n' does not flush the output buffer.


Q. 193634 Array declaration includes


A. only variable type e.g. int or float.

B. only array name.

C. only array size.

D. type,name,size of an array.  

Right Answer is: D

SOLUTION

While declaring an array we declare its type,name and size. The syntax of declaring an array is type name[size];


Q. 193635 A matrix with one row or column may be viewed as a


A. variable.

B. vector.

C. row itself .

D. column itself.

Right Answer is: B

SOLUTION

A matrix with one row(column) may be viewed as a vector and similarly, a vector may be viewed as a matrix with one row(column).


Q. 193636 Write formula to calculate total bytes required by a one-dimensional array.
A. variable.
B. vector.
C. row itself .
D. column itself.

Right Answer is:

SOLUTION

sizeof(base type) * size of array


Q. 193637 How many bytes will return by the following statement: sizeof(int) ?
A. variable.
B. vector.
C. row itself .
D. column itself.

Right Answer is:

SOLUTION

sizeof(int) returns the size of int data type (in bytes) on a system. An integer variable needs two bytes.


Q. 193638 Define arrays.
A. variable.
B. vector.
C. row itself .
D. column itself.

Right Answer is:

SOLUTION

An array is a collection of variables of same type that are referenced by a common name.


Q. 193639 Write formula to calculate total number of bytes required by a two-dimensional array.
A. variable.
B. vector.
C. row itself .
D. column itself.

Right Answer is:

SOLUTION

Total bytes = number_of_rows  number_of_columns  sizeof(base type).


Q. 193640 In C++, what types of data are represented by a vector?
A. variable.
B. vector.
C. row itself .
D. column itself.

Right Answer is:

SOLUTION

A vector in C++ can represent only integers and floating-point numbers.


Q. 193641 Write a statement to initialise an array of integer type at the time of declaration.
A. variable.
B. vector.
C. row itself .
D. column itself.

Right Answer is:

SOLUTION

int arr[5] = {12,10,6,15,8};


Q. 193642 Give an example of multi-dimensional character array.
A. variable.
B. vector.
C. row itself .
D. column itself.

Right Answer is:

SOLUTION

The following statement declares and initializes a multidimensional character array –

char menu[4][5][1]={“MEAN”, ”VARIANCE’’, “QUIT”---};


Q. 193643 What is a Multi-Dimensional array ?
A. variable.
B. vector.
C. row itself .
D. column itself.

Right Answer is:

SOLUTION

A multi dimensional array is an array which comprises of many elements each of which is itself an array. A multi-dimensional arrays are the arrays of more than one dimension.


Q. 193644 Write a statement that defines a string constant called chemical with the value “CH6H2O6H20” ?
A. variable.
B. vector.
C. row itself .
D. column itself.

Right Answer is:

SOLUTION

The following statement will declare a string "chemical" and initialize it with the value “CH6H2O6H20” -

char chemical[20]="CH6H2O6H2O";


Q. 193645 Write a statement that defines an uninitialized array to store coin types and initialize it to values 10p, 25p, 50p,1.25p.
A. variable.
B. vector.
C. row itself .
D. column itself.

Right Answer is:

SOLUTION

float currency[ ]={0.10,0.25,0.50,1.25};


Q. 193646 How does an array element accessed ?
A. variable.
B. vector.
C. row itself .
D. column itself.

Right Answer is:

SOLUTION

An array element is accessed by its array name and index number.


Q. 193647 What do you understand by index of an element?
A. variable.
B. vector.
C. row itself .
D. column itself.

Right Answer is:

SOLUTION

The element numbers within [ ] are called subscripts or indices. It specifies the position of the elements in an array and it cannot be negative.

 


Q. 193648 How does C++ view a string as? Which character marks the end of a string?
A. variable.
B. vector.
C. row itself .
D. column itself.

Right Answer is:

SOLUTION

C++ does not have a string data type rather it implements strings as single-dimensional character arrays. A string is defined as a character array that is terminated by a null character ‘0’.


Q. 193649 What is the output of the following code segment ? {
int I,j;
int sum=0;
int x[][3]={{5,4,3},{8,2,7},{5,2,1}};
for(I=0;I<3; I++)
for(j=0;j<3;j++)
sum=sum+x[I][j];
cout<< sum ;
}
A. variable.
B. vector.
C. row itself .
D. column itself.

Right Answer is:

SOLUTION

The above mentioned code segment will calculate the sum of the following matrix

5 4 3
8 2 7
5 2 1

and displays the sum as 37.

 

 


Q. 193650 Discuss diagonal elements of a matrix. Also write the diagonal elements of the following matrix
A.
1 2 3
4 5 6
7 8 9
Right Answer is:

SOLUTION

A matrix is a mathematical tool. It is a set of mn numbers arranged in the form of a rectangular array of m rows and n columns.

The elements which are available at the diagonal of a matrix are known as diagonal elements.

The diagonal elements of the matrix A are
1, 5 and 9.


Q. 193651 a) Declare an array of 25 characters.
b) In an integer type array initialize it with the first five elements.  
A. variable.
B. vector.
C. row itself .
D. column itself.

Right Answer is:

SOLUTION

a) char str[25];
b) int digit={3,5,6,9,1};


Q. 193652 Which of the following array declarations are invalid? Also state the reasons for invalidity. (i) float values[10]; (ii) double a[40]; (iii) int num[0-10];
A. variable.
B. vector.
C. row itself .
D. column itself.

Right Answer is:

SOLUTION

The (i) and (ii) statements are valid whereas the (iii) statement is invalid as the size of an array cannot be defined as 0-10.

The correct form is -

int num[11];


Q. 193653 Illustrate the process of addition of two matrices A and B, and shows the result in the third matrix i.e. C.  
Right Answer is:

SOLUTION

            matrix A              matrix B                        result matrix c

             1 2 3               9 8 7                                  10 10 10
             4 5 6               6 5 4                                  10 10 10

             7 8 9               3 2 1                                  10 10 10


 

C[i][j]=A[i][j] + B[i][j]

 


Q. 193654 Keywords that modify the meaning of base type are called


A. Reserved words.

B. Modifiers.

C. Identifiers.

D. variable.  

Right Answer is: B

SOLUTION

modifiers are used to alter the meaning of the base type. The list of modifiers are: (1) signed (2) unsigned (3) long (4) short


Q. 193655 Variables are


A. Uninitialized.

B. Initialized.

C. Dynamically Initialized.

D. All of the above.

Right Answer is: D

SOLUTION

In C++, a variable can be declared in three ways: (1) Uninitialized variable e.g. int val; (2) Initialized variable e.g. int val =5; (3) Dynamically initialized variable e.g. int val = b*c;


Q. 193656 35L is a


A. integer constant.

B. float constant.

C. long integer constant.

D. double.

Right Answer is: C

SOLUTION

An l or L suffix indicates it is long integer conatant. Thus 35L is a long integer constant.


Q. 193657 There can be


A. reference to reference.

B. no references to references.

C. partial reference to reference.

D. none of the above.

Right Answer is: B

SOLUTION

According to rules of reference, there can be no references to reference, no arrays of reference, and no pointers to reference.


Q. 193658 The 3 float types are


A. Float.

B. Double.

C. Long double.

D. All of the above.

Right Answer is: D

SOLUTION

All the above three are float types, float contain 4 byte, double contain 8 byte, long double contain 10 byte.


Q. 193659 Data types are divided into:


A. three.

B. two.

C. five.

D. one.

Right Answer is: B

SOLUTION

C++ offers two types of two types of data types: (1) Fundamental data types. (2) Derived data types.


Q. 193660 Integer data types categorised in


A. two parts.

B. four parts.

C. six parts.

D. eight parts.

Right Answer is: B

SOLUTION

There are four integer types: (1) char (2) int (3) short (4) long


Q. 193661 A floating point variable has


A. a float identifier.

B. an int identifier.

C. no identifier.

D. none of the above.

Right Answer is: A

SOLUTION

Identifier identify the type of data that a variable must hold, for floating point data we use float identifier.


Q. 193662 pointer variable is declared with 


A. + symbol.

B. - symbol.

C. * symbol.

D. / symbol

Right Answer is: C

SOLUTION

Pointeris a variable that holds a memory address. A pointer declaration consists of a base type, an *(asterisk), and  the variable name. e.g. type *ptr;


Q. 193663 Integer data types


A. Have fractional part.

B. Store real numbers.

C. Do not have a fractional part.

D. Are fractional signed numbers.

Right Answer is: C

SOLUTION

Integer data types are used to store integer values and has no concerned with fractional part.


Q. 193664 Derived data types are


A. Reference.

B. Int.

C. Void.

D. Char.

Right Answer is: A

SOLUTION

Derived data type are derived from fundamental data types(int , char, float, double, and void).


Q. 193665 A reference declaration consist of


A. base type, &(ampersand) and reference variable name.

B. base type, *(asterisk) and reference variable name.

C. base type, and reference variable name.

D. *(asterisk) and reference variable name.  

Right Answer is: A

SOLUTION

A reference variable proviodes an alias for a previously defined variable. A reference declaration consist of base type, &(ampersand) and reference variable name. e.g. type & ref_var = variable name;


Q. 193666 The data type short takes:


A. one byte.

B. Two bytes.

C. Four bytes.

D. Three bytes.

Right Answer is: B

SOLUTION

The data type short takes two bytes of storage in the memory. It is also used to store integer values.


Q. 193667 Derived data type is


A. short.

B. int.

C. long.

D. arrays.

Right Answer is: D

SOLUTION

Derived datatype can be derived from fundamental datatype. Arrays is one of the derived data type.


Q. 193668 Void is used for


A. only empty set of values.

B. only for non returning functions.

C. only functions.

D. for empty set of values & non returning functions.  

Right Answer is: D

SOLUTION

The void type specifies an empty set of values. It is used as the return type for the functions that do not return a value.


Q. 193669 Float or Double float is used for


A. fractional numbers.

B. numbers without decimal value.

C. signed integers and unsigned integers.

D. single integer.

Right Answer is: A

SOLUTION

float and double float used to represent fractional-point number.


Q. 193670 setprecision manipulator manipulates


A. sets of total number of digits of decimal places to be displayed.

B. sets the number of decimal places

C. will round off numbers.

D. all of the above.

Right Answer is: D

SOLUTION

The setprecision function can be used to set the maximum number of digits that are displayed for a number along with rounding off.


Q. 193671 Dynamic initialization can be done


A. when writing the program.

B. when the program is running.

C. while editing the program.

D. while compiling the program.

Right Answer is: B

SOLUTION

Dynamic initialization is the initialization done at run time.


Q. 193672 Memory address is given by


A. r value.

B. l value.

C. l +r values.

D. l - r value.

Right Answer is: B

SOLUTION

l value is the location value. It gives the address in memory at which its data value is stored.


Q. 193673 For double precision, floating numbers used are called


A. long data type.

B. short data type.

C. double data type.

D. char data type.

Right Answer is: C

SOLUTION

Data type double holds twice as large memory with larger range and precision.


Q. 193674 Header file used for manipulator is


A. iostream.h

B. iomanip.h

C. conio.h

D. stdio.h

Right Answer is: B

SOLUTION

In order to use the manipulators, you must include header file iomanip.h in your program.


Q. 193675 How many values are associated with variable


A. one.

B. two.

C. three.

D. four.

Right Answer is: B

SOLUTION

A variable has two associated values: (1) rvalue, which is its data value. (2) lvalue, which is its location value.


Q. 193676 The properties of 'characters' used in C++ are that, they are


A. implement dependent.

B. not implement dependent.

C. array independent.

D. structures dependent.

Right Answer is: A

SOLUTION

Characters are implement dependent. A character represents any letter, digit, special symbols and white spaces.


Q. 193677 The C++ statement , to display the memory address of a variable is


A. *a

B. a

C. &a

D. address(a)

Right Answer is: C

SOLUTION

The operator & is used to find the address, associated with a variable. The syntax of the reference operator is as follows: & variablename.


Q. 193678 A proper declaration of a pointer is


A. int x;

B. int &x;

C. ptr x;

D. int *x;

Right Answer is: D

SOLUTION

In order to define pointer variables, the programmer must use the operator '*' before variable.


Q. 193679 Comments in C ++ starts with


A. //

B. {

C. ;

D. *

Right Answer is: A

SOLUTION

C++ supports two types of comments: // for single line comments and /* */ for block of code or multiple line.


Q. 193680 A class in C++ is known as empty class if, it


A. has more than a name.

B. has no member functions.

C. is just a name.

D. has no common properties.

Right Answer is: C

SOLUTION

A empty class has no variable declarations, no functions or methods but the objects of these classes can have non–zero size.


Q. 193681 Procedural language paradigm gives more emphasis on


A. data, rather than the work performed on it.

B. doing things, rather than data itself.

C. objects and classes.

D. principles of data hiding, abstraction and encapsulation.

Right Answer is: B

SOLUTION

Procedural programming aims at procedures. It is a list of instructions telling a computer, step by step, what to do, usually having a linear order of execution, from the first statement to the last.


Q. 193682 The proper keyword, to deallocate memory is the


A. free( ) operator.

B. delete( ) operator.

C. clear( ) operator.

D. remove( ) operator.

Right Answer is: B

SOLUTION

The delete operator( )deallocates a block of memory. The argument must be a pointer to a block of memory previously allocated for an object, created with the new operator. The delete operator has a result of type void and therefore, does not return a value.


Q. 193683 The keyword used to allocate memory is


A. new( ).

B. malloc( ).

C. create( ).

D. value( ).

Right Answer is: A

SOLUTION

The new keyword allocates memory for an object, or array of objects of type-name from the free store and returns a suitably typed, non-zero pointer to the object.


Q. 193684 The C++ statement that, gives the value stored in pointer a is


A. a;

B. val(a);

C. *a;

D. &a;

Right Answer is: C

SOLUTION

* is value at address operator. Thus, it displays the value pointed by pointer a.


Q. 193685 Unary operator, used in C++ programs requires


A. two operands.

B. no operand.

C. one operand.

D. any number of operands.

Right Answer is: C

SOLUTION

C++ provides two unary arithmetic operators-unary plus and unary minus. Unary operators operate on only one operand, which could be a constant or a variable.


Q. 193686 The statement which is valid or legal in C++ is


A. an identifier can start with the "_".

B. an identifier can begin with a digit.

C. that all special characters are allowed in c++ identifiers.

D. that single character constants have type char.

Right Answer is: A

SOLUTION

Identifiers can start with "_", but not digits. Identifier is an arbitrarily long sequence of letters and digits. Upper and lower case are different. Single character constants have type int.


Q. 193687 Program element 'OxFE' is


A. an integer.

B. a character constant.

C. a hexadecimal integer constant.

D. an integer constant.

Right Answer is: D

SOLUTION

Invariant program elements are called "literals" or "constants." The terms "literal" and "constant" are used interchangeably here. OxFE is an integer constant.


Q. 193688 'n' which is used in C++, is an


A. escape sequence for start.

B. escape sequence for end.

C. escape sequence for null.

D. escape sequence for new line.

Right Answer is: D

SOLUTION

'n' sends the new line character, so it is a escape sequence for new line.


Q. 193689 Every function in c++ has its code


A. within square brackets.

B. within angular bracket.

C. within curly braces.

D. without any bracket.

Right Answer is: C

SOLUTION

Every function in c++ has its code within curly braces { }


Q. 193690 The program design method we learned, in order to write object-oriented programs uses the concept of


A. declare-define-use.

B. public functions and private variables.

C. top down programming.

D. bottom up programming.

Right Answer is: D

SOLUTION

Object oriented systems use bottom up approach. It uses concept of objects and classes.The execution would be bottom up approach because the main function is in the bottom.


Q. 193691 An array in C++


A. can have elements of different data type.

B. always has elements of the same data type.

C. will have elements of the same struct type.

D. can also define a structure within it.

Right Answer is: B

SOLUTION

Arrays refer to a named list of a finite number n of similar data elements.


Q. 193692 How many data types are there in c++


A. one.

B. two.

C. three.

D. four.

Right Answer is: B

SOLUTION

C++ offers two types of data types: (1)Fundamental data types (2)Derived data types


Q. 193693 The header file, which declares basic C++ stream I/O routines, is.


A. conio.h

B. iostream.h

C. stdio.h

D. iomanip.h

Right Answer is: B

SOLUTION

The header file iostream.h contains 2 files : istream and ostream. These have libraries of code, which we may insert in the program, by using as a reference in the top block.


Q. 193694 Vectors in C++ consists of


A. integers.

B. floating point numbers.

C. integers and floating point numbers.

D. characters.

Right Answer is: C

SOLUTION

Vectors in C++ consists of only integers and floating-point numbers.They can be resized during the execution of the program.


Q. 193695 Operators (?: ) used in C++ programs are called


A. logical operators.

B. relational operators.

C. conditional operators.

D. arithmetic operators.

Right Answer is: C

SOLUTION

Logical operators are (&&,||,!) , arithmetic operators are (+,-,*,/,%),and Relational operator is (==, <=, >=).


Q. 193696 Keywords___________ as normal identifier names


A. can not be used.

B. may/may not be used.

C. can be used.

D. can only be used.

Right Answer is: A

SOLUTION

Keywords are reserved words. They cannot be used as identifier names. It is illegal in C++.


Q. 193697 Floating constants are


A. real constant.

B. integer constants.

C. char constant.

D. binary constants.

Right Answer is: A

SOLUTION

A "floating constant" is a decimal number that represents a signed real number. The representation of a signed real number includes an integer portion, a fractional portion, and an exponent. Use floating constants to represent floating-point values that cannot be changed.


Q. 193698 The other name for fundamental data type is


A. symbolic.

B. basic.

C. simple.

D. atomic.

Right Answer is: D

SOLUTION

Fundamental (atomic) data types are those that are not composed of other data types. The five fundamental data types are : int data type, char data type, float data type, double data type and void data type.


Q. 193699 Implicit conversion in C++  is performed by


A. a programmer.

B. a compiler.

C. a preprocessor.

D. an interpreter.

Right Answer is: B

SOLUTION

There are 2 types of conversions available in C++ i.e. implicit and explicit conversions. Implicit conversions are performed by compilers in those expressions, which have mixed data types.


Q. 193700 Data type identifies


A. type of data only.

B. type of data & associated operations for handling it.

C. operations for handling data only.

D. data, operations and memory allocations.

Right Answer is: B

SOLUTION

A data type is a class, which defines the class members, their properties and the operations, which can be performed on the members. For example, int is a class of integers defining arithmetic operations on members.


PreviousNext