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

PreviousNext

Q. 189701 The class, which defines an interface, but does not necessarily provide implementations for all its member functions, is called as


A. base class.

B. concrete class.

C. abstract class.

D. super class.

Right Answer is: C

SOLUTION

An abstract class is meant to be used as a base class from which other classes are derived.


Q. 189702 When we want to change the gears of a motorbike, we don’t need to know how the gear mechanism works, we just need to know which lever to move. This is an example of


A. Abstraction.

B. Inheritance.

C. Encapsulation.

D. Modularity.

Right Answer is: A

SOLUTION

Abstraction is the process by which data and programs are defined with a representation similar to its meaning (semantics), while hiding away the implementation details. Abstraction tries to reduce and factor out details so that the programmer can focus on a few concepts at a time.


Q. 189703 The act of representing essential features without including the background details and explanations is


A. data abstraction.

B. encapsulation.

C. data hiding.

D. inheritance.

Right Answer is: A

SOLUTION

Data abstraction is focusing on the important features leaving behind the unessential part.


Q. 189704 The concept in which the unessential features or background details are hidden from the world is known as


A. data abstraction.

B. encapsulation.

C. data hiding.

D. inheritance.

Right Answer is: C

SOLUTION

Data hiding is a related concept to data abstraction.


Q. 189705 With software objects, we don’t need to know how a method is implemented we just need to know which method to invoke and its interface. This is an example of


A. data abstraction.

B. data hiding.

C. data encapsulation.

D. modularity.

Right Answer is: C

SOLUTION

Through encapsulation, an inteface is made available to the world through which users can use the class.


Q. 189706 Procedural programming is


A. the best programming method.

B. a programming method that localizes the implementation details.

C. a programming method, which implements oops concepts.

D. a programming method, which leads to increased time and cost overheads during design changes.

Right Answer is: D

SOLUTION

Procedural programming is susceptible to design changes, which leads to many modifications in the code. This results in increased time and cost overheads at times.


Q. 189707 The methodology of designing and implementing the programs using the key features and building blocks of a programming language is called


A. programming paradigm.

B. programming procedure.

C. programming function.

D. programming class.

Right Answer is: A

SOLUTION

Paradigm refers to a way of doing things. A programming paradigm gives you an idea how problems are generally analyzed and solved in a particular programming language.


Q. 189708 The data that can be accessed by the non–member functions, through the objects of that class is


A. protected data.

B. private data.

C. public data.

D. local data.

Right Answer is: C

SOLUTION

Public data is accessible even outside the class.


Q. 189709 The data that can be accessed only through the member functions of that class is


A. public data.

B. private data.

C. either public or private data.

D. protected data.

Right Answer is: B

SOLUTION

Private data is accessible within a class only.


Q. 189710 A class represents a group of


A. similar objects.

B. different types of objects.

C. different entities.

D. same variables and different data types.

Right Answer is: A

SOLUTION

A class is a way to bind the data describing an entity and its associated functions together.


Q. 189711 Member function is a function defined within a class that acts on


A. the data members of the class.

B. the data members outside the class.

C. the methods within the class.

D. the objects.

Right Answer is: A

SOLUTION

There are two kinds of members in a class: data members and member functions. Data members are exactly like the variables in a structure and member functions act on data members of the class.


Q. 189712 A function declared within the definition of a class is called


A. data.

B. method.

C. variable.

D. scope resolution operator.

Right Answer is: B

SOLUTION

A class is a collection of data members and member functions, which operate on them. The functions defined within a class, is called as member functions or methods.


Q. 189713 Usually, the data and member functions in a class are


A. public and private.

B. public.

C. private.

D. private and public.

Right Answer is: D

SOLUTION

The data within a class is private, i.e., the data is hidden so that it will be safe from accidental manipulation. The functions are public so that they can be accessed from outside the class.


Q. 189714 When a system determines how to implement an action at run time, is called


A. late binding or virtual binding.

B. static binding.

C. early binding.

D. compile time binding.

Right Answer is: A

SOLUTION

Name binding is an association of values with identifiers. The binding performed as the program runs is called dynamic binding or late or virtual binding.


Q. 189715 Inheritance refers to


A. The ability to perform according to the situation.

B. The ability to acquire features of another class.

C. The wrapping up of data and associated functions into a unit.

D. Protecting data from access by any function.

Right Answer is: B

SOLUTION

Inheritance is a way to form new classes (instances of which are called objects) using classes that have already been defined. Inheritance is intended to reuse existing code with little or no modification. The new classes, known as derived classes, inherit attributes and behavior of the pre-existing classes, which are referred to as base classes (or ancestor classes).


Q. 189716 Data Encapsulation refers to


A. Ability to be in different forms.

B. Representing essential features.

C. Binding data and functions together.

D. Process of argument matching.

Right Answer is: C

SOLUTION

Data encapsulation is the wrapping up of data within a classes, enhancing information hiding features.


Q. 189717 Data Hiding refers to


A. Ability to be in different forms

B. Representing essential features

C. Making data inaccessible to outside functions

D. Ability to take on features of another class

Right Answer is: C

SOLUTION

Data hiding is a characteristic of object-oriented programming in which an object can only be associated with data in predefined classes or templates.


Q. 189718 Data Abstraction refers to


A. Representing essential features

B. Bundling data and functions together

C. An entity with some properties

D. Ability to be in different forms

Right Answer is: A

SOLUTION

Data abstraction is the process of representing essential features without including implementation details.


Q. 189719 Instructions are given in sequence in


A. object Based programming

B. object Oriented programming

C. procedural programming

D. advanced programming

Right Answer is: C

SOLUTION

In Procedural programming, programs are written as a list of instructions in a sequence.


Q. 189720 The concept of inheritance supports


A. reusability of class.

B. renaming of class.

C. decomposing of class.

D. encapsulation of hierarchy.

Right Answer is: A

SOLUTION

In object-oriented programming, inheritance is a way to form new classes (instances of which are called objects) using classes that have already been defined.


Q. 189721 Encapsulation, data abstraction and data hiding are implemented through


A. classes

B. functions

C. modules

D. program

Right Answer is: A

SOLUTION

To implement all OOP features in C++, like Encapsulation, data abstraction and data hiding we need to use classes.


Q. 189722 A class implements


A. Data hiding, Encapsulation, Maintenance

B. Function signature, Encapsulation, Abstraction

C. Data hiding, Procedural Paradigm, Abstraction

D. Data hiding, Encapsulation, Abstraction

Right Answer is: D

SOLUTION

Data hiding is a characteristic of object-oriented programming in which an object can only be associated with data in predefined classes or templates. The object can only "know" about the data it needs to know about. Encapsulation is the inclusion of one thing within another thing so that the included thing is not apparent. Abstraction is the process or result of generalization by reducing the information content of a concept or an observable phenomenon, typically to retain only information which is relevant for a particular purpose.


Q. 189723 A function's signature


A. gives the list of arguments with type.

B. gives the list of arguments with function's return type.

C. gives different definitions of the function.

D. gives the different names of the same function.

Right Answer is: A

SOLUTION

The function signature defines the set of traits associated with the activation of a function object.


Q. 189724 Function overloading is a form of


A. abstraction.

B. polymorphism.

C. encapsulation.

D. concoction.

Right Answer is: B

SOLUTION

Function overloading (also polymorphism or method overloading) is a programming concept that allows programmer to define two or more functions with the same name, having different arguments.


Q. 189725 Concrete class


A. can have any number of objects.

B. cannot have objects.

C. generally behaves as a base class.

D. can have neither data nor functions.

Right Answer is: A

SOLUTION

The derived class is expected to provide implementations for the member functions that are not implemented in the base class. A derived class that implements all the missing functionality is called a concrete class .


Q. 189726 An abstract Class


A. can have only one object.

B. can have neither data nor functions.

C. cannot access member functions.

D. does not generally have objects declared.

Right Answer is: D

SOLUTION

An abstract class is a class that is declared abstract—it may or may not include abstract methods. Abstract classes cannot be instantiated, but they can be subclassed.


Q. 189727 Late binding is done


A. to link objects to data.

B. at compile time.

C. at run time.

D. to bind data to functions.

Right Answer is: C

SOLUTION

Late binding is done at run time, to link function call with the code to execute.


Q. 189728 Early binding is done


A. to link objects to data

B. at compile time

C. at run time

D. to bind data to functions

Right Answer is: B

SOLUTION

Early binding - Assigning values to variables during design time or exposing object model at design time.


Q. 189729 Static binding is also known as


A. disambiguation.

B. static-linking.

C. function overloading.

D. function's signature.

Right Answer is: B

SOLUTION

Static binding is the selection of a particular call at the compile-time.


Q. 189730 When a system determines how to implement an action at compile time, is called


A. late binding.

B. static binding.

C. dynamic binding.

D. run time binding.

Right Answer is: B

SOLUTION

Name binding is an association of values with identifiers. The binding of names before the program runs is called static binding.


Q. 189731 Write overloaded prototypes of the function Calcvol( ), as functions that calculate volume of a cube, a cuboid and a cylinder. There should be three prototypes – the cube is measured in int, the cuboid has its length in float and end dimensions in int, the cylinder has the length in int and radius in float.
Right Answer is:

SOLUTION

int Calcvol( int s);                    // for a cube s*s*s

int Calcvol( float l, int s);                // for cuboid l*s*s

int Calcvol(int l,float r);                   // for cylinder 3.1416*r*r*l 


Q. 189732 The function XYZ( ) has multiple definitions, as shown below.  If the function call is XYZ(23,50.5,’A’)   , which of these will be called?             
 a.  void XYZ( int a, int b, char c) {...............}
 b.  void XYZ(int a, float b, char c ) {...............} 
 c.  void XYZ(int a, int b ) {...............}
Right Answer is:

SOLUTION

b. void XYZ(int a, float b, char c ), as the arguments list matches.


Q. 189733 Look at the function prototype for calcint( ) -   int calcint( int, int, int);  The function accepts Principal, Rate and Time and returns Simple Interest after calculating.  Give an overloaded prototype which accepts only Principal.
Right Answer is:

SOLUTION

int calcint( int);


Q. 189734 In arrays, all elements are of


A. different data type.

B. int data type.

C. same data type.

D. char data type.

Right Answer is: C

SOLUTION

Arrays hold a fixed number of equally-sized data elements, which are of same data type.


Q. 189735 By default, all structure members are


A. protected.

B. public.

C. private.

D. restricted.

Right Answer is: B

SOLUTION

All structure members are public by default; class variables and constants are private by default, while other class members are public by default.


Q. 189736 When the structure is defined without a tag, the number of variables that can be declared is


A. one.

B. two.

C. several.

D. limitless.

Right Answer is: A

SOLUTION

A structure tag name can be used to declare variable of a structure type.


Q. 189737 The operator that accesses structure member via a pointer to object is


A. line operator.

B. this operator.

C. arrow operator.

D. bow operator.

Right Answer is: C

SOLUTION

The -> (arrow) operator is used to access class, structure or union members using a pointer. A postfix expression, followed by an -> (arrow) operator, followed by a possibly qualified identifier or a pseudo-destructor name, designates a member of the object to which the pointer points.


Q. 189738 The keyword typedef is used to


A. create a new user defined structure.

B. define new data type names.

C. create an alias for an existing data type.

D. create new variables for an existing data type.

Right Answer is: B

SOLUTION

Every variable has a data type. typedef is used to define new data type names to make a program more readable to the programmer.


Q. 189739 The technique that saves time when one is writing programs, that use similar structures is


A. copy structure.

B. nested structure.

C. typedef structure.

D. UDT structure.

Right Answer is: B

SOLUTION

Nested structure enables us to nest one structure definition within another.


Q. 189740 A structure within a structure is called


A. enclosed structure

B. contained structure

C. nested structure

D. doubled structure

Right Answer is: C

SOLUTION

A structure can contain other structure as member.


Q. 189741 The directive that is used to replace an instruction in the code is


A. #define.

B. *define.

C. &define.

D. $define.

Right Answer is: A

SOLUTION

The #define directive can be used to either define a constant number or function or to replace an instruction in the code.


Q. 189742 The user defined data type that defines a new name for an existing type is known as


A. enum.

B. macro.

C. #define.

D. typedef.

Right Answer is: D

SOLUTION

The typedef does not actually create a new data class, rather it defines a new name for an existing type. This can increase the portability of a program as only the typedef statements would have to be changed. The syntax of typedef statement is : typedef type name;


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

Every variable has a data type. The keyword typedef is used to define new data type names to make a program more readable to the programmer.


Q. 189744 If the function prototype is void fun(ABC &, char[]); then


A. structure variable will be passed by reference, the array by value.

B. structure variable and the array will be passed by reference.

C. structure variable will be passed by value and the array by reference.

D. structure variable and the array will be passed by value.

Right Answer is: B

SOLUTION

Pass by reference refers to a method of passing the address of an argument in the calling function to a corresponding parameter in the called function.


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

Two ways to pass arguments to a function are: pass by value and pass by reference. With pass-by-reference, the caller gives the called function the ability to access the caller's data directly and to modify that data if the called function chooses to do so.


Q. 189746 The dot operator is used to refer to individual


A. tree elements.

B. graph elements.

C. character elements.

D. structure elements.

Right Answer is: D

SOLUTION

The . (dot) operator is used to access class, structure, or union members. The member is specified by a postfix expression, followed by a . (dot) operator, followed by a possibly qualified identifier or a pseudo-destructor name. The postfix expression must be an object of type class, struct or union. The name must be a member of that object.


Q. 189747 The most appropriate statement regarding EMP[45].salary.tax is that


A. there is an array of structure.

B. there is a nested structure with an array.

C. there is an array of nested structure.

D. the nested structure has an array.

Right Answer is: C

SOLUTION

The members of stuctures are accessed using dot operator. For example: To access the city member of address structure which is an element of another structure worker, we shall write: worker.address.city


Q. 189748 A structure is actually a


A. pointer declared with keyword struct.

B. variable declared with keyword struct.

C. class declased with keyword struct.

D. function declared with keyword struct.

Right Answer is: C

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. 189749 A group of related data items of any data type is known as


A. class.

B. pointer.

C. structure.

D. data verification.

Right Answer is: C

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. 189750 A structure can be assigned to another structure if


A. both are of the same type.

B. both have members of the same type.

C. tag was omitted while defining the structure.

D. both are of different types.

Right Answer is: A

SOLUTION

Copy structure can also be assigned to another structure only if both the structures are of same type.


Q. 189751 UDT stands for


A. Universal Demand Transmission.

B. User Defined Target.

C. User Defined Data Types.

D. Universal Defined Types.

Right Answer is: C

SOLUTION

User defined data types are created with the help of struct or class keywords.


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

When we pass a structure as an argument, remember that the argument and the parameter are not the same variable. Instead, there are two variables (one in the caller and one in the callee) that have the same value, at least initially.


Q. 189753 Copy structure is a structure that can be assigned to another structure only if


A. it nests one structure definition within another.

B. it returns structures or its reference.

C. it defines new data type.

D. both the structures are of same type.

Right Answer is: D

SOLUTION

A copy constructor is a special constructor in the C++ programming language used to create a new object as a copy of an existing object. The first argument of such a constructor is a reference to an object of the same type as is being constructed, which might be followed by parameters of any type.


Q. 189754 What is operator overloading?
A. it nests one structure definition within another.
B. it returns structures or its reference.
C. it defines new data type.
D. both the structures are of same type.

Right Answer is:

SOLUTION

When an operator displays different behaviour in different situations, it is called operator overloading.  For example, ‘+’ is used to add numbers but it can be ‘overloaded’ to add two structure variables or class objects.


Q. 189755 How is Polymorphism implemented ?
A. it nests one structure definition within another.
B. it returns structures or its reference.
C. it defines new data type.
D. both the structures are of same type.

Right Answer is:

SOLUTION

Polymorphism is implemented through Operator Overloading , Function Overloading and Virtual Functions.


Q. 189756 What are objects?
A. it nests one structure definition within another.
B. it returns structures or its reference.
C. it defines new data type.
D. both the structures are of same type.

Right Answer is:

SOLUTION

An object is a basic entity in an Object Oriented System.  It may represent a person, a publication, a place or any item for which the program may handle data.  It is also defined as an instance of a class. 


Q. 189757 Mention some shortcomings of procedural programming.
A. it nests one structure definition within another.
B. it returns structures or its reference.
C. it defines new data type.
D. both the structures are of same type.

Right Answer is:

SOLUTION

Larger and more complex programs are very difficult to maintain.

Emphasis is on procedure rather than data.

The way data is stored is critical and if the arrangement of data is changed, all functions that access it have to be changed.

Data elements are not very secure as most data to be shared by functions is declared globally.


Q. 189758 What is Procedural programming ?
A. it nests one structure definition within another.
B. it returns structures or its reference.
C. it defines new data type.
D. both the structures are of same type.

Right Answer is:

SOLUTION

A procedural program is written as a list of instructions, telling the computer, step-by-step, what to do: accept  price,  write in file, display item code, name, price, profit etc.


Q. 189759 What is meant by programming paradigms?
A. it nests one structure definition within another.
B. it returns structures or its reference.
C. it defines new data type.
D. both the structures are of same type.

Right Answer is:

SOLUTION

Paradigm refers to a way of doing something.   
Programming paradigm refers to an approach to or style of programming.


Q. 189760 What is Dynamic binding (or late binding)?
A. it nests one structure definition within another.
B. it returns structures or its reference.
C. it defines new data type.
D. both the structures are of same type.

Right Answer is:

SOLUTION

When the selection of the appropriate function is done dynamically at run time.  This is generally when virtual functions are in use.


Q. 189761 What is static binding (or early binding)?
A. it nests one structure definition within another.
B. it returns structures or its reference.
C. it defines new data type.
D. both the structures are of same type.

Right Answer is:

SOLUTION

When the compiler is able to select the appropriate function at compile time, based on a function call, it is called early or static binding.  This is generally when overloaded functions are in use.


Q. 189762 Discuss -

a) Abstract class.          
b) Concrete class.
A. it nests one structure definition within another.
B. it returns structures or its reference.
C. it defines new data type.
D. both the structures are of same type.

Right Answer is:

SOLUTION

(a) An abstract class is used as a base class from which other classes are derived.  No objects are declared for this class.
(b) A concrete class is derived from an abstract class and generally has object declared.


Q. 189763 In case of Overloaded Functions, how does the compiler decide which function to call?
A. it nests one structure definition within another.
B. it returns structures or its reference.
C. it defines new data type.
D. both the structures are of same type.

Right Answer is:

SOLUTION

A function call first matches the number of arguments and the type of arguments and then calls the appropriate function. 

1.  The compiler first tries to find an exact match, where the number and types of actual and formal arguments are the same.

2.  If there is no exact match, the compiler uses integral promotion to find a match for example, char can easily be converted to int.

3.  If the above two does not work, then the compiler tries the built-in conversions to the actual parameters and then uses the function which matches. At times, there are multiple matches, and an error is generated. 

4.  Finally, the compiler will try to find a match through user-defined conversions along with integral promotion and built-in conversions.


Q. 189764 What is the function’s signature?
A. it nests one structure definition within another.
B. it returns structures or its reference.
C. it defines new data type.
D. both the structures are of same type.

Right Answer is:

SOLUTION

The functions signature is its argument list. It includes the number and type of arguments. 

Consider two functions –  void fadd(int a, int b);  and  int fadd(int x, int y); 

- as their argument lists are the same, they have the same signature, even when return type is different.


Q. 189765 What is function overloading?  What are the points to be kept in mind while overloading a function ?
A. it nests one structure definition within another.
B. it returns structures or its reference.
C. it defines new data type.
D. both the structures are of same type.

Right Answer is:

SOLUTION

When the same function name has different definitions, it is known as function overloading.  The definitions differ in the number and types of the arguments. 

We must note that  
 

(i) The overloaded functions must have different arguments lists.
(ii) Overloading functions with the same argument list but different return type is not allowed.
(iii) Member functions cannot be overloaded by making one static and the other not, arguments being the same.There should be no ambiguity.


Q. 189766 What are the advantages of using OOP?
A. it nests one structure definition within another.
B. it returns structures or its reference.
C. it defines new data type.
D. both the structures are of same type.

Right Answer is:

SOLUTION

Advantages are –
 

(i)  Reusability of code through classes and inheritance.

(ii)  Data hiding helps to build secure programs.

(iii) Classes can be designed to represent real world entities, along with data and  behaviour.

(iv) The data centered design lets us collect data in a more implementable form.

(v)  Multiple object co-exist without any interference.

  (vi)  Making modifications is relatively easier.


Q. 189767 How does Object Based Programming differ from Object Oriented Programming?
A. it nests one structure definition within another.
B. it returns structures or its reference.
C. it defines new data type.
D. both the structures are of same type.

Right Answer is:

SOLUTION

Object Based Programming bundles data and the functions that access it into a single unit, called class.  Features include encapsulation, data hiding and abstraction. 

 

Object Oriented Programming too bundles data and the functions that access it into a single unit, called class.  Some important features are encapsulation, data hiding, abstraction, inheritance and polymorphism. 

 


Q. 189768 Name the important  OOP concepts.
A. it nests one structure definition within another.
B. it returns structures or its reference.
C. it defines new data type.
D. both the structures are of same type.

Right Answer is:

SOLUTION

Some concepts used extensively in Object Oriented Programming are – 


            (i)  Data abstraction

(ii) Encapsulation

(iii) Data hiding

(iv) Inheritance

            (v) Polymorphism


Q. 189769 How  are Data Hiding, Data Abstraction and Encapsulation implemented?
A. it nests one structure definition within another.
B. it returns structures or its reference.
C. it defines new data type.
D. both the structures are of same type.

Right Answer is:

SOLUTION

A class binds together data and functions that access it, thus enforcing encapsulation. 

The class represents essential features of the object, thus enforcing data abstraction.

In the class, members are classified as private, protected and public.  Accessibility of the members depends on which category they are under.  Private and protected members can only be accessed by other members of the class, thus enforcing data hiding.


Q. 189770 Explain in brief :
    a)  Encapsulation              b)  Data hiding                    c)  Abstraction                  d)  Inheritance     e)  Polymorphism              
A. it nests one structure definition within another.
B. it returns structures or its reference.
C. it defines new data type.
D. both the structures are of same type.

Right Answer is:

SOLUTION

a)  Encapsulation  -  wrapping up of data and functions into a single unit is known as encapsulation.    

 

b)  Data hiding   -   insulation of data from direct access by the program is known as data hiding.        

 

c)  Abstraction  -  the inclusion of essential features, ignoring background details is known as abstraction.     

 

d)  Inheritance  -  the process by which objects of one class acquire the properties of the objects of another class is known as inheritance.

   

e)  Polymorphism -  the ability to exhibit different behaviour in different situations  is  known as polymorphism.  

 


Q. 189771 A constant that remains unchanged is called a/an


A. variable.

B. symbolic constant.

C. structure constant.

D. element.

Right Answer is: B

SOLUTION

Symbolic constant is a constant (value that does not change) with a name.


Q. 189772 Among the following, the properly defined structure is


A. struct st{ int i; };

B. struct st{ };

C. struct st{}

D. struct st{int};

Right Answer is: A

SOLUTION

A structure is defined with the following syntax:
                struct struct_name
                {                    datatype variable_name;                 };


Q. 189773 struct date{
               int day;               int month;               int year;                              }; When the above structure is declared then,


A. it reserves memory space for the components.

B. it just defines the data.

C. it defines and provides a memory space to structure and not its components.

D. the compiler stores the components.

Right Answer is: B

SOLUTION

At this point of time, just the structure is being defined. Memory space is reserved when its variable is declared.


Q. 189774 The output of the code given below is:
#include < iostream.h >
struct Sumval
{
int a,b;
}
void Struct_Fun(SumVal Sv)
{
Sv.b = 2.5;
cout<< Sv.a << Sv.b;
}
void main ( )
{
Sumval Sv;
Sv.a=100;
Sv.b=1.5;
Struc_Fun(Sv);
cout<< Sv.a << Sv.b;
}


A. 10021001

B. 10021100

C. 10011002

D. 20010012

Right Answer is: A

SOLUTION

cout will display the values of a and b, which are the members of function struct. These members are called with the help of dot operator.


Q. 189775 A structure brings together a group of


A. items of the same data type.

B. related data items.

C. integers with user defined names.

D. variables.

Right Answer is: B

SOLUTION

A structure is a collection of variables referenced under one name. It is a utility to access two or more interrelated variables.


Q. 189776 The proper declaration of a variable of struct 'foo' is


A. struct foo;.

B. foo var;.

C. foo;.

D. int foo;.

Right Answer is: A

SOLUTION

A structure is declared using the struct keyword, followed by its name.


Q. 189777 When a function is called, it works with the original values in


A. call by value.

B. call by reference.

C. call by behaviour.

D. call by context.

Right Answer is: B

SOLUTION

When a function is passed by reference the called function declares a reference for the passed structure and refers to the original structure elements through its reference.  


Q. 189778 An array in a structure


A. can have elements of different data type.

B. can have elements of the struct data type.

C. always have elements of the same data type.

D. can also define a structure within it.

Right Answer is: C

SOLUTION

An array wherever being declared, should contain elements of the same data type.


Q. 189779 Out of the following statements, the incorrect statement about typedef is


A. It does not create a new data type.

B.

It creates just an alias for an existing data type.

C. An alias type name is defined for a standard data type.

D. It creates a new data type.

Right Answer is: D

SOLUTION

A typedef creates a new name to the existing datatype.


Q. 189780 To store addresses of 50 students of a school, we will write


A.

addr stu_addr[50];

B.

addr stu_addr{50};

C. addr stu_addr50;

D. addr stu_addr(50);

Right Answer is: A

SOLUTION

This statement would create 50 sets of variables. To declare an array of structures, you must define a structure and then declare an array variable of that type.


Q. 189781 In the given function call: fun (a.x, a.y);


A. the members are being passed by reference.

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

C. the members are being passed by value.

D. the members are passed by structure.

Right Answer is: C

SOLUTION

Both are being passed by value since, no reference variable is being used.


Q. 189782 If, Function call : fun(a, b.c); Function prototype : void fun(int, int&) then, the


A. structure member is being passed by value.

B. structure member is being passed by reference.

C. structure member will not be passed at all.

D. structure member will lose its value.

Right Answer is: A

SOLUTION

Here, the structure variable is being passed by value. As a result, there wouldn’t be any change in the values of the structure variable.


Q. 189783 To access a member c of structure C in variable cc, the statement would be


A. C.c;.

B. C.cc.c;.

C. cc.c;.

D. C.cc;.

Right Answer is: C

SOLUTION

Since c is a member of variable cc therefore, cc.c is used to access it.


Q. 189784 The most appropriate statement regarding: "EMP[45].salary.tax" is that


A. it is an array of structure.

B. it is a nested structure with an array.

C. it is an array of nested structure.

D. it is a nested structure that has an array.

Right Answer is: C

SOLUTION

EMP[45] is an array of a structure salary nested inside a structure tax.


Q. 189785 The # symbol in a C++ program, signifies a


A. link file.

B. execution file.

C. preprocessor directive.

D. batch file.

Right Answer is: C

SOLUTION

A # sign in the beginning of a statement means, it is a preprocessor directive, i.e., the instructions given here will be processed before the program is compiled.


Q. 189786 Nested structures are also called


A. referencing structures.

B. complex structures.

C. recursive structures.

D. looping structures.

Right Answer is: B

SOLUTION

A structure inside another structure is called nested structure.


Q. 189787 With reference to the given function prototype i.e. void fun (ABC &, char []); the


A. structure variable will be passed by reference and the array by value.

B. structure variable and the array will be passed by reference.

C. structure variable will be passed by value and the array by reference.

D. structure variable and the array will be passed by value.

Right Answer is: A

SOLUTION

For ABC, a reference variable is being used while for char, it is being passed by value.


Q. 189788 After the statement, typedef float money; the one that will generate an error is


A. money membership;

B. float charges;

C. typedef salary amount;

D. typedef money fees;

Right Answer is: C

SOLUTION

The statement "typedef salary amount" cannot run successfully because salary is not a fundamental or basic data type.


Q. 189789 The difference between const and macro is that


A. macro replaces a value in the code while const will declare a variable.

B. macro replaces after compilation while const is done during compilation.

C. macro substitution may affect size of the EXE file but, not the stack.

D. cost substitution may affect size of the EXE file but, not the stack.

Right Answer is: C

SOLUTION

Macros always replace the value of a variable before compilation while const acts like a simple constant during the compilation.


Q. 189790 A self-referential structure is


A. a structure inside a structure.

B. a structure that calls itself.

C. a pointer referencing to itself.

D. a pointer inside a structure.

Right Answer is: C

SOLUTION

A self-referential structure has an element that refers to the structure itself. This is actually a pointer that points to a structure of the same type.


Q. 189791 While declaring a structure, the keyword struct is followed by a


A. tag.

B. variable.

C. member name.

D. ;

Right Answer is: A

SOLUTION

Tag is the name of the structure, which is being declared.


Q. 189792 In C++, a structure can contain


A. functions only.

B. data and functions.

C. data and functions prototype.

D. data only.

Right Answer is: D

SOLUTION

In C++, a structure can contain only data. Here, we cannot declare functions inside a structure.


Q. 189793 A structure is a


A. homogeneous data structure.

B. heterogeneous data structure.

C. homogeneous data type.

D. heterogeneous data type.

Right Answer is: B

SOLUTION

A structure is a heterogeneous data structure since, it stores different types of data.


Q. 189794 A structure is declared with the keyword


A. structure.

B. struct.

C. define.

D. tag.

Right Answer is: B

SOLUTION

The format for a structure declaration is: struct tag { structure members; } variable names; where tag is a user selected name, structure members are data members accessed by variables declared as this structure type and variable names are the names of the variable declared as this type of structure.


Q. 189795 Define a structure to hold time using the 24 hour clock.
A. structure.
B. struct.
C. define.
D. tag.

Right Answer is:

SOLUTION

struct time{ int hour;
                        int min;

                        int sec;

               } ;                         


Q. 189796 What do you understand by call-by-reference?
A. structure.
B. struct.
C. define.
D. tag.

Right Answer is:

SOLUTION

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. 189797 Look at the code given below –
struct date{ int day;            int mon;            int year;          };                 -------------------                             cout<< D.year << D.mon;               cout<< DT-> day;             Declare the structure variables that is being used to access the structure members.
Right Answer is:

SOLUTION

date D, *DT;           


Q. 189798 Write a structure definition statement to hold employee related information like id, name, desg, salary. The definition should also declare two variables senior_employee and assistant_employee of the same type. Make suitable assumptions wherever required.
A. structure.
B. struct.
C. define.
D. tag.

Right Answer is:

SOLUTION

struct emp
{
  int id;
  char name;

  char desg;
  float salary;
} senior_employee, assistant_employee;



Q. 189799 Identify errors in the following structure definition-
struct A{ int x;
}; struct B { int x; }; A s1; B s2; s2=s1;
A. structure.
B. struct.
C. define.
D. tag.

Right Answer is:

SOLUTION

The above code fragment will produce an error because s1 and s2, though have similar elements but are of different types A and B respectively and hence they cannot be assigned to one another.


Q. 189800 Identify errors in the following structure definition-
                struct size{ int length;                                    int breadth;                                     int height;                                 }
A. structure.
B. struct.
C. define.
D. tag.

Right Answer is:

SOLUTION

The structure definition is not terminated properly as the semicolon ';' is missing after the closing brace.           


PreviousNext