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

PreviousNext

Q. 193501 Members of a structure can be accessed through


A. assignment operator.

B. class object.

C. dot operator.

D. fundamental data type.

Right Answer is: C

SOLUTION

The members of a structure can be accessed through the use of dot operator. Syntax: structure-name.member-name


Q. 193502 Structure assignment is possible when


A. one is structure and other is class.

B. elements are of different types.

C. structures are of same type.

D. two structures are defined.

Right Answer is: C

SOLUTION

Structure assignment is possible only if both the structures are of same type. Only assignment(=) is possible for two similar structures. Other operations, such as comparisons (== and !=) are not defined for similar structures.


Q. 193503 While accessing structure members, the item to the right of the dot is


A. structure variable name.

B. structure name.

C. subscript value.

D. structure member name.

Right Answer is: D

SOLUTION

Members of structure can be accessed using dot operator. Syntax : structure-name.member name


Q. 193504 A structure is declared with the keyword


A. structure.

B. struct.

C. define.

D. tag.

Right Answer is: B

SOLUTION

A structure is a class declared with keyword struct, which tells the compiler that a structure is being defined.


Q. 193505 A structure inside a structure is known as


A. sub structure.

B. class.

C. nested structure.

D. data type.

Right Answer is: C

SOLUTION

A structure defined within another structure is called nested structure. A structure element may be either complex or simple. The simple elements are any of the fundamental data types of C++ i.e., int, char, float, double. A structure may consist of element that itself is complex i.e., it is made up of fundamental types, e.g., arrays, structures etc.


Q. 193506 In structure, elements can be of


A. same data type.

B. int data type.

C. different data type.

D. char data type.

Right Answer is: C

SOLUTION

In structure elements can be of different data type and treated under one unit. For example, the elements storing a student's information (e.g.,rollno, name, class, marks, grade) need to be processed together. So in that situation we can use structure.


Q. 193507 The structure variable name must be followed by a


A. period (.).

B. comma(,).

C. curly brace{ }.

D. semicolon(;).

Right Answer is: A

SOLUTION

The structure variable name is followed by a period(.). Structure member can be accessed through the use of dot operator.


Q. 193508 The function will access the actual address locations of where the structures are stored when,


A. passed by value.

B. passed by reference.

C. passed by array.

D. address location is defined.

Right Answer is: B

SOLUTION

Passing by reference is the most economical method of dealing with structures and functions. The function will access the actual address locations of where the structures are stored as opposed to working with copies of the structures.


Q. 193509 Explain the precedence of dot operator.
A. passed by value.
B. passed by reference.
C. passed by array.
D. address location is defined.

Right Answer is:

SOLUTION

The dot operator is a member of the highest precedence group and its associativity is from left to right.


Q. 193510 What are the two different ways of passing structures to functions.
A. passed by value.
B. passed by reference.
C. passed by array.
D. address location is defined.

Right Answer is:

SOLUTION

Structures can be passed to function either by passing its element individually or by passing the entire structure.


Q. 193511 Write a structure definition statement to hold student related information like rollno, class, marks and grade. The definition should also declare two variables senior_student and junior_student of the same type. Make suitable assumptions wherever required.
A. passed by value.
B. passed by reference.
C. passed by array.
D. address location is defined.

Right Answer is:

SOLUTION

struct stutype

         {

               short rollno;

               short class;

               float marks;

               char grade;

        }

        senior_student, junior_student;


Q. 193512 Name the operator that is used to access a structure element through a pointer.
A. passed by value.
B. passed by reference.
C. passed by array.
D. address location is defined.

Right Answer is:

SOLUTION

Arrow (->) operator.


Q. 193513 Write a statement to access the city member of address structure which is an element of another structure worker.
A. passed by value.
B. passed by reference.
C. passed by array.
D. address location is defined.

Right Answer is:

SOLUTION

To access the given information, we need to write: worker.address.city .


Q. 193514 char strings[10][15] is known as


A. single dimensional array.

B. multidimensional arrays.

C. array of strings.

D. a single string.

Right Answer is: C

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.


Q. 193515 C++ interprets an array name as the


A. variable.

B. constant.

C. address of the last element.

D. address of the first element.

Right Answer is: D

SOLUTION

C++ interprets an array name as the address of its first element.


Q. 193516 int marks [35] is


A. not an array.

B. two dimensional array.

C. single dimensional array.

D. multidimensional array.

Right Answer is: C

SOLUTION

Single-dimensional arrays are list of same type of elements stored in contiguous memory location in their index order.


Q. 193517 Value that can be assigned to char city[5] is


A. kanpur.

B. Agra.

C. Poona.

D. Punjab.

Right Answer is: B

SOLUTION

Agra, as one space is for null character which acts as a delimiter.


Q. 193518 In terms of an array, size refers to the


A. variable size.

B. size of the data type.

C. space assigned to null character.

D. maximum number of elements of the array.

Right Answer is: D

SOLUTION

The syntax to declare an array is - type name[size]; where size refers to the number of elements that an array contains.


Q. 193519 The size of an Array can be calculated by


A. compiler.

B. functions.

C. header file.

D. strings.

Right Answer is: A

SOLUTION

When the size of an array is not defined then the size of that array can be calculated by a compiler automatically.


Q. 193520 Array can


A. not be declared along with initialization.

B. be initialized along with declaration.

C. not necessarily be declared.

D. be declared at the end of program.

Right Answer is: B

SOLUTION

An array may be initialized at the time of its declaration. Through initialization we can give initial values to the array.


Q. 193521 The index of first element of an array is


A. 1

B. 0

C. null.

D. undefined in c++.

Right Answer is: B

SOLUTION

The index of first element of an array, of size n, is 0 and the index of last element is (n-1).


Q. 193522 The following statement is invalid in C++ float [120] [150]; The reason is


A. array name is missing.

B. there should be no space between [120] and [150]

C. there should be a +sign before 150

D. float type is not valid here.

Right Answer is: A

SOLUTION

The syntax to declare a two-dimensional array is as follows - type Array_name[size_of_row][size_of_column]


Q. 193523 Multidimensional arrays are the arrays of


A. single dimension.

B. two dimension.

C. more than two dimension.

D. null dimension.

Right Answer is: C

SOLUTION

C++ allows to have arrays with more than two dimensions.Manipulation takes more time in these types of arrays.


Q. 193524 Single dimensional arrays are similar to the


A. list of information.

B. column of information.

C. matrix of information.

D. type of information.

Right Answer is: A

SOLUTION

Single dimensional array is a collection of storage locations for a specific type of data in a series.


Q. 193525 we can skip the size of an array in a/an


A. unsized array.

B. sized array.

C. dualsized array.

D. nullsized array.

Right Answer is: A

SOLUTION

In C++ we can skip the size of an unsized array while initialization. It automatically calculates the dimensions of unsized arrays.


Q. 193526 The operator that returns the size of the data type on a system is


A. size

B. sizeof

C. data type

D. amount

Right Answer is: B

SOLUTION

sizeof is the operator that calculate the size of a operand. Syntax to use it is given below - sizeof(type) Ex- sizeof(int) returns 2 bytes as an int data type occupies 2 bytes in the memory.


Q. 193527 Array of strings is


A. a multidimensional integer array.

B. a two dimensional integer array.

C. a single dimensional array.

D. a two dimensional character array.

Right Answer is: D

SOLUTION

Arrays of strings are created using a two-dimensional character array. The first index determines the number of strings and second index determines the length of each string.


Q. 193528 Total  Bytes required by the array int x[5] [6], assuming int size is 2 bytes, is


A. 30 bytes.

B. 60 bytes.

C. 120 bytes.

D. 30 bytes .

Right Answer is: B

SOLUTION

The amount of storage required to hold a two-dimensional array is also dependent upon its base type, number of rows and number of columns. The formula to calculate total number of bytes required by a two-dimensional array is given below - total bytes = number of rows x number of columns x sizeof(base type)


Q. 193529 The amount of storage required to hold an array is


A. directly related to its type and size.

B. directly related to its size.

C. directly related to its type.

D. 1 byte only.

Right Answer is: A

SOLUTION

An array definition specifies a variable type and size to know how many data items the array will contain.


Q. 193530 Consider an Array P[3] ={1,2,3} Here P[1] will point to


A. 0

B. 3

C. 2

D. 1

Right Answer is: C

SOLUTION

Indexing of elements in an array always starts from 0. So P[0] will point to first element of the array.


Q. 193531 x[5] is a/an


A. int variable.

B. one-dimensional array.

C. two-dimensional array.

D. multi-dimensional array.

Right Answer is: B

SOLUTION

An one-dimensional array is the simplest form of an array where the number of dimension is only one.


Q. 193532 A string is considered as


A. integer array.

B. single dimension character array.

C. floating array.

D. two dimensional character arrays.

Right Answer is: B

SOLUTION

A string is defined as a character array as C++ does not have a string data type so it implements a string as single-dimension character array.


Q. 193533 In a 2-D array the first and the second indices respectively depicts


A. columns and rows.

B. rows and columns.

C. four multidimensional array.

D. row to row array.

Right Answer is: B

SOLUTION

The syntax of declaring a two-dimensional array is type name[i][j]; where i refers to the number of rows and j refers to the number of columns


Q. 193534 A structure can be assigned to another structure, if


A. both are of the same data type.

B. both have members of the same data type.

C. tag was omitted while defining the structures.

D. both of them do not contain arrays.

Right Answer is: A

SOLUTION

v1 = v2 will work only, when both are of the same data type.


Q. 193535 The keyword typedef can be used


A. with any data type.

B. only with fundamental data types.

C. only with user defined data types.

D. only with float data type.

Right Answer is: A

SOLUTION

typedef is used to give an alias name to the existing data types.


Q. 193536 To pass a structure to a function by value,


A. pass a reference to it.

B. pass its address using a pointer variable.

C. pass it as a structure variable.

D. pass it as an array.

Right Answer is: C

SOLUTION

Since, the structure variable belongs to the structure data type. Thus, it has to be passed in the form of a structure.


Q. 193537 When reference to a structure is passed to a function,


A. any change made is only temporary.

B. changes are made in the original values of the variable.

C. reference to the entire structure can’t be passed.

D. changes cannot be made when reference to a structure is passed.

Right Answer is: B

SOLUTION

In call by reference, the original values get changed.


Q. 193538 An array of structure has elements


A. of different data types.

B. of same data types.

C. which are themselves arrays.

D. which are themselves structures.

Right Answer is: D

SOLUTION

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


Q. 193539 A structure is a class declared with keyword


A. struct.

B. structure.

C. stct.

D. strct.

Right Answer is: A

SOLUTION

In C++, a structure is a class declared with keyword struct and by default, all members are public in a structure whereas all members are private by default in a class.


Q. 193540 Given the following definitions and declarations :
struct date{ int day; int mon; int year; } ; struct DATE{ int day; int mon; int year; } ; date d1,d2; DATE D1,D2; The incorrect statement is


A. d1=d2;

B. D1=d2;

C. date d3={22,8,2005};

D. DATE D={4,3,1999};

Right Answer is: B

SOLUTION

D1=d2 is wrong,  because both are different data types.
Structure assignment is possible only if both the structures are of same structure type.


Q. 193541 The error in the following structure definition, is