Top 20 MCQ Questions On Inheritance In C++

Here are the collections of top 20 multiple choice questions on inheritance in C++ includes MCQ questions about inheritance and their types, single inheritance, multiple inheritance, multilevel inheritance, hierarchical inheritance along with base and derived classes. It also includes about constructors in derived classes and virtual base classes.

1. The ................ inherits some or all of the properties of the ........... class.
A) base, derived
B) derived, base
C) derived, initial
D) base, final

2. A derived class with only one base class is called ............... inheritance.
A) single
B) multiple
C) multilevel
D) hierarchical

3. A class can inherit properties from more than one class which is known as ..........inheritance.
A) single
B) multiple
C) multilevel
D) hierarchical

4. A class can be derived from another derived class which is known as .......... inheritance.
A) single
B) multiple
C) multilevel
D) hierarchical

5. When the properties of one class are inherited by more than one class, which is called ......... inheritance.
A) single
B) multiple
C) multilevel
D) hierarchical

6. When a base class is privately inherited by a derived class public members of the base class become .......... of the derived class.
A) private members
B) protected members
C) Public members
D) Not inherited

7. When a base class is privately inherited by a derived class public members of the base class can only be accessed by the ......... of the derived class.
A)
B)
C) member functions
D)

8. When a protected member is inherited in public mode, it becomes ........... in the derived class too and therefore is accessible by member functions of the derived class.
A) protected
B) private
C) public
D) friend

9. State whether the following statements about inheritance are True or False.
i) A public member of a class can be accessed by its own objects using the dot operator.
ii) While inheriting, the private members of the base class will never become the members of its derived class.
A) True, False
B) False, True
C) True, True
D) False, False

10. A member declared as .............. is accessible by the member functions within its class and any class immediately derived from it.
A) protected
B) private
C) public
D) friend

Read More »

Multiple Choice Questions On C++ Operator Overloading

Here are the collections of multiple choice questions on C++ operator overloading, which includes MCQ questions on C++ operators that can overload with providing special meaning to an operator along with the operators that can not be overloaded. It also includes about different steps involved in the process of overloading, overloading unary and binary operators, the different rules for overloading operators along with different methods of type conversions in C++.

1) We can overload which of the following C++ operators.
A) Arithmetic operator (+, -, *, /)
B) Class Member Access Operators (., .*)
C) Size operator(sizeof)
D) Conditional operator(?:)

2) .................. must be either non-static member function or friend functions.
A) member functions
B) Operator functions
C) non-static functions
D) friend functions

3) Operator overloading is also called ................. polymorphism.
A) run time
B) initial time
C) compile time
D) completion time

4) We can overload almost all the C++ operators except the following.
i) Class member operator (.,.*)   ii) Assignment operator (=)
iii) Scope resolution operator (::) iv) Conditional operator (?:)
A) i, ii and iii only
B) ii, iii and iv only
C) i, iii and iv only
D) All i, ii, iii and iv

5) Which of the following is the correct order involves in the process of operator overloading.
i) Define the operator function to implement the required operations.
ii) Create a class that defines the data type that is to be used in the overloading operation.
iii) Declare the operator function op() in the public part of the class.
A) 1-i, 2-ii, 3-iii
B) 1-ii, 2-iii, 3-i
C) 1-ii, 2-i, 2-iii
D) 1-iii, 2-ii, 3-i

6) State whether the following statements are True or False for overloading operators.
i) Only existing operators can be overloaded.
ii) We can change the basic meaning of an operator
A) True, True
B) True, False
C) False, True
D) False, False

7) We cannot use friend functions to overload which of the following operators.
i) membership operator(.)    ii) Assignment operator(=)
iii) class member access operator(_>)  iv) conditional operator(?:)
A) i and ii only
B) ii and iii only
C) iii and iv only
D) i and iv only

8) ............... overloaded by means of a member function, take no explicit arguments and return no explicit values.
A) Unary operators
B) Binary operators
C) Arithmetic operators
D) Function operator

9) ................ overloaded through a member function take one explicit argument and those which are overloaded through a friend function take two explicit arguments.
A) Unary operators
B) Binary operators
C) Arithmetic operators
D) Function operator
Read More »

Solved MCQ Questions On Computer Networking Set-1

This set of multiple choice objective question in computer networking includes solved MCQ questions on the definitions of computer network, different services of computer networks and their types. It includes about FDDI, FTP, network topology types, different network layers and their types. It also includes about different network layers; physical layer, transport layer, data link and presentation layer. 

1. The computer network is
A) Network computer with cable
B) Network computer without cable
C) Both of the above
D) None of the above

2. FDDI used which type of physical topology?
A) Bus
B) Ring
C) Star

3. FTP stands for
A) File transfer protocol
B) File transmission protocol
C) Form transfer protocol
D) Form transmission protocol

4. Ethernet system uses which of the following technology.
A) Bus
B) Ring
C) Star
D) Tree

5. Which of the following are the network services?
A) File service
B) Print service
C) Database service
D) All of the above

6. If all devices are connected to a central hub, then topology is called
A) Bus Topology
B) Ring Topology
C) Star Topology
D) Tree Topology

7. FDDI stands for
A) Fiber Distributed Data Interface
B) Fiber Data Distributed Interface
C) Fiber Dual Distributed Interface
D) Fiber Distributed Data Interface

8. Which of the following is an application layer service?
A) Network virtual terminal
B) File transfer, access and management
C) Mail service
D) All of the above

9. Which is the main function of transport layer?
A) Node to node delivery
B) End to end delivery
C) Synchronization
D) Updating and maintaining routing tables

10. The ............ layer change bits onto electromagnetic signals.
A) Physical
B) Transport
C) Data Link
D) Presentation

Read More »

Top 20 MCQ On Constructors And Destructors In C++

This set of multiple choice questions on C++ constructors and destructors includes collection of top 20 MCQ questions about special characteristics of constructor, about different types of constructors; parameterized constructors, default constructor, copy constructor, implicit constructor and default argument constructor. It also includes about dynamic initialization of objects, dynamic constructors and destructors. 
 
1. C++ provides a special ..................... called the constructor, which enables an object to initialize itself when it is created.
A) friend function
B) member function
C) public function
D) private function

2.  A constructor has the same ................. as that of class.
A) variable
B) object
C) function
D) name

3. Constructors are normally used to ................. and to allocate memory.
A) define variables
B) allocate variables
C) initialize variables
D) initialize object

4. A constructor  that accepts no parameters is called the ................
A) default constructor
B) parameterized constructor
C) implicit constructor
D) null constructor

5. Constructors cannot be inherited, through a derived class can call the ................... constructor.
A) base class
B) derived class
C) void class
D) default class

6. State whether the following statements about  the constructor are True or False.
i) constructors should be declared in the private section.
ii) constructors are invoked automatically when the objects are created.
A) True, True
B) True, False
C) False, True
D) False, False

7. The constructors that can take arguments are called ............... constructors.
A) default constructor
B) parameterized constructor
C) implicit constructor
D) argument constructor

8. When an object is created and initialized at the same time, a ................... gets called.
A) default constructor
B) parameterized constructor
C) implicit constructor
D) copy constructor

9. In C++, ......................... creates objects, even through it was not defined in the class.
A) default constructor
B) parameterized constructor
C) implicit constructor
D) copy constructor

10. ................. constructor will not do anything and defined just to satisfy the compiler
A) default
B) parameterized
C) implicit
D) copy

Read More »

Top 20 MCQ Questions On C++ Classes And Objects

This set of multiple choice questions on C++ classes and objects includes MCQ questions about different ways of specifying a class and creating objects, defining and nesting of member function, private, static and constant member function. It also includes about static data members and methods of using objects as function arguments.

1. In C++, the declaration of functions and variables are collectively called .......
A) class members
B) function members
C) object members
D) member variables

2. The keywords private and public used in C++ are known as .............
A) keyword labels
B) visibility labels
C) declaration labels
D) display labels

3. The variables declared inside the class are known as data members and functions are known as .............
A) data functions
B) inline functions
C) member functions
D) member variables

4. Only the ...................... can have access to the private members and private functions.
A) data functions
B) inline functions
C) member functions
D) member variables

5. The binding of data and functions together into a single class-type variable is referred to as ..............
A) encapsulation
B)
C)
D)                   

6. Which of the following statements about member functions are True or False.
i) A member function can call another member function directly with using the dot operator.
ii) Member function can access  the private data of the class.
A) i-True, ii-True
B) i-False, ii-True
C) i-True, ii-False
D) i-True, ii-True

7. When the function is defined inside a class, it is treated as ......................
A) data function
B) inline function
C) member function
D) member variable

8. A member  function can be called by using its name inside another function of the same class, which is known as ............ of member function.
A) sub function
B) sub member
C) nesting
D) sibling

9. A ................... member function can only be called by another function that is member of it's class.
A) friend
B) static
C) public
D) private

10. .................... member variable is initialized to zero when the first object of its class is created where no other initialization is permitted.
A) friend
B) static
C) public
D) private

Read More »

MCQ On C++ Tokens Expressions And Control Sturcture Part-2

Here are the collections of top 20 multiple choice questions on C++ tokens, expressions and control structure includes MCQ on different types of operators, scope resolution operator, member dereferencing operators and memory management operators along with C++ manipulators and type cast operators. It also includes about type cast operator and their types and control structures.

1. In C++, we can give several meanings to an operator, depending upon the types of arguments used, which was known as ..............
A) Operator variable
B) Operator overloading
C) Operator loading
D) Operator manipulation

2. Which of the following is/are the pointer-to-member operator used in C++.
i) : :          ii) : : *        iii) _>*            iv) . *
A) i and ii only
B) ii and iiii only
C) i and iv only
D) iii and iv only

3. Which of the following is the scope resolution operator in C++.
A) : :
B) : : *
C) _>*
D) . *

4. ................. operator can be used to uncover a hidden variable.
A) pointer-to-member
B) memory release
C) scope resolution
D) line feed

5. A major application of the ..................... operator is in the classes to identify the class to which a member function belongs.
A) pointer-to-member
B) memory release
C) scope resolution
D) line feed

6. .................... operator is used to access a member using a pointer to the object and a pointer to that member.
A) : :
B) : : *
C) _>*
D) . *

7. ................... operator is used to declare a pointer to a member of a class.
A) : :
B) : : *
C) _>*
D) . *

8. The ................... operator allocates sufficient memory to hold a data object type data type and returns the address of the object.
A) malloc()
B) calloc()
C) new
D) free()

9. The expression ................. will delete the entire array pointed to by p.
A) delete all p;
B) delete array p;
C) delete * p;
D) delete[ ] p;

10. The .................. operator automatically returns the correct pointer type, so that there is no need to use a type cast.
A) new
B) delete
C) malloc()
D) setw

Read More »

MCQ On C++ Tokens Expressions And Control Sturcture Part-1

This set of multiple choice questions on C++ tokens, expressions and control structure includes collections of top 20 MCQ questions on different data types user defined, built-in and derived type. User defined data type includes structure, union, class and enumeration, built-in-type includes integer type, void type and floating type.  It also includes about derived data types; array, function, pointer and reference. 
   
1. C++ provides various types of ........................ tokens that includes keywords, identifiers, constants, strings and operators.
A) tokens
B) expressions
C) structures
D) none

2. ...................... refer to the names of variables, functions, arrays, classes etc. created by programmer.
A) Keywords
B) Identifiers
C) Constants
D) Strings

3. ....................... are explicitly reserved identifiers and cannot be used as names for the program variables or other user defined program elements.
A) Keywords
B) Identifiers
C) Constants
D) Strings

4. State whether the following statements are True or False for C++ identifiers.
i) Only alphabetic characters, digits and underscores are permitted.
ii) The name can start with a digit.
iii) Uppercase and lowercase letters are distinct.
A) i-True, ii-True, iii-False
B) i-True, ii-False, iii-True
C) i-True, ii-False, iii-False
D) i-True, ii-True, iii-True

5. In C++, ....................... refer to fixed values that do not change during the execution of a program.
A) Identifiers
B) Constants
C) Strings
D) Operators

6. C++ provides an additional use of .........................., for declaration of generic pointers.
A) int
B) float
C) void
D) double

7. The ......................... data type was used to specify the return type of a function when it is not returning any value.
A) int
B) float
C) void
D) double

8. A ....................... can be assigned a pointer value of any basic data type, but it may not de-referenced.
A) int pointer
B) void pointer
C) generic pointer
D) non-void pointer

9. Which of the following is NOT the user defined data type in C++.
A) Structure
B) Pointer
C) Union
D) Class

10. Which of the following is/are the derived data types in C++.
i) array    ii) function    iii) pointer    iv) class
A) i, ii and iii only
B) ii, iii and iv only
C) i, iii and iv only
D) All i, ii, iii and iv
Read More »

Solved MCQ on Searching and Sorting Algorithms in Data Structure set-2

In this set of Solved MCQ on Searching and Sorting Algorithms in Data Structure, you can find mcqs of binary search algorithm, linear search algorithm, sorting algorithm, Complexity of linear search, merge sort and bubble sort and partition and exchange sort.

1) The worst case occur in linear search algorithm when .......
A. Item is somewhere in the middle of the array
B. Item is not in the array at all
C. Item is the last element in the array
D. Item is the last element in the array or item is not there at all

2) If the number of records to be sorted is small, then ...... sorting can be efficient.
A. Merge
B. Heap
C. Selection
D. Bubble

3) The complexity of sorting algorithm measures the ...... as a function of the number n of items to be sorter.
A. average time
B. running time
C. average-case complexity
D. case-complexity

4) Which of the following is not a limitation of binary search algorithm?
A. must use a sorted array
B. requirement of sorted array is expensive when a lot of insertion and deletions are needed
C. there must be a mechanism to access middle element directly
D. binary search algorithm is not efficient when the data elements more than 1500.

5) The Average case occurs in linear search algorithm ..........
A. when item is somewhere in the middle of the array
B. when item is not the array at all
C. when item is the last element in the array
D. Item is the last element in the array or item is not there at all

6) Binary search algorithm cannot be applied to ...
A. sorted linked list
B. sorted binary trees
C. sorted linear array
D. pointer array

7) Complexity of linear search algorithm is .........
A. O(n)
B. O(logn)
C. O(n2)
D. O(n logn)

8) Sorting algorithm can be characterized as ......
A. Simple algorithm which require the order of n2 comparisons to sort n items.
B. Sophisticated algorithms that require the O(nlog2n) comparisons to sort items.
C. Both of the above
D. None of the above

9) The complexity of bubble sort algorithm is .....
A. O(n)
B. O(logn)
C. O(n2)
D. O(n logn)

10) State True or False for internal sorting algorithms.
i) Internal sorting are applied when the entire collection if data to be sorted is small enough that the sorting can take place within main memory.
ii) The time required to read or write is considered to be significant in evaluating the performance of internal sorting.
A. i-True, ii-True
B. i-True, ii-False
C. i-False, ii-True
D. i-False, ii-False

Read More »

MCQ on Searching, Merging and Sorting Methods in Data Structure set-1

In this set of Multiple Choice Questions on Searching, Merging and Sorting Methods in Data Structure includes mcqs of Insertion sort, Quick sort, partition and exchange sort, selection sort, tree sort, k way merging and bubble sort. 

1) Finding the location of a given item in a collection of items is called ......
A. Discovering
B. Finding
C. Searching
D. Mining

2) Which of the following is an external sorting?
A. Insertion Sort
B. Bubble Sort
C. Merge Sort
D. Tree Sort

3) Very slow way of sorting is ..........
A. Insertion sort
B. Heap sort
C. Bubble sort
D. Quick sort

4) Which of the following is an internal sorting?
A. Tape Sort
B. 2-way Merge Sort
C. Merge Sort
D. Tree Sort

5) Sorting a file F usually refers to sorting F with respect to a particular key called .....
A. Basic key
B. Primary key
C. Starting key
D. Index key

6) The time complexity of quick sort is ........
A. O(n)
B. O(logn)
C. O(n2)
D. O(n logn)

7) Selection sort first finds the .......... element in the list and put it in the first position.
A. Middle element
B. Largest element
C. Last element
D. Smallest element

8) Quick sort is also known as ........
A. merge sort
B. tree sort
C. shell sort
D. partition and exchange sort

9) The operation that combines the element is of A and B in a single sorted list C with n=r+s element is called ....
A. Inserting
B. Mixing
C. Merging
D. Sharing

10) A tree sort is also known as ......... sort.
A. quick
B. shell
C. heap
D. selection
Read More »

Objective Questions on Routing Protocol In Computer Networks Set-3

This set of Objective Questions on Routing protocol in computer networks includes mcqs of distance vector routing protocols, routing tables, static routing methods, Static and dynamic routing protocols, Interior Gateway Protocol(IGP) and Exterior Gateway Protocol(EGP).

1) The principle of ...........states that the routing table is stored from the longest mask to the shortest mask.
A. first mask matching
B. shortest mask matching
C. longest mask matching
D. very shortest mask matching

2) ............ are two popular examples of distance vector routing protocols.
A. OSPF and RIP
B. RIP and BGP
C. BGP and OSPF
D. BGP and SPF

3) ...... deals with the issues of creating and maintaining routing tables.
A. Forwarding
B. Routing
C. Directing
D. None directing

4) During an adverse condition, the length of time for every device in the network to produce an accurate routing table is called the ..........
A. accurate time
B. integrated time
C. convergence time
D. average time

5) A ......... routing table contains information entered manually.
A. static
B. dynamic
C. hierarchical
D. non static

6) Which of the following is/are the uses of static routing methods.
A. To manually define a default route.
B. To provide more secure network environment.
C. To provide more efficient resource utilization.
D. All of the above

7) A .......... routing table is updated periodically using one of the dynamic routing protocols.
A. static
B. dynamic
C. hierarchical
D. non static

8) Which of the following is not the category of dynamic routing algorithm.
A. Distance vector protocols
B. Link state protocols
C. Hybrid protocols
D. Automatic state protocols

9) In ......... forwarding, the full IP address of a destination is given in the routing table.
A. next-hop
B. network-specific
C. host-specific
D. default

10) To build the routing table, ........... algorithms allow routers to automatically discover and maintain awareness or the paths through the network.
A. Static routing
B. Dynamic routing
C. Hybrid routing
D. Automatic routing

Read More »