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

PreviousNext

Q. 193401 In arrayname[n] "n" is referred to as


A. any number.

B. number of the elements.

C. floating point number.

D. type of an array.

Right Answer is: B

SOLUTION

The syntax to declare an array is - type name[size]; Where "size" represents the number of elements in the array.


Q. 193402 Elements of an array are referred to as


A. array number.

B. element number only.

C. arrayname[n].

D. array name only.

Right Answer is: C

SOLUTION

Elements of arrays are referred to as arrayname[n], where n refers to the index number of the elements.


Q. 193403 Items of an array is of


A. different data types.

B. only float types.

C. only strings.

D. same data types.

Right Answer is: D

SOLUTION

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


Q. 193404 An array consists of


A. discrete memory locatons.

B. contiguous memory locations.

C. different memory location names.

D. virtual memory.  

Right Answer is: B

SOLUTION

An array is a collection of variables of the same type that are referenced by a common name. All arrays consist of contiguous memory location.


Q. 193405 The data type of an array is known as


A. constant.

B. floating point variable of the array.

C. variable.

D. base type of the array.

Right Answer is: D

SOLUTION

Data type declares the base type of the array, which is the type of each element in the array.


Q. 193406 Individual characters of a string can


A. be accessed as elements of the character array.

B. not be accessed as elements of character array.

C. be accessed as elemenys of floating point array.

D. can't be accessed as elements of floating point array.

Right Answer is: A

SOLUTION

Individual characters of a string can be easily accessed as they are the elements of the character array.


Q. 193407 Array should be


A. a variable type.

B. declared and defined before using it.

C. declared only.

D. indexed.

Right Answer is: B

SOLUTION

Array should be declared as well as defined before it can be used to store information.


Q. 193408 Array is a


A. basic data type.

B. basic integer data type.

C. basic floating point data type.

D. derived data type.

Right Answer is: D

SOLUTION

An array is a derived data type that is based on other basic data types. It is a collection of variables of the same type that are referenced by a common name.


Q. 193409 To declare an array named strg that holds 15 characters, the declaration statement is


A. char strg[15].

B. char strg[16].

C. float strg[15].

D. int strg[16].

Right Answer is: A

SOLUTION

The syntax to declare an array that holds characters is type name[size]; So it will be char strg[15];


Q. 193410 If an argument is a multi-dimensional array, its size must be specified. However, the size of the first dimension is 


A. equivalent.

B. mandatory to mension.

C. optional.

D. one-dimensional.

Right Answer is: C

SOLUTION

In multi-dimensional array it is necessary to mension the size of the array but the size of the first dimension is optional.


Q. 193411 The array which is not properly declared is


A. int x[5][2];

B. int n[][]=25;

C. float y[10];

D. char str[50];

Right Answer is: B

SOLUTION

While defining a two-dimensional array it is necessary to declare the size. In 2-D array the size of first dimension is optional but we need to mention the second dimension.


Q. 193412 To read or write a 2-D array we use


A. if else structure.

B. a single loop.

C. nested loops.

D. condition checking.

 

Right Answer is: C

SOLUTION

To access the elements of two-dimensional array we can use nested loop. Example of a code to access an array A[3][3] is given below - for(i=0;i<3;i++) { for(j=0;j<3;j++) { cin>>A[i][j]; } }


Q. 193413 A character array is  also known as


A. string.

B. character.

C. characters.

D. integer.

Right Answer is: A

SOLUTION

C++ does not have a string data type rather it implements string as single-dimensional character array.


Q. 193414 Mention the main application where we use structures.
A. string.
B. character.
C. characters.
D. integer.

Right Answer is:

SOLUTION

The immediate application of structure is Database Management.


Q. 193415 How is array of structures declared?
A. string.
B. character.
C. characters.
D. integer.

Right Answer is:

SOLUTION

To declare an array of structures, we must first define a structure and then declare an array variable of that type.


Q. 193416 Can functions return structures?
A. string.
B. character.
C. characters.
D. integer.

Right Answer is:

SOLUTION

Yes, functions can return structures or its references.


Q. 193417 Name the operator that we use while accessing a structure member.
A. string.
B. character.
C. characters.
D. integer.

Right Answer is:

SOLUTION

To access a strcuture member, we use the Dot(.) operator.


Q. 193418 Name the feature of C++ which allows us to define symbolic names and constants.
A. string.
B. character.
C. characters.
D. integer.

Right Answer is:

SOLUTION

#define Preprocessor directive


Q. 193419 How can we define a new data type in C++?
A. string.
B. character.
C. characters.
D. integer.

Right Answer is:

SOLUTION

In C++, we can define a new data type using a typedef keyword.


Q. 193420 Define structure?
A. string.
B. character.
C. characters.
D. integer.

Right Answer is:

SOLUTION

A structure is a collection of logically related variables referenced under one name.


Q. 193421 Identify the error in the following code fragment:

struct one{        int a;        float b; } S1; struct two { int a; float b; }S2 //elements read in S1 and S2: : S1=S2
A. string.
B. character.
C. characters.
D. integer.

Right Answer is:

SOLUTION

The error in the above code is that structure of different type has been assigned to a structure of some other type. Here, S1 and S2 are structures of different types and hence, cannot be assigned to one another.


Q. 193422 Why structures are called heterogeneous data-types?
A. string.
B. character.
C. characters.
D. integer.

Right Answer is:

SOLUTION

The data-items enclosed within a structure are known as members and they can be of the same or different data-types. Hence, a structure can be viewed as a heterogeneous user-defined data-type.


Q. 193423 Point out the errors, if any, in the following program:        #include< iostream.h >        void main()        {           Struct employee           {                char name[25];                int age;                float bs;           };        struct employee e;        strcpy(e.name, “Hacker”);        age = 25        cout < < e.name < < age;
A. string.
B. character.
C. characters.
D. integer.

Right Answer is:

SOLUTION

The error in the above code is in the following statement:

        age =25

        cout < < e.name < < age;

 

The definition of structure employee should be followed by a semicolon(;), age cannot be accessed directly. Use e.age.


Q. 193424 Differentiate between structures and classes.
A. string.
B. character.
C. characters.
D. integer.

Right Answer is:

SOLUTION

Structure is actually a class (in C++) declared with keyword struct. By default, all members are public in a structure. On the other hand, all members are private by default in classes.


Q. 193425 How is a C++ structure different from the C structure?
A. string.
B. character.
C. characters.
D. integer.

Right Answer is:

SOLUTION

In C language, we can declare only the member variables, whereas, a C++ structure can hold data members as well as member functions.


Q. 193426 State one difference between arrays and structures.
A. string.
B. character.
C. characters.
D. integer.

Right Answer is:

SOLUTION

Arrays bring together a group of items of the same data type, whereas structures bring together a group of related data items of any data type.


Q. 193427 What is the need of structures in C++ programming language?
A. string.
B. character.
C. characters.
D. integer.

Right Answer is:

SOLUTION

Although arrays greatly improved our ability to store data, there is one major drawback to their use – each element (each box) in an array must be of the same data type. It is often desirable to group data of different types and work with that grouped data as one entity. We now have the power to accomplish this grouping with a new data type called a structure.

A structure is a collection of variable types grouped together. You can refer to a structure as a single variable and to its parts as members of that variable by using the dot (.) operator.


Q. 193428 Show the memory map of the following structure elements:             Struct book           {                  char name;                  float price;                  int pages;          };

Struct book b1 = {‘B’, 130.0, 550}; [Take memory address of your own choice]
A. string.
B. character.
C. characters.
D. integer.

Right Answer is:

SOLUTION

The memory map is as follows:


Q. 193429 Write two major differences between structure and class in C++.
A. string.
B. character.
C. characters.
D. integer.

Right Answer is:

SOLUTION

 

CLASS

STRUCTURE

Declared with the keyword “class”

Declared with the keyword “struct”

By default, all members are “private” in a class

By default, all members are “public” in a structure

 


Q. 193430 Point out the errors, if any, in the following programs:        struct virus        {             char signature[25];             char status[20];             int size;        } v[2] = {                          “Yankee Doodle”, “Deadly”, 1813,                           “Dark Avenger”,”Killer”,1795                       };        void main()        {              int i;              for(i=0;i<=1;i++)                      cout < < v.signature < < v.status;        }
A. string.
B. character.
C. characters.
D. integer.

Right Answer is:

SOLUTION

The error is in the following statement:

           cout<< v.signature << v.status;

while printing signature and status, v[i].signature and v[i].status should be used.


Q. 193431 Show the storage of the members of the following structure definition –                      struct Student                      {                            int roll_no;                            char name[25];                            char branch[15];                            int marks;                      };
A. string.
B. character.
C. characters.
D. integer.

Right Answer is:

SOLUTION


Q. 193432 Discuss the importance of typedef keyword.
A. string.
B. character.
C. characters.
D. integer.

Right Answer is:

SOLUTION

There are several important uses of the typedef statement.
(i) It helps in effective documentation of a program, thus increasing its clarity. It enhances ease of maintenance of the program.
(ii) It is used for declaring new data types involving structures.
(iii) Usage of typedef is in writing portable programs. The sizes of different data types are dependent on the compiler. For instance, the size of an integer is two bytes on a 16-bit compiler and four bytes on a 32-bit compiler. Portability is achieved by type-declaring an integer as follows:
                   typedef long int INT;


Q. 193433 Declare and initialise an array of 5 structures that store rollno, name and marks of 3 subjects for students.
A. string.
B. character.
C. characters.
D. integer.

Right Answer is:

SOLUTION

struct student

        {

                int rollno;

                char name[21];

                float marks[3];

        };

        student report[5]

{
{01,”Amit”,{76.0,56.5,67.0}},   //struct 0

               {02,”Aarushi”,{82.0,96.0,85.0}},  //struct 1
               {03,”John”,{62.0,72.0,67.0}},    //struct 2
               {04,”Neha”,{71.0,69.0,57.0}},  //struct 3
               {05,”Vibha”,{70.0,77.5,81.0}},  //struct 4

       };


Q. 193434 The size of an array must be


A. a float value.

B. a double or long value.

C. an integer value or integer constant without any sign.

D. a char value.

Right Answer is: C

SOLUTION

The size of an array defines how many elements the array will hold. It must be an integer value or integer constant without any sign.


Q. 193435 The general form of an array declaration is


A. type array-name [size]:

B. type array-name [size];

C. type array-name;

D. array-name [size];

Right Answer is: B

SOLUTION

An array declaration specifies a variable type and a name along with size, to specify the number of data items the array will contain. The declaration should be terminated by semicolon.


Q. 193436 The data type of an array is known as


A. constant.

B. floating point variable of the array.

C. variable.

D. base type of the array.

Right Answer is: D

SOLUTION

Array is a data structure consisting of a group of elements that are accessed by indexing. Each element of an array has the same data type and the array occupies a contiguous area of storage.


Q. 193437 The code “int marks [50]” used in one of the C++ program is


A. not an array.

B. single dimensional array.

C. multi dimensional array.

D. two dimensional array.

Right Answer is: B

SOLUTION

The syntax of single dimension array is “datatype arrayname[size]” whereas multi dimension arrays are accessed using more than one index. For example names[][].


Q. 193438 The array a[4] will contain the elements


A. a[0], a[1], a[2], a[3].

B. a[1], a[2], a[3], a[4].

C. a[1], a[2], a[3].

D. a[0], a[1], a[2], a[3], a[4].

Right Answer is: A

SOLUTION

The array a[4]contains four elements. In c++ subscripts of an array starts with the 0.


Q. 193439 The array char names[20]; can hold


A. 19 elements from students [1] to students [19].

B. 20 elements from students [0] to students [19].

C. 21 elements from students [0] to students [20].

D. 20 elements from students [1] to students [20].

Right Answer is: B

SOLUTION

The given statement "char names[20]" declares an array of names of base type char, which can hold 20 elements.


Q. 193440 The array int students [30]; can hold


A. 30 elements from students [1] to students [30].

B. 29 elements from students [1] to students [29].

C. 30 elements from students [0] to students [29].

D. 31 elements from students [0] to students [30].

Right Answer is: C

SOLUTION

The statement "int students[30];" declares an array of students of base type int, which can hold 30 elements. The index of an array always starts from 0 to (n-1).


Q. 193441 The first location or adress of an array is also known as


A. base address.

B. highest address.

C. homogeous address.

D. contiguous adress.

Right Answer is: A

SOLUTION

An Array always stores element in the contiguous memory location. The address of the first element is also known as the base address of the array.


Q. 193442 Matrices can be represented through


A. single-dimensional array.

B. three-dimensional array.

C. two-dimensional array.

D. data structure.

Right Answer is: C

SOLUTION

Matrix is a useful concept of mathematics. Matrices can be represented through 2-D (two-dimensional) arrays.


Q. 193443 In the given array char a[5][10]; 5 specifies the 


A. number of strings.

B. base type of strings.

C. length of strings.

D. dimension of strings.  

Right Answer is: A

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. So subscript 5 will determine the number of strings.  


Q. 193444 The correct output of the following program code is #include < iostream.h > void main() { int i ; cout<< sizeof (i) << endl << sizeof (‘i’); }


A. 2 1.

B. 2 2.

C. 1 1.

D. 1 2.

Right Answer is: A

SOLUTION

In C++ language integer takes 2 bytes in memory and char takes 1 byte in memory.


Q. 193445 The error in the given code is that #include < iostream.h> void main() { char c[]=”c++ is easy”; int i = strlen (c) ; cout<< i ; }


A. there is not a getch() function.

B. c cannot be passed as an argument. It should be c[].

C. string.h header file is not defined.

D. there is no return statement for main ().

 

Right Answer is: C

SOLUTION

“string.h” header file has defined string functions in it like strlen, strcpy. These functions cannot be used without using string.h header file.


Q. 193446 The illegal statement in C++ is


A. char city[]={‘c’,’a’,’l’,’c’,’u’,’t’,’t’,’a’ }

B. char city[]=”calcutta”;

C. char prod_name[30]=”Inverters”

D. char city[]={‘c’,’a’,’l’,’c’,’u’,’t’,’t’,’a’ };

Right Answer is: D

SOLUTION

In the following statement char city[] = {'c','a','l','c','u','t','t','a'} semi-colon is missing. So it is an illegal statement in C++.


Q. 193447 Declaring an array as float x[n] is


A. valid.

B. invalid.

C. legal.

D. none  of the above

Right Answer is: B

SOLUTION

In float x[n] n has to be a constant.


Q. 193448 The arrays are


A. passed by reference.

B. passed by parameter.

C. passed by value.

D. passed by constant.

Right Answer is: A

SOLUTION

In a function the arrays are passed by reference.


Q. 193449 The character that marks the end of a string is


A. the last element entered from the keyboard.

B. terminating (;)

C. the last element.

D. null character.

Right Answer is: D

SOLUTION

null character marks the end of a string.


Q. 193450 In the following matrix 
      68 57
      67 96
element at the index [0][0] will be


A. 96

B. 68

C. 57

D. 0

Right Answer is: B

SOLUTION

In the two-dimensional array the first index points to the row number and second index points to the column number. the index [0][0] will give  access to the element of 0th row and 0th column i.e. 68.


Q. 193451 In unsized array, the size of the array is


A. calculated using the formula.

B. not calculated.

C. automatically calculated.

D. need a calculator to calculate.

Right Answer is: C

SOLUTION

Compiler automatically calculates the dimensions of the arrays in an unsized array.


Q. 193452 An array can be passed in a


A. dimension.

B. program.

C. function.

D. multi-dimensional array.  

Right Answer is: C

SOLUTION

Like other variables an array can be passed in a function as parameter.


Q. 193453 Total bytes required in the following array char A[15]; assuming char size is 1, is


A. 15 bytes

B. 14 bytes

C. 1 byte

D. 16 bytes

Right Answer is: A

SOLUTION

In a single-dimensional array total bytes required by it is always dependent on the type and size of dimensions. here total required byte is calculated using the formula - sizeof(type) X size of the dimension i.e. 1 X 15 = 15. char size is 1.


Q. 193454 Use typedef to define the types double, unsigned int, float and unsigned char.
Right Answer is:

SOLUTION

typedef double wages;
typedef unsigned int bit-vector;
typedef float money;
typedef unsigned char grade;


Q. 193455 Write a structure specification that includes two structure variables – distance and time. The distance includes two variables – both of type float – called feet and inches. The time includes three variables – all of type int – called hrs, mins and secs. Initialise such a structure with values 1345.00 feet, 8.5 inches, 10hrs, 51 mins and 17 secs.
Right Answer is:

SOLUTION

struct distance

{

        float feet;

        float inches;

};

struct time

{

        int hrs;

        int mins;

        int secs;

};

struct tour

{

        distance d1;

        time t1;

};

 

tour journey = {{1345.00,8.5},{10,51,17}};


Q. 193456 Can structure variables be initialised at the time of definition?
Right Answer is:

SOLUTION

Yes, structure variables can be initialised at the point of their definition.

Example:

struct Student

{

int roll_no;

char name[25];

char branch[15];

int marks;

};

A variable of the structure Student can be initialised as follows:

Student s1={5, “Amit”, “Electronics”, 250};


Q. 193457 What is the difference between call by value and call by reference mechanism in terms of structures?
Right Answer is:

SOLUTION

The entire structure can be passed to the function both ways:

(i)
By value and (ii) By reference

 

Call-by-Value: When a structure is used as an argument to a function, the entire structure is passed using the standard call-by-value method. Of course, this means that any changes made to the contents of the structure inside the function to which it is passed do not affect the structure used as an argument.

 

Call-by-Reference: Structures can be passed by reference just as other simple types. When a structure is passed by reference, the called function declares a reference for the passed structure and refers to the original structure elements through its reference. Thus, the called function works with the original values.


Q. 193458 What is the difference between passing a structure into a function using “call by value” and “call by reference” mechanism. Write a program to pass individual structure elements.
Right Answer is:

SOLUTION

C++ provides two different mechanism to pass a structure variable into a function –

(i) Call by Value – Here function can receive the values by creating its own copy for them. 

(ii) Call by Reference – Here function receives the references of the original variables.

/* Passing individual structure elements */

 

void main()

{

     struct book

     {

         char name[25];

         char author[25];

         int callno;

          };

          struct book b1 = {“Let us C++”, “YPK”, 101}

          display(b1.name, b1.author, b1.callno);

      }

      display(char *s, char *t, int n)

      {

            cout < < s << t < < n;

      }


Q. 193459 Discuss arrays of structures with example.
Right Answer is:

SOLUTION

An array can contain similar elements and the combination having structures within an array is an array of structures.

 

Syntax to declare a 100-element array of structures of type addr –

             addr mem_addr[100];

 

This creates 100 sets of variables that are organised as defined in the structure addr.

 

Syntax to access a specific structure, index the structure name. For instance, to print the houseno of structure 8, write –

         cout<< mem_addr[7].houseno;

 

Example of Arrays of Structures:

 

void main()

{

      struct book

      {

           char name;

           float price;

            int pages;

       };

       struct book b[100];

       int i;

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

      {

            cout<< ”Enter name, price and pages”;

            cin>>b[i].name>>b[i].price>>b[i].pages;

      }

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

             cout<< b[i].name < < b[i].price < < b[i].pages;

   }


Q. 193460 In C++, the illegal array declaration is


A. int marks[20];

B. float a[+40];

C. float amt[35];

D. float m[7];

Right Answer is: B

SOLUTION

The array size must be an unsigned integer constant. The correct form is : float a[40];


Q. 193461 In C++, the illegal array declaration is


A. char name[20];

B. double[40];

C. int st[30];

D. float m[7];

Right Answer is: B

SOLUTION

The name of the array is missing. The correct form is : double arrayname[40];


Q. 193462 In C++, the illegal array declaration is


A. int score[20];

B. int adi[4];

C. amt[35] of float;

D. float m[7];

Right Answer is: C

SOLUTION

The base type cannot appear after array name and size . The correct form is: float amt[35];


Q. 193463 In an array the highest address corresponds to the


A. first element;

B. last element;

C. middle element;

D. second last element;

Right Answer is: B

SOLUTION

In C++, all arrays consist of contiguous memory locations. The lowest address corresponds to the first element and the highest address to the last element.


Q. 193464 The area or region of a program which describes the lifetime of a variable or function is known as


A. prototype.

B. reference.

C. scope.

D. static.

Right Answer is: C

SOLUTION

In computer programming, scope is an enclosing context where values and expressions are associated. It decides the lifetime of a variable or function.


Q. 193465 The total number of bytes required to store the given array "long A[5][10]" is


A. 50.

B. 100.

C. 150.

D. 200.

Right Answer is: D

SOLUTION

The total number of bytes required = number of rows X number of columns X sizeof(base type). The bytes occupied by a long variable or element is 4 bytes. So the total bytes occupied by the array A is 5 X 10 X 4=200.


Q. 193466 The total number of bytes required to store an array short A[34] is


A. 34.

B. 36.

C. 68.

D. 136.

Right Answer is: C

SOLUTION

The total number of bytes required = number of rows X number of columns X size(of base type). Short is 2 bytes. So, 34X2 =68.


Q. 193467 The number of elements in the array "short A[34]" is


A. 0.

B. 30.

C. 34.

D. 43.

Right Answer is: C

SOLUTION

The number of elements in the array A is 34 as it is the one-dimensional array.


Q. 193468 C++ interprets the array name as the


A. address of its first element.

B. address of its last element.

C. address of its second last element.

D. value of its first element.

Right Answer is: A

SOLUTION

C++ treats the name of an array as a pointer, i.e., memory address of the first element of the array.


Q. 193469 The number of elements in the array "int A[5][40]" is


A. 45.

B. 200.

C. 35.

D. 20.

Right Answer is: B

SOLUTION

Number of elements in the array a[m][n] = number of rows (m) X number of columns(n). So the number of elements in the array A[5][40] is 200.


Q. 193470 An array in a structure


A. has elements of different data type.

B. has elements of the same data type.

C. has elements of the same struct type.

D. can also define a structure within it.

Right Answer is: B

SOLUTION

An array is a collection of elements of the same data type, that occupies contiguous memory locations.


Q. 193471 The value which can be assigned to the declared array "char names[6]" is


A. aditi.

B. priyanka.

C. Namo.

D. mudita.

Right Answer is: A

SOLUTION

One space is needed for null character, which acts as a termination symbol.


Q. 193472 One dimensional array can also be visualized as a


A. stack of elements.

B. multicolumn table.

C. multi grid.

D. single grid.

Right Answer is: A

SOLUTION

An array can also be visualize as a stack of elements.


Q. 193473 In multidimensional arrays the maximum limit of dimensions is


A. code dependent.

B. compiler dependent.

C. programmer dependent.

D. linker dependent.

Right Answer is: B

SOLUTION

C++ does not provide any limitations on the number of dimensions in multi-dimensional array. It is always compiler dependent.


Q. 193474 The array in which the size of first dimension is missing is called


A. uninitialized array.

B. unsized array.

C. sized array.

D. incomplete array.

Right Answer is: B

SOLUTION

C++ allows us to skip the size of the array in an array initialization statement. This is called as unsized array initialization.


Q. 193475 The size or memory allocated to the statement "double array a[6][4]" in bytes is


A. 192

B. 18.

C. 24.

D. 96.

Right Answer is: A

SOLUTION

The size of a 2-D array is calculated as rows x columns x size of array’s base type. Here, the array base type is double, which is equal to 8 bytes. Hence, 8 x 6 x 4 =192.


Q. 193476 The total memory occupied by the statement "float a [6][5]" is


A. 30.

B. 11.

C. 120.

D. 16.

Right Answer is: C

SOLUTION

The size of a 2-D array is calculated as rows x columns x size of array’s base type. Here, it will be 4 x 6 x 5 =120.


Q. 193477 Two-dimensional arrays are stored in the form of


A. column–row matrix.

B. column-column matrix.

C. row-row matrix.

D. row-column matrix.

Right Answer is: D

SOLUTION

In two-dimensional arrays, the first index indicates the row and the second index indicates the column.


Q. 193478 The number of elements in an array Z[5][4] is


A. 9.

B. 20.

C. 5.

D. 4.

Right Answer is: B

SOLUTION

The number of elements in an array can be calculated as number of elements in rows x number of elements in columns.


Q. 193479 The total size or memory allocated to the statement " float array a [6]" is


A. 6.

B. 24

C. 12.

D. 20.

Right Answer is: B

SOLUTION

The size of a 1-D array is calculated as number of elements in an array x size of an array's base type. Here, base type is float, which takes 4 bytes. It takes 24 bytes for its storage .i.e. 4x6 = 24.


Q. 193480 The size of the given declared array " int a [10]" is


A. 10.

B. 20.

C. 30.

D. 40.

Right Answer is: B

SOLUTION

The size of a 1-D array is calculated as number of elements in an array x size of an array‘s base type. Here, base type is int, which takes 2 bytes. It takes 20 bytes for its storage i.e. 2X10 = 20.


Q. 193481 The ASCII value for a null character is


A. 0.

B. 1.

C. 64.

D. 20.

Right Answer is: A

SOLUTION

A string is a one-dimensional character array which requires one extra character i.e. null character to indicate the termination of the string.


Q. 193482 In C++ the number of bytes occupied by an integer element in the memory is


A. two bytes.

B. one byte.

C. four bytes.

D. ten bytes.

Right Answer is: A

SOLUTION

In C++ an integer element occupies 2 bytes in memory.


Q. 193483 Elements of one-dimensional array are stored in


A. dynamic memory location.

B. static memory location.

C. contiguous memory location.

D. non-contiguous memory location.

Right Answer is: C

SOLUTION

In one-dimensional array, elements are stored in contiguous memory locations.


Q. 193484 The data structure in which the elements are stored randomly, is known as


A. homogeneous data structure.

B. non-homogeneous data structure.

C. linear data structure.

D. non-linear data structure.

Right Answer is: D

SOLUTION

Data structures like trees, binary trees, graphs and heaps are non-linear data structures, as the elements are stored in random order.


Q. 193485 The data structure in which the elements are stored sequentially, is known as


A. homogeneous data structure.

B. non-homogeneous data structure.

C. linear data structure.

D. non-linear data structure.

Right Answer is: C

SOLUTION

A data structure is said to be linear if its elements form a sequence or a linear list. For example - Arrays and Linked List


Q. 193486 When all the elements of the data structure are not of same type, then it is known as


A. homogeneous data structure.

B. non- homogeneous data structure.

C. static data structure.

D. dynamic data structure.

Right Answer is: B

SOLUTION

The data structure, which contains different types of data, is known as non-homogeneous data structure.


Q. 193487 When all the elements of the data structure are of the same type, then it is known as


A. homogeneous data structure.

B. non- homogeneous data structure.

C. static data structure.

D. dynamic data structure.

Right Answer is: A

SOLUTION

When items or entities in a group are similar, then they are said to be homogeneous. Similarly, when the elements of the data structure are of the same type,then it is known as homogeneous data structure.


Q. 193488 The starting address of the very first element of an array is known as


A. initial address.

B. flag address.

C. cell address.

D. base address.

Right Answer is: D

SOLUTION

In computing, a base address is an address serving as a reference point ("base") for other addresses.


Q. 193489 C++ implements strings as a


A. data type.

B. single dimensional character arrays.

C. two dimensional character arrays.

D. multi dimensional character arrays.

Right Answer is: B

SOLUTION

A string of characters is stored in successive elements of a character array and terminated by the null character.


Q. 193490 For two dimensional array, the computer memory is allotted in the


A. row major order only.

B. column major order only .

C. cell major order only.

D. row major or column major order.

Right Answer is: D

SOLUTION

A 2-D array stores the elements row-wise as well as column-wise as it is a two-dimensional array which stores the element in the form of row and column.


Q. 193491 The list of finite number i.e. "n" of similar data elements is known as


A. structure.

B. arrays.

C. queues.

D. trees.

Right Answer is: B

SOLUTION

An array is a data structure consisting of a group of elements of same type that are accessed by indexing.


Q. 193492 The string “Hello” is stored in a character array, msg[]. The elements of msg[] are stored in


A. msg[0] to msg[4] and msg[5] for null character.

B. msg[1] to msg[5] and no space for null character needed.

C. msg[0] for null character and msg[1] to msg[5] for Hello.

D. msg[0] to msg[4] and no space for null character needed.

Right Answer is: A

SOLUTION

A string of characters is stored in successive elements of a character array and terminated by the null character. The array subscripts in C++ starts with number 0 and not 1. So, msg[5] will be used by null character.


Q. 193493 A character array is also known as


A. string.

B. elements.

C. integer.

D. character.

Right Answer is: A

SOLUTION

A string of characters is stored in successive elements of a character array and is terminated by the null character.


Q. 193494 The name given to a structure is also known as


A. tag.

B. typedef.

C. enum.

D. S1.

Right Answer is: A

SOLUTION

Tag, the type name given to the structure becomes a reserved word within the scope of the structure.


Q. 193495 In function call : fun(a.x,a.y);


A. the members are being passed by reference.

B. the first one is passed by value and the other by reference.

C. the members are being passed by value.

D. we cannot tell how the members are being passed.

Right Answer is: D

SOLUTION

When a structure is used as an argument to a function, the entire structure is passed using the standard call by value method.


Q. 193496 A structure may be defined as a member of


A. another class.

B. literal.

C. another structure.

D. array.

Right Answer is: C

SOLUTION

A structure may be defined as a member of another structure. In such structures, the declaration of the embedded structure must appear before the declarations of other structures.


Q. 193497 Preprocessor commands are called


A. directories.

B. functions.

C. derivatives.

D. directives.

Right Answer is: D

SOLUTION

Preprocessor commands are called Directives, and begin with a pound / hash symbol(#). No white space should appear before the #, and a semicolon is NOT required at the end.


Q. 193498 The keyword typedef is used to create


A. a new user defined structure.

B. a new data type.

C. an alias for an existing data type.

D. new variables for an existing data type.

Right Answer is: C

SOLUTION

typedef does not actually create a new data class, rather it defines a new name for an existing data type.


Q. 193499 An array in a structure


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 data type.

D. can also define a structure within it.

Right Answer is: B

SOLUTION

An array is a collection of variables of same data type. Since an array contains similar elements, the combination having structures within an array is an array of structures.


Q. 193500 Passing structure through reference is useful when


A. original values are not to be changed.

B. receiving parameter does not match.

C. component members be assigned values directly.

D. original values are to be changed.

Right Answer is: D

SOLUTION

Structures passed through reference refers to the original elements through its reference. Thus, the called function works with the original values.


PreviousNext