OOPS
Question 1 |
Which of the following operator(s) cannot be overloaded?
. (Member Access or Dot operator) | |
?: (Ternary or Conditional Operator ) | |
:: (Scope Resolution Operator) | |
All of the above |
Question 1 Explanation:
. (Member Access or Dot operator), ?: (Ternary or Conditional Operator ) and :: (Scope Resolution Operator) are ternary operators. It can’t be overloaded.
Question 2 |
Which of the following is associated with objects?
State | |
Behaviour | |
Identity | |
All of the above |
Question 2 Explanation:
→ An object can be a variable, a data structure, a function, or a method, and as such, is a value in memory referenced by an identifier.
→ In the class based object-oriented programming paradigm, object refers to a particular instance of a class, where the object can be a combination of variables, functions, and data structures.
→ An object has state, exhibits some well defined behavior, and has a unique identity.
→ In the class based object-oriented programming paradigm, object refers to a particular instance of a class, where the object can be a combination of variables, functions, and data structures.
→ An object has state, exhibits some well defined behavior, and has a unique identity.
Question 3 |
Which of these is a super class of all errors and exceptions in the Java language?
Runtime Exceptions | |
Throwable | |
Catchable | |
None of the above |
Question 3 Explanation:
The Throwable class is the superclass of all errors and exceptions in the Java language.
Question 4 |
If a class C is derived from class B, which is derived from class A, all through public inheritance, then a class C member function can access
only protected and public data of C and B | |
Only protected and public data of C | |
all data of C and private data of A and B | |
public and protected data of A and B and all data of C |
Question 4 Explanation:
→ It is nothing but multilevel inheritance.
→ If a class C is derived from class B, which is derived from class A, all through public inheritance, then a class C member function can access public and protected data of A and B and all data of C
→ If a class C is derived from class B, which is derived from class A, all through public inheritance, then a class C member function can access public and protected data of A and B and all data of C
Question 5 |
Consider the following Java code fragment:
1 public class While
2 {
3 public void loop()
4 {
5 int x = 0;
6 while(1)
7 {
8 System.out.println("x plus one is" +(x+1));
9 }
10 }
11 }
1 public class While
2 {
3 public void loop()
4 {
5 int x = 0;
6 while(1)
7 {
8 System.out.println("x plus one is" +(x+1));
9 }
10 }
11 }
There is syntax error in line no. 1 | |
There is syntax errors in line nos. 1 & 6 | |
There is syntax error in line no. 8 | |
There is syntax error in line no. 6 |
Question 5 Explanation:
Java does not - unlike C - interpret 0 as false and 1 as true.
So we cannot use integers in the while() statement.
So line number 6 will give syntax error.
So we cannot use integers in the while() statement.
So line number 6 will give syntax error.
Question 6 |
If only one memory location is to be reserved for a class variable, no matter how many objects are instantiated, then the variable should be declared as
extern | |
static | |
volatile | |
const |
Question 6 Explanation:
→ The static storage class instructs the compiler to keep a local variable in existence during the life-time of the program instead of creating and destroying it each time it comes into and goes out of scope. Therefore, making local variables static allows them to maintain their values between function calls.
→ The static modifier may also be applied to global variables. When this is done, it causes that variable's scope to be restricted to the file in which it is declared.
→ In C programming, when static is used on a global variable, it causes only one copy of that member to be shared by all the objects of its class.
→ The static modifier may also be applied to global variables. When this is done, it causes that variable's scope to be restricted to the file in which it is declared.
→ In C programming, when static is used on a global variable, it causes only one copy of that member to be shared by all the objects of its class.
Question 7 |
What is the output of the following JAVA program ?
class simple { public static void main(String[] args) { simple obj = new simple(); obj.start(); } void start() { long [] P = {3, 4, 5}; long [] Q = method (P); System.out.print (P[0] + P[1] + P[2]+”:”); System.out.print (Q[0] + Q[1] + Q[2]); } long [] method (long [] R) { R [1] = 7; return R; } } //end of class
12 : 15 | |
15 : 12 | |
12 : 12 | |
15 : 15 |
Question 7 Explanation:
• First we will create the object of simple class.
• By using object , we call the function start( ).
• In the start() function definition, first statement is integer array with three elements.
• long [ ] Q= method (P); Again function method(p) will be called.
• In the definition of method function, we are changing the second element of array to value 7 and returning updated array to array Q.
• We are passing address of P as argument to method so Modifications happened in the method automatically reflects to array P.
• Both array P and Q consists of values {3,7,5}.
• The sum of the three values are 15.
• By using object , we call the function start( ).
• In the start() function definition, first statement is integer array with three elements.
• long [ ] Q= method (P); Again function method(p) will be called.
• In the definition of method function, we are changing the second element of array to value 7 and returning updated array to array Q.
• We are passing address of P as argument to method so Modifications happened in the method automatically reflects to array P.
• Both array P and Q consists of values {3,7,5}.
• The sum of the three values are 15.
Question 8 |
In Java, which of the following statements is/are True ?
-
S1 : The ‘final’ keyword applied to a class definition prevents the class from being extended through derivation.
S2 : A class can only inherit one class but can implement multiple interfaces.
S3 : Java permits a class to replace the implementation of a method that it has inherited. It is called method overloading.
S1 and S2 only | |
S1 and S3 only | |
S2 and S3 only | |
All of S1, S2 and S3
|
Question 8 Explanation:
• If a class has multiple methods having same name but different in parameters, it is known as Method Overloading.Method Overloading is a feature that allows a class to have more than one method having the same name, if their argument lists are different. So the option-3 is False.
• The final keyword in java is used to restrict the user. The java final keyword can be used in many context. Final can be: variable, method and class.
• A Java class can only extend one parent class. Multiple inheritance (extends) is not allowed. Interfaces are not classes. However, and a class can implement more than one interface.
• The final keyword in java is used to restrict the user. The java final keyword can be used in many context. Final can be: variable, method and class.
• A Java class can only extend one parent class. Multiple inheritance (extends) is not allowed. Interfaces are not classes. However, and a class can implement more than one interface.
Question 9 |
Which of the following statements is/are True ?
P : C programming language has a weak type system with static types. Q : Java programming language has a strong type system with static types. Code :P only | |
Q only | |
Both P and Q | |
Neither P nor Q
|
Question 9 Explanation:
→ A strongly typed language has stricter typing rules at compile time, which implies that errors and exceptions are more likely to happen during compilation. Most of these rules affect variable assignment, return values and function calling.
→ A weakly typed language has looser typing rules and may produce unpredictable results or may perform implicit type conversion at runtime.
→ Java, C#, Ada and Pascal are sometimes said to be more strongly typed than C, a claim that is probably based on the fact that C supports more kinds of implicit conversions, and C also allows pointer values to be explicitly cast while Java and Pascal do not.
→ Java itself may be considered more strongly typed than Pascal as manners of evading the static type system in Java are controlled by the Java virtual machine's type system.
→ C# and VB.NET are similar to Java in that respect, though they allow disabling of dynamic type checking by explicitly putting code segments in an "unsafe context".
→ Pascal's type system has been described as "too strong", because the size of an array or string is part of its type, making some programming tasks very difficult.
→ A weakly typed language has looser typing rules and may produce unpredictable results or may perform implicit type conversion at runtime.
→ Java, C#, Ada and Pascal are sometimes said to be more strongly typed than C, a claim that is probably based on the fact that C supports more kinds of implicit conversions, and C also allows pointer values to be explicitly cast while Java and Pascal do not.
→ Java itself may be considered more strongly typed than Pascal as manners of evading the static type system in Java are controlled by the Java virtual machine's type system.
→ C# and VB.NET are similar to Java in that respect, though they allow disabling of dynamic type checking by explicitly putting code segments in an "unsafe context".
→ Pascal's type system has been described as "too strong", because the size of an array or string is part of its type, making some programming tasks very difficult.
Question 10 |
Given a class named student, which of the following is a valid constructor declaration for the class?
Student student(){} | |
Private final student(){} | |
Student(student s){} | |
Void student(){} |
Question 10 Explanation:
A constructor cannot specify any return type, not even void. A constructor cannot be final, static or abstract.
Question 11 |
Object oriented inheritance models:
"is a kind of" relationship | |
"has a" relationship | |
"want to be" relationship | |
"contains" of relationship |
Question 11 Explanation:
Generalization--> "is a kind of" relationship. It is used for object oriented inheritance models.
Aggregation-->"Has a" relationship
Aggregation-->"Has a" relationship
Question 12 |
Control Structures include
iteration | |
rendezvous statements | |
exception statements | |
all of these |
Question 12 Explanation:
● A control structure is a block of programming that analyzes variables and chooses a direction in which to go based on given parameters.
● The term flow control details the direction the program takes (which way program control "flows").
● Hence it is the basic decision-making process in computing; flow control determines how a computer will respond when given certain conditions and parameters.
● The term flow control details the direction the program takes (which way program control "flows").
● Hence it is the basic decision-making process in computing; flow control determines how a computer will respond when given certain conditions and parameters.
Question 13 |
In object oriented design of software, objects have
attributes and name only | |
operations and name only | |
attributes name and operations | |
mutation and permutation property |
Question 13 Explanation:
● Object-oriented design is the process of planning a system of interacting objects for the purpose of solving a software problem.
● An object contains encapsulated data and procedures (operations) grouped together to represent an entity. The 'object interface' defines how the object can be interacted with.
● An object contains encapsulated data and procedures (operations) grouped together to represent an entity. The 'object interface' defines how the object can be interacted with.
Question 14 |
Give the output
#include
using namespace std;
class Base
{
Public:
int x,y;
Public:
Base(int i, int j)
{
x=i;y=j;
}
};
class Derived:public Base
{
public:
Derived(int i,int j):x(i),y(j){}
void print()
{
cout<
};
int main(void)
{
Derived q(10,10);
q.print();
return 0;
}
#include
using namespace std;
class Base
{
Public:
int x,y;
Public:
Base(int i, int j)
{
x=i;y=j;
}
};
class Derived:public Base
{
public:
Derived(int i,int j):x(i),y(j){}
void print()
{
cout<
int main(void)
{
Derived q(10,10);
q.print();
return 0;
}
1010 | |
compile error | |
00 | |
None of the option |
Question 14 Explanation:
We can’t directly assign the base class members by using initializer list in the derived class
We should call the base class constructor in order to initialize base class members.
We should call the base class constructor in order to initialize base class members.
Question 15 |
Give the output
#include
using namespace
class Base1
{
public:
~Base1()
{
cout<<"Base1's destructor"<
};
class Base2
{
public:
~Base1()
{
cout<<"Base2's destructor"<
};
class Derived : public Base1,public Base2
{
public:
~Derived()
{
cout<<"Derived's destructor"<
}
int main()
{
Derived d;
return 0;
}
#include
using namespace
class Base1
{
public:
~Base1()
{
cout<<"Base1's destructor"<
class Base2
{
public:
~Base1()
{
cout<<"Base2's destructor"<
class Derived : public Base1,public Base2
{
public:
~Derived()
{
cout<<"Derived's destructor"<
int main()
{
Derived d;
return 0;
}
Base1'1 destructor Base2'2 destructor Derived Destructor | |
Derived Destructor Base2'2 destructor Base1'1 destructor | |
Derived Destructor | |
Compiler Dependent |
Question 15 Explanation:
● C++ constructor call order will be from top to down that is from base class to derived class and c++ destructor call order will be in reverse order.
● First child class and later parent class.
● First child class and later parent class.
Question 16 |
Which of the following is/are true about packages in Java?
1) Every class is part of some package
2) All classes in a file are part of the same package
3)If no package is specified, the classes in the file go into a special unnamed package.
4) If no package is specified, a new package is created with folder name of class and the class is put in this package
1) Every class is part of some package
2) All classes in a file are part of the same package
3)If no package is specified, the classes in the file go into a special unnamed package.
4) If no package is specified, a new package is created with folder name of class and the class is put in this package
Only 1,2 and 3 | |
Only 1,2 and 4 | |
Only 4 | |
Only 1 and 3 |
Question 16 Explanation:
Option -4 false because new package is created by using syntax package package_name which is user defined .There is no relation with class name.
Question 17 |
Which of the following is false about abstract classes in java?
If we derive an abstract class and do not implement all the abstract methods, then the derived class should also be marked as abstract using 'abstract' keyword | |
Abstract classes can have constructors. | |
A class can be made abstract without any abstract method | |
A class can inherit from multiple abstract classes |
Question 17 Explanation:
● An abstract class can have an abstract method without body and it can have methods with implementation also.
● Multiple inheritance is not possible with abstract classes.
Question 18 |
Which of the following is true about interfaces in java?
1. An interface can contain following type of members.
...public,static,final fields(i.e., constants)
...default and static methods with bodies
2. An instance of interface can be created.
3. A class can implement multiple interfaces
4. many classes can implement the same interface
1. An interface can contain following type of members.
...public,static,final fields(i.e., constants)
...default and static methods with bodies
2. An instance of interface can be created.
3. A class can implement multiple interfaces
4. many classes can implement the same interface
1,3 and 4 | |
1,2 and 4 | |
2,3 and 4 | |
1,2,3 and 4 |
Question 18 Explanation:
● The interface in java is a blueprint of a class. It has static constants and abstract methods.
● There can be only abstract methods in the Java interface, not method body.
● It cannot be instantiated just like the abstract class because there is no method definition available with the interface.
● There can be only abstract methods in the Java interface, not method body.
● It cannot be instantiated just like the abstract class because there is no method definition available with the interface.
Question 19 |
If the objects focus on the problem domain, then we are concerned with
Object Oriented Analysis | |
Object Oriented Design | |
Object Oriented Analysis and design | |
None of the above |
Question 19 Explanation:
→ The purpose of any analysis activity in the software life cycle is to create a model of the system's functional requirements that is independent of implementation constraints.
→ The main difference between object-oriented analysis and other forms of analysis is that by the object-oriented approach we organize requirements around objects, which integrate both behaviors (processes) and states (data) modeled after real world objects that the system interacts with. In other or traditional analysis methodologies, the two aspects: processes and data are considered separately.
→ For example, data may be modeled by ER diagrams, and behaviors by flow charts or structure charts.
→ The main difference between object-oriented analysis and other forms of analysis is that by the object-oriented approach we organize requirements around objects, which integrate both behaviors (processes) and states (data) modeled after real world objects that the system interacts with. In other or traditional analysis methodologies, the two aspects: processes and data are considered separately.
→ For example, data may be modeled by ER diagrams, and behaviors by flow charts or structure charts.
Question 20 |
Is null an object?
yes | |
No | |
Sometimes yes | |
None of these |
Question 20 Explanation:
If null were an Object, it would support the methods of java.lang.Object such as equals().
However, this is not the case - any method invocation on a null results in a NullPointerException.
There is also a special null type, the type of the expression null, which has no name. Because the null type has no name, it is impossible to declare a variable of the null type or to cast to the null type. The null reference is the only possible value of an expression of null type. The null reference can always be cast to any reference type. In practice, the programmer can ignore the null type and just pretend that null is merely a special literal that can be of any reference type
However, this is not the case - any method invocation on a null results in a NullPointerException.
There is also a special null type, the type of the expression null, which has no name. Because the null type has no name, it is impossible to declare a variable of the null type or to cast to the null type. The null reference is the only possible value of an expression of null type. The null reference can always be cast to any reference type. In practice, the programmer can ignore the null type and just pretend that null is merely a special literal that can be of any reference type
Question 21 |
Which of these events will be generated if we close an applet's window?
ActionEvent | |
ComponentEvent | |
AdjustmentEvent | |
WindowEvent |
Question 21 Explanation:
A low level event that indicates that a window has changed its status. This low-level event is generated by a Window object when it is opened, closed, activated, deactivated, iconified, or deiconified, or when focus is transferred into or out of the Window.
Question 22 |
Which two are valid constructors for Thread?
1. Thread(Runnable r, String name)
2. Thread()
3. Thread(int priority)
4.Thread(Runnable r, ThreadGroup g)
5.Thread(Runnable r, int priority)
1. Thread(Runnable r, String name)
2. Thread()
3. Thread(int priority)
4.Thread(Runnable r, ThreadGroup g)
5.Thread(Runnable r, int priority)
1 and 3 | |
2 and 4 | |
1 and 2 | |
2 and 5 |
Question 22 Explanation:
(1) and (2) are both valid constructors for Thread.
(3), (4), and (5) are not legal Thread constructors
(3), (4), and (5) are not legal Thread constructors
Question 23 |
Which of the following object types are generally autonomous, meaning that they can exhibit some behavior without being operated upon by another object.
Passive | |
Active | |
Both A) and B) | |
None of the mentioned |
Question 23 Explanation:
● An active object is one that encompasses its own thread of control.
● Active objects are generally autonomous, meaning that they exhibit some behaviour without being operated upon by another object
● Passive objects can only undergo a state change when explicitly acted upon
● Active objects are generally autonomous, meaning that they exhibit some behaviour without being operated upon by another object
● Passive objects can only undergo a state change when explicitly acted upon
Question 24 |
What is 'basis of Encapsulation'?
Object | |
Class | |
Method | |
All of the above |
Question 24 Explanation:
Encapsulation is the mechanism that binds together code and data it manipulates, and keeps both safe from outside interface and misuse. Class, which contains data members and methods is used to implement Encapsulation.
Question 25 |
In which case it is mandatory to provide a destructor in a class?
Almost in every class | |
Class for which two or more than two objects will be created | |
Class for which copy constructor | |
Class whose objects will be created dynamically |
Question 25 Explanation:
→ Destructors are used to de-allocate the memory that has been allocated for the object by the constructor.
→ Unlike constructor a destructor neither takes any arguments nor does it returns value. And destructor can’t be overloaded.
→ Unlike constructor a destructor neither takes any arguments nor does it returns value. And destructor can’t be overloaded.
Question 26 |
Runtime polymorphism is achieved by _____
Friend function | |
Virtual function | |
Operator overloading | |
Function overloading |
Question 26 Explanation:
→ In Run time Polymorphism, call is not resolved by the compiler.
→ Run time Polymorphism is achieved by virtual functions and pointers.
→ Compile time Polymorphism achieved by function overloading and operator overloading.
→ Run time Polymorphism is achieved by virtual functions and pointers.
→ Compile time Polymorphism achieved by function overloading and operator overloading.
Question 27 |
Usually pure virtual function
Has complete function body | |
Will never be called | |
Will be called only to delete an object | |
Is defined only in derived class |
Question 27 Explanation:
→ A virtual function or virtual method is an inheritable and overridable function or method for which dynamic dispatch is facilitated.
→ A pure virtual function or pure virtual method is a virtual function that is required to be implemented by a derived class if the derived class is not abstract.
→ A pure virtual function or pure virtual method is a virtual function that is required to be implemented by a derived class if the derived class is not abstract.
Question 28 |
Use of virtual function implies____
Overloading | |
Overriding | |
Static binding | |
Dynamic binding |
Question 28 Explanation:
→ A virtual function or virtual method is an inheritable and overridable function or method for which dynamic dispatch is facilitated.
→ Dynamic binding occurs when a pointer or reference is associated with a member function based on the dynamic type of the object.
→ The member function that is dynamically bound must override a virtual function declared in a direct or indirect base class.
→ Dynamic binding occurs when a pointer or reference is associated with a member function based on the dynamic type of the object.
→ The member function that is dynamically bound must override a virtual function declared in a direct or indirect base class.
Question 29 |
Additional information sent when an exception is thrown may be placed in___
Additional information sent when an exception is thrown may be placed in___
| |
The function that caused the error | |
The catch block
| |
An object of the exception class
|
Question 29 Explanation:
→ A catch block is where you handle the exceptions, this block must follow the try block.
→ A single try block can have several catch blocks associated with it. You can catch different exceptions in different catch blocks.
→ When an exception occurs in try block, the corresponding catch block that handles that particular exception executes
→ A single try block can have several catch blocks associated with it. You can catch different exceptions in different catch blocks.
→ When an exception occurs in try block, the corresponding catch block that handles that particular exception executes
Question 30 |
Which of the following is not correct in C++?
x-=2; is the same as x=x-2; | |
x*=2; is the same as x=x*2; | |
x%=2; is the same as x=x/2; | |
x/=2; is the same as x=x/2; |
Question 30 Explanation:
→ x%=2; is not the same as x=x/2;
→ x%=2; is the same as x=x%2;
→ x%=2; is the same as x=x%2;
Question 31 |
Consider the following Java code segment:
Public class while /*line1*/
{
Public void loop()
{
int x=0;
while(1) /*line 6*/
{
system.out.println(“x plus one is”+(x+1));
}
}
}
Which of the following is true?
Public class while /*line1*/
{
Public void loop()
{
int x=0;
while(1) /*line 6*/
{
system.out.println(“x plus one is”+(x+1));
}
}
}
Which of the following is true?
There is a syntax error in line -1
| |
There are syntax errors in,line -1 and line -6 | |
There is a syntax error in line -6 | |
No syntax error |
Question 31 Explanation:
We can’t used the keyword “while” as class name.So it will give syntax error.
Question 32 |
Parent class of all java classes is____
Java.lang.system
| |
Java.lang.object | |
Java.lang.class | |
Java.lang,reflect.object |
Question 32 Explanation:
public class Object:
Class Object is the root of the class hierarchy. Every class has Object as a superclass. All objects, including arrays, implement the methods of this class.
Class Object is the root of the class hierarchy. Every class has Object as a superclass. All objects, including arrays, implement the methods of this class.
Question 33 |
Which of the following is not true in case of public inheritance in c++?
Each public member in the base class is public in the derived class
| |
Each protected member in the base class is protected in the derived class | |
Each private member in the base class remains private in the base class | |
Each private member in the base class remains private in the derived class |
Question 33 Explanation:
→ Public Inheritance − When deriving a class from a public base class, public members of the base class become public members of the derived class and protected members of the base class become protected members of the derived class.
→ A base class's private members are never accessible directly from a derived class, but can be accessed through calls to the public and protected members of the base class. We can summarize the different access types according to - who can access them in the following way −

→ A base class's private members are never accessible directly from a derived class, but can be accessed through calls to the public and protected members of the base class. We can summarize the different access types according to - who can access them in the following way −

Question 34 |
How many characters does an escape sequence (\On, \Hn,\n,\f) in C++ consume?
1 | |
3 | |
2 | |
None of these |
Question 34 Explanation:
→ An escape sequence is a sequence of characters that does not represent itself when used inside a character or string literal, but is translated into another character or a sequence of characters that may be difficult or impossible to represent directly.
→ All escape sequences consist of two or more characters, the first of which is the backslash, \ (called the "Escape character"); the remaining characters determine the interpretation of the escape sequence. For example, \n is an escape sequence that denotes a newline character.
→ If we treat it a character constant means one character
Note: An escape sequence is regarded as a single character and is therefore valid as a character constant.
→ All escape sequences consist of two or more characters, the first of which is the backslash, \ (called the "Escape character"); the remaining characters determine the interpretation of the escape sequence. For example, \n is an escape sequence that denotes a newline character.
→ If we treat it a character constant means one character
Note: An escape sequence is regarded as a single character and is therefore valid as a character constant.
Question 35 |
Which of the following is not true for overloaded function in C++?
Overloaded functions should have different arguments lists | |
Overloaded functions having the same argument lists should have a different return type. | |
Functions cannot be overloaded on the basis of one being static and the other non static | |
None of these |
Question 35 Explanation:
Two or more functions having same name but different argument(s) are known as overloaded functions. So option is not true.
Question 36 |
Which constructor will be called by the following lines of code?
(i) Student S1;
(ii) Student S2=S1;
(i) Student S1;
(ii) Student S2=S1;
First copy constructor, then default constructor | |
First default constructor, then copy constructor | |
Default constructor for both lines of code | |
Copy constructor for both lines of code |
Question 36 Explanation:
→ Student S1:----whenever we create object to the class , automatically default constructor will be called.
→ Student S2=S1:------The copy constructor is a constructor which creates an object by initializing it with an object of the same class, which has been created previously.
→ Student S2=S1:------The copy constructor is a constructor which creates an object by initializing it with an object of the same class, which has been created previously.
Question 37 |
Which of the following statements is true?
The JAVA compile produces a code for JVM, which is executed by a JAVA interpreter | |
The JAVA compile produces code directly for JAVA interpreter | |
The JAVA compiler directly executes codes in JVM | |
The JAVA compile helps in directly executing a code on different operating |
Question 37 Explanation:
● JVM is a engine that provides runtime environment to drive the Java Code or applications. It converts Java bytecode into machines language.
● First, Java code is compiled into bytecode. This bytecode gets interpreted on different machines
● First, Java code is compiled into bytecode. This bytecode gets interpreted on different machines
Question 38 |
From the following java determine the attributes of the class students:
Class student
{
String name;
Int marks;
};
Public static void main()
{
Student S1=new student();
Student S2=new student();
}
Class student
{
String name;
Int marks;
};
Public static void main()
{
Student S1=new student();
Student S2=new student();
}
Only name | |
Both name and marks | |
Only S1 | |
Both S1 and S2 |
Question 38 Explanation:
→ The attributes of student class are name and marks.
→ There are two objects created in the above program and both have same attributes.
→ There are two objects created in the above program and both have same attributes.
Question 39 |
The figure below depicts the hierarchy_____class


Heap | |
Wrapper | |
Inheritance | |
Abstract |
Question 39 Explanation:
All the wrapper classes (Integer, Long, Byte, Double, Float, Short) are subclasses of the abstract class Number.
Question 40 |
To override a method in java, we need to define a method in a subclass with the
Same name, same number of arguments having the same data types as a method in the superclass | |
Different name, same number of arguments having the same data types as a method in the superclass | |
Same name but different number of arguments as a method in the superclass | |
Same name, same number of arguments but different data types as a method in the superclass |
Question 40 Explanation:
●The argument list should be exactly the same as that of the overridden method.
● The return type should be the same or a subtype of the return type declared in the original overridden method in the superclass.
● The return type should be the same or a subtype of the return type declared in the original overridden method in the superclass.
Question 41 |
In object oriented programming, by wrapping up characteristics and behaviour into one unit, we achieve
Data Abstraction | |
Data Encapsulation | |
Data Hiding | |
All of these |
Question 41 Explanation:
●Data hiding is a software development technique specifically used in object-oriented programming (OOP) to hide internal object details (data members). Data hiding ensures exclusive data access to class members and protects object integrity by preventing unintended or intended changes.
● Data abstraction refers to providing only essential information to the outside world and hiding their background details, i.e., to represent the needed information in program without presenting the details.
● Encapsulation is a process of combining data members and functions in a single unit called class. This is to prevent the access to the data directly, the access to them is provided through the functions of the class.
● Data abstraction refers to providing only essential information to the outside world and hiding their background details, i.e., to represent the needed information in program without presenting the details.
● Encapsulation is a process of combining data members and functions in a single unit called class. This is to prevent the access to the data directly, the access to them is provided through the functions of the class.
Question 42 |
The major goal of object oriented programming is
top down program development | |
Speed | |
User interface | |
Reuse |
Question 42 Explanation:
Languages that support object oriented programming typically use inheritance for code reuse and extensibility in the form of either classes or prototypes. Those that use classes support two main concepts:
1. Classes – the definitions for the data format and available procedures for a given type or class of object; may also contain data and procedures (known as class methods) themselves, i.e. classes contain the data members and member functions
2. Objects – instances of classes
1. Classes – the definitions for the data format and available procedures for a given type or class of object; may also contain data and procedures (known as class methods) themselves, i.e. classes contain the data members and member functions
2. Objects – instances of classes
Question 43 |
Assume the C++ definitions: Class circle: public point which of the following is false?
'point' is the base class and 'circle' is the derived class | |
The colon(:) in the header of class definition indicates inheritance | |
The keyword 'public' indicates type of inheritance | |
All the public and protected members of class 'circle' are inherited as public and protected members respectively into class point. |
Question 43 Explanation:
True: point' is the base class and 'circle' is the derived class
True: The colon(:) in the header of class definition indicates inheritance
True: The keyword 'public' indicates type of inheritance
False: All the public and protected members of class 'circle' are inherited as public and protected members respectively into class point.
True: The colon(:) in the header of class definition indicates inheritance
True: The keyword 'public' indicates type of inheritance
False: All the public and protected members of class 'circle' are inherited as public and protected members respectively into class point.
Question 44 |
Which of the following java statement declare and allocate a 2-dimensional array integers with four rows and five columns?
int array[ ] [ ]=new int [5][4]; | |
int array [4][5]; | |
int array[5][4]; | |
int array[ ] [ ]=new int[4][5]; |
Question 44 Explanation:
→ In question they are clearly mentioned that 4 rows and 5 columns.
→ Syntax int array[ ] [ ]=new int[row size][column size];
(or)
int[ ] [ ] array=new int[row size][column size];
So, Option D is correct answer.
→ Syntax int array[ ] [ ]=new int[row size][column size];
(or)
int[ ] [ ] array=new int[row size][column size];
So, Option D is correct answer.
Question 45 |
What is garbage collection in the context of java?
The java virtual machine(JVM) checks the output of any java program and deletes anything that does not make sense at all | |
The operating system periodically deletes all of the java files available on the system | |
Any java packages imported in a program and not being used, is automatically deleted | |
When all references to an object are going, then the memory used by the object is automatically reclaimed |
Question 45 Explanation:
Garbage collection is happened when all references to an object are going, then the memory used by the object is automatically reclaimed
Question 46 |
What correction is required for following Java code snippet to compile?
int[]x=new int[10];
for(int P=0;P<=X.length();P++)
X[P]=5;
int[]x=new int[10];
for(int P=0;P<=X.length();P++)
X[P]=5;
X[P]=5 should be X(p)=5 | |
P<=X.length() should be P | |
X.length() should be X.length | |
P++ should be P+1 |
Question 46 Explanation:
Integer data type we are using X.length and character data type we are using function X.length().
→ array.length : length is a final variable applicable for arrays. With the help of length variable, we can obtain the size of the array.
→ string.length() : length() method is a final variable which is applicable for string objects. length() method returns the number of characters presents in the string.
→ array.length : length is a final variable applicable for arrays. With the help of length variable, we can obtain the size of the array.
→ string.length() : length() method is a final variable which is applicable for string objects. length() method returns the number of characters presents in the string.
Question 47 |
Which of the following most accurately describes "multiple inheritance"?
When a child class has both an "is a" and "has a" relationship with its parent class | |
When two classes inherit from each other | |
When a base class has two or more derived classes | |
When a child class has two or more parent class |
Question 47 Explanation:
→ Multiple inheritance is a feature of some object-oriented computer programming languages in which an object or class can inherit characteristics and features from more than one parent
object or parent class. It is distinct from single inheritance, where an object or class may only inherit from one particular object or class.


Question 48 |
java is a___language. This means that you must be explicit about what type of data you are working with
Weakly typed | |
strongly typed | |
Dynamically typed | |
Loosely typed |
Question 48 Explanation:
→ Java is a strongly typed programming language because every variable must be declared with a data type. A variable cannot start off life without knowing the range of values it can hold, and once it is declared, the data type of the variable cannot change.
Question 49 |
Consider the following code segment in JAVA
switch(x)
{
default;
system.out.println(“Hello”);
}
Which of the following data types are acceptable for x?
switch(x)
{
default;
system.out.println(“Hello”);
}
Which of the following data types are acceptable for x?
Byte and char | |
Long and char | |
Char and float | |
Byte and float |
Question 49 Explanation:
The possible values are either integer constant or character constant.No other data type values are allowed.
Question 50 |
Which of the following are valid calls to math.max in java?
- Math.max(1,4)
- Math.max(2.3,5)
- Math.max(1,3,5,7)
- Math.max(-1.5,-2.8f)
A,b and d | |
B,c and d | |
A,b and c | |
C and d |
Question 50 Explanation:
→The java.lang.Math.max(int a, int b) returns the greater of two int values.
→We can find the greater of any two data types variables.
→Option C consists of four variables , So it is invalid.
→We can find the greater of any two data types variables.
→Option C consists of four variables , So it is invalid.
Question 51 |
Which of the following is NOT true in C++?
Before a variable can be used, it must be declared | |
Variable are allocated values through the use of assignment statements | |
When a variable is declared, C++ allocates storage for the variable and puts an unknown value inside it. | |
We can use a variable even if it is not declared. |
Question 51 Explanation:
In the c++ (or) C programming language , in order to use the variables in the program we must declare the variables before using.
Question 52 |
Which of the following is NOT true in case of protected Inheritance in C++?
Each public member in the base class is protected in the derived class | |
Each protected member in the base class is protected in the derived class | |
Each private member in the base class is private in the derived class | |
Each private member in the base class is visible in the derived class |
Question 52 Explanation:
The following table shows the access to members permitted by each modifier.


Question 53 |
If a class C is derived from class B, which is derived from class A, all through public inheritance, then a class C member function can access
Protected and public data only in C and B | |
Protected and public data only in C | |
Private data in A and B | |
Protected data in A and B |
Question 53 Explanation:
The following table shows the access to members permitted by each modifier.


Question 54 |
Mechanism of deriving a class from another derived class is known as
Polymorphism | |
Single inheritance | |
Multilevel inheritance | |
Message passing |
Question 54 Explanation:
When a class is derived from a class which is also derived from another class, i.e. a class having more than one parent classes, such inheritance is called Multilevel Inheritance.
Question 55 |
Members of class by default are
Public | |
Private | |
Protected | |
Mandatory to specify |
Question 55 Explanation:
→A class in C++ is a user defined type or data structure declared with keyword class that has data and functions (also called methods) as its members whose access is governed by the three access specifiers private, protected or public (by default access to members of a class is private).
→The private members are not accessible outside the class; they can be accessed only through methods of the class. The public members form an interface to the class and are accessible outside the class.
→The private members are not accessible outside the class; they can be accessed only through methods of the class. The public members form an interface to the class and are accessible outside the class.
Question 56 |
The memory occupied by an object type of data in VB is
1 byte | |
2 byte | |
4 byte | |
8 byte |
Question 56 Explanation:

Question 57 |
If a function is friend of a class, which one of the following is wrong?
A function can only be declared a friend by a class itself. | |
Friend functions are not members of a class, they are associated with it. | |
Friend functions are members of a class. | |
It can have access to all members of the class, even private ones. |
Question 57 Explanation:
→ A friend function of a class is defined outside that class' scope but it has the right to access all private and protected members of the class. Even though the prototypes for friend functions
appear in the class definition, friends are not member functions.
TRUE: function can only be declared a friend by a class itself.
TRUE: Friend functions are not members of a class, they are associated with it.
FALSE:Friend functions are members of a class.
TRUE: It can have access to all members of the class, even private ones.
TRUE: function can only be declared a friend by a class itself.
TRUE: Friend functions are not members of a class, they are associated with it.
FALSE:Friend functions are members of a class.
TRUE: It can have access to all members of the class, even private ones.
Question 58 |
Which one of the following is correct, when a class grants friend status to another class?
The member functions of the class generating friendship can access the members of the friend class. | |
All member functions of the class granted friendship have unrestricted access to the members of the class granting the friendship. | |
Class friendship is reciprocal to each other. | |
There is no such concept. |
Question 58 Explanation:
→ When a class grants friend status to another class all member functions of the class granted friendship have unrestricted access to the members of the class granting the friendship.
→ Although the entire second class must be a friend to the first class, you can select which functions in the first class will be friends of the second class.
→ Although the entire second class must be a friend to the first class, you can select which functions in the first class will be friends of the second class.
Question 59 |
When a method in a subclass has the same name and type signatures as a method in the super class, then the method in the subclass _____ the method in the super class.
Overloads | |
Friendships | |
Inherits | |
Overrides |
Question 59 Explanation:
→ When a method in a subclass has the same name and type signatures as a method in the superclass, then the method in the subclass overrides the method in the superclass.
Question 60 |
Consider the following two statements:
(a) A publicly derived class is a subtype of its base class.
(b) Inheritance provides for code reuse.
(a) A publicly derived class is a subtype of its base class.
(b) Inheritance provides for code reuse.
Both the statements (a) and (b) are correct. | |
Neither of the statements (a) and (b) are correct | |
Statement (a) is correct and (b) is incorrect | |
Statement (a) is incorrect and (b) is correct. |
Question 60 Explanation:
→ A publicly derived class is a subtype of its base class.
→ Inheritance is defined as deriving new classes (sub classes) from existing ones (super class or base class) and forming them into a hierarchy of classes.
→ Inheritance allows programmers to create classes that are built upon existing classes, to specify a new implementation while maintaining the same behaviors (realizing an interface), to reuse code and to independently extend original software via public classes and interfaces.
→ Inheritance is defined as deriving new classes (sub classes) from existing ones (super class or base class) and forming them into a hierarchy of classes.
→ Inheritance allows programmers to create classes that are built upon existing classes, to specify a new implementation while maintaining the same behaviors (realizing an interface), to reuse code and to independently extend original software via public classes and interfaces.
Question 61 |
In C++, which system - provided function is called when no handler is provided to deal with an exception?
terminate( ) | |
unexpected( ) | |
abort( ) | |
kill( ) |
Question 61 Explanation:
In some cases, the exception handling mechanism fails and a call to void terminate() is made. This terminate() call occurs in any of the following situations:
The exception handling mechanism cannot find a handler for a thrown exception. The following cases are more specific:
1. During stack unwinding, a destructor throws an exception and that exception is not handled.
2. The expression that is thrown also throws an exception, and that exception is not handled.
3. The constructor or destructor of a nonlocal static object throws an exception, and the exception is not handled.
4. A function registered with atexit() throws an exception, and the exception is not handled. The following demonstrates this:
A throw expression without an operand tries to rethrow an exception, and no exception is presently being handled.
The exception handling mechanism cannot find a handler for a thrown exception. The following cases are more specific:
1. During stack unwinding, a destructor throws an exception and that exception is not handled.
2. The expression that is thrown also throws an exception, and that exception is not handled.
3. The constructor or destructor of a nonlocal static object throws an exception, and the exception is not handled.
4. A function registered with atexit() throws an exception, and the exception is not handled. The following demonstrates this:
A throw expression without an operand tries to rethrow an exception, and no exception is presently being handled.
Question 62 |
Which of the following differentiates between overloaded functions and overridden functions ?
Overloading is a dynamic or runtime binding and overridden is a static or compile time binding. | |
Overloading is a static or compile time binding and overriding is dynamic or runtime binding. | |
Redefining a function in a friend class is called overloading, while redefining a function in a derived class is called as overridden function. | |
Redefining a function in a derived class is called function overloading, while redefining a function in a friend class is called function overriding. |
Question 62 Explanation:

Question 63 |
What is the output of the following JAVA program ?
class simple
{
public static void main(String[ ] args)
{
simple obj = new simple( );
obj.start( );
}
void start( )
{
long [ ] P= {3, 4, 5};
long [ ] Q= method (P);
System.out.print (P[0] + P[1] + P[2]+”:”);
System.out.print (Q[0] + Q[1] + Q[2]);
}
long [ ] method (long [ ] R)
{
R [1]=7; return R;
}
} //end of class
class simple
{
public static void main(String[ ] args)
{
simple obj = new simple( );
obj.start( );
}
void start( )
{
long [ ] P= {3, 4, 5};
long [ ] Q= method (P);
System.out.print (P[0] + P[1] + P[2]+”:”);
System.out.print (Q[0] + Q[1] + Q[2]);
}
long [ ] method (long [ ] R)
{
R [1]=7; return R;
}
} //end of class
12 : 15 | |
15 : 12 | |
12 : 12 | |
15 : 15 |
Question 63 Explanation:
First we will create the object of simple class.
By using object , we call the function start().
In the start() function definition, first statement is integer array with three elements.
long [ ] Q= method (P); Again function method(p) will be called.
In the definition of method function, we are changing the second element of array to value 7 and returning updated array to array Q.
We are passing address of P as argument to method so Modifications happened in the method automatically reflects to array P.
Both array P and Q consists of values {3,7,5}
The sum of the three values are 15
By using object , we call the function start().
In the start() function definition, first statement is integer array with three elements.
long [ ] Q= method (P); Again function method(p) will be called.
In the definition of method function, we are changing the second element of array to value 7 and returning updated array to array Q.
We are passing address of P as argument to method so Modifications happened in the method automatically reflects to array P.
Both array P and Q consists of values {3,7,5}
The sum of the three values are 15
Question 64 |
In Java, which of the following statements is/are True ?
S1 : The ‘final’ keyword applied to a class definition prevents the class from being extended through derivation.
S2 : A class can only inherit one class but can implement multiple interfaces.
S3 : Java permits a class to replace the implementation of a method that it has inherited. It is called method overloading.
S1 : The ‘final’ keyword applied to a class definition prevents the class from being extended through derivation.
S2 : A class can only inherit one class but can implement multiple interfaces.
S3 : Java permits a class to replace the implementation of a method that it has inherited. It is called method overloading.
S1 and S2 only | |
S1 and S3 only | |
S2 and S3 only | |
All of S1, S2 and S3 |
Question 64 Explanation:
● If a class has multiple methods having same name but different in parameters, it is known as Method Overloading.Method Overloading is a feature that allows a class to have more than one method having the same name, if their argument lists are different.So the option-3 is False.
● The final keyword in java is used to restrict the user. The java final keyword can be used in many context. Final can be: variable, method and class.
● A Java class can only extend one parent class. Multiple inheritance (extends) is not allowed. Interfaces are not classes, however, and a class can implement more than one interface.
● The final keyword in java is used to restrict the user. The java final keyword can be used in many context. Final can be: variable, method and class.
● A Java class can only extend one parent class. Multiple inheritance (extends) is not allowed. Interfaces are not classes, however, and a class can implement more than one interface.
Question 65 |
Which of the following statements is/are TRUE regarding JAVA ?
(a) Constants that cannot be changed are declared using the ‘static’ keyword.
(b) A class can only inherit one class but can implement multiple interfaces.
Only (a) is TRUE. | |
Only (b) is TRUE. | |
Both (a) and (b) are TRUE. | |
Neither (a) nor (b) are TRUE. |
Question 65 Explanation:
FALSE: Constants that cannot be changed are declared using the ‘static’ keyword.
TRUE: A class can only inherit one class but can implement multiple interfaces.
TRUE: A class can only inherit one class but can implement multiple interfaces.
Question 66 |
What is the output of the following JAVA program ?
Class Test {
public static void main(String[] args) {
Test obj = new Test();
obj.start();
}
void start() {
String stra = ”do”;
String strb = method(stra);
System.out.print(“: ”+stra + strb);
}
String method(String stra) {
stra = stra + ”good”;
System.out.print(stra);
return“ good”;
}
}
Class Test {
public static void main(String[] args) {
Test obj = new Test();
obj.start();
}
void start() {
String stra = ”do”;
String strb = method(stra);
System.out.print(“: ”+stra + strb);
}
String method(String stra) {
stra = stra + ”good”;
System.out.print(stra);
return“ good”;
}
}
dogood : dogoodgood | |
dogood : gooddogood | |
dogood : dodogood | |
dogood : dogood |
Question 67 |
Given the array of integers ‘array’ shown below :
What is the output of the following JAVA statements ?
int [ ] p = new int [10];
int [ ] q = new int [10];
for (int k = 0; k < 10; k ++)
p[k] = array [k];
q = p;
p[4] = 20;
System.out.println (array [4] + “ : ” + q[4]);

What is the output of the following JAVA statements ?
int [ ] p = new int [10];
int [ ] q = new int [10];
for (int k = 0; k < 10; k ++)
p[k] = array [k];
q = p;
p[4] = 20;
System.out.println (array [4] + “ : ” + q[4]);
20 : 20 | |
18 : 18 | |
18 : 20 | |
20 : 18 |
Question 67 Explanation:

Question 68 |
Consider the following JAVA program :
public class First {
public static int CBSE (int x) {
if (x < 100) x = CBSE (x + 10);
return (x – 1);
}
public static void main (String[] args){
System.out.print(First.CBSE(60));
}
}
What does this program print ?
public class First {
public static int CBSE (int x) {
if (x < 100) x = CBSE (x + 10);
return (x – 1);
}
public static void main (String[] args){
System.out.print(First.CBSE(60));
}
}
What does this program print ?
59 | |
95 | |
69 | |
99 |
Question 68 Explanation:
Main program will call the function CBSE(60)
According to the function definition,
Function call CBSE(100) will give the value of 99,
100<100 condition is false and it will return x-1 which is 99
x=CBSE(90)
90<100 is true----> x=CBSE(100) and it will return x-1
CBSE(100) will return 99 to Function CBSE(90) and this function will return to 98(99-1).
Repeat this procedure,
CBSE(60) will return 95
According to the function definition,
Function call CBSE(100) will give the value of 99,
100<100 condition is false and it will return x-1 which is 99
x=CBSE(90)
90<100 is true----> x=CBSE(100) and it will return x-1
CBSE(100) will return 99 to Function CBSE(90) and this function will return to 98(99-1).
Repeat this procedure,
CBSE(60) will return 95
Question 69 |
Which of the following statement(s) with regard to an abstract class in JAVA is/are TRUE ?
I. An abstract class is one that is not used to create objects.
II. An abstract class is designed only to act as a base class to be inherited by other classes.
I. An abstract class is one that is not used to create objects.
II. An abstract class is designed only to act as a base class to be inherited by other classes.
Only I | |
Only II | |
Neither I nor II | |
Both I and II |
Question 69 Explanation:
Statement-I and II are TRUE
A class which is declared as abstract is known as an abstract class. It can have abstract and non-abstract methods. It needs to be extended and its method implemented. It cannot be instantiated.
Rules:
1. An abstract class must be declared with an abstract keyword.
2. It can have abstract and non-abstract methods.
3. It cannot be instantiated.
4. It can have constructors and static methods also.
5. It can have final methods which will force the subclass not to change the body of the method.
A class which is declared as abstract is known as an abstract class. It can have abstract and non-abstract methods. It needs to be extended and its method implemented. It cannot be instantiated.
Rules:
1. An abstract class must be declared with an abstract keyword.
2. It can have abstract and non-abstract methods.
3. It cannot be instantiated.
4. It can have constructors and static methods also.
5. It can have final methods which will force the subclass not to change the body of the method.
Question 70 |
Match the following types of variables with the corresponding programming languages:

(a)-(i), (b)-(iii), (c)-(iv), (d)-(ii) | |
(a)-(iv), (b)-(i), (c)-(iii), (d)-(ii) | |
(a)-(iii), (b)-(i), (c)-(iv), (d)-(ii) | |
(a)-(ii), (b)-(i), (c)-(iii), (d)-(iv)
|
Question 70 Explanation:
Static variables→ Fortran 77
Stack dynamic→ Local variables in Pascal
Explicit heap dynamic→ All objects in JAVA
Implicit heap dynamic→ All variables in APL
Stack dynamic→ Local variables in Pascal
Explicit heap dynamic→ All objects in JAVA
Implicit heap dynamic→ All variables in APL
Question 71 |
Implicit return type of a class constructor is:
not of class type itself | |
class type itself | |
a destructor of class type | |
a destructor not of class type |
Question 71 Explanation:
Implicit return type of a class constructor is class type itself.
Syntax For Constructors:
Access_Modifier No Return_Type Class(...)
Example:
public static main(String [ ]args)
Constructor rules:
1. Constructors are always used with a new.
2. Have the same name as that of Class
3. Does not have a return type
4. Can be Overloaded but not Overridden.
Syntax For Constructors:
Access_Modifier No Return_Type Class(...)
Example:
public static main(String [ ]args)
Constructor rules:
1. Constructors are always used with a new.
2. Have the same name as that of Class
3. Does not have a return type
4. Can be Overloaded but not Overridden.
Question 72 |
It is possible to define a class within a class termed as nested class. There are _____ types of nested classes.
2 | |
3 | |
4 | |
5 |
Question 72 Explanation:
Nested classes are divided into two categories:
1. Static
2. Non static.
Nested classes that are declared static are simply called static nested classes.
Non static nested classes are called inner classes.
1. Static
2. Non static.
Nested classes that are declared static are simply called static nested classes.
Non static nested classes are called inner classes.
Question 73 |
Which of the following statements is correct?
Aggregation is a strong type of association between two classes with full ownership | |
Aggregation is a strong type of association between two classes with partial ownership. | |
Aggregation is a weak type of association between two classes with partial ownership. | |
Aggregation is a weak type of association between two classes with full ownership. |
Question 73 Explanation:
Aggregation is a special form of association. It is a relationship between two classes like association, however its a directional association, which means it is strictly a one way association. It represents a HAS-A relationship.
For example consider two classes Student class and Address class. Every student has an address so the relationship between student and address is a Has-A relationship. But if you consider its vice versa then it would not make any sense as an Address doesn’t need to have a Student necessarily.
For example consider two classes Student class and Address class. Every student has an address so the relationship between student and address is a Has-A relationship. But if you consider its vice versa then it would not make any sense as an Address doesn’t need to have a Student necessarily.
Question 74 |
Which of the following statements is correct?
(1) Every class containing abstract method must not be declared abstract.
(2) Abstract class cannot be directly initiated with ‘new’ operator.
(3) Abstract class cannot be initiated.
(4) Abstract class contains definition of implementation.
(1) Every class containing abstract method must not be declared abstract.
(2) Abstract class cannot be directly initiated with ‘new’ operator.
(3) Abstract class cannot be initiated.
(4) Abstract class contains definition of implementation.
(1) | |
(2) | |
(2) and (3) | |
All are correct. |
Question 74 Explanation:
• Abstract class may consist of at least one abstract method.
• Abstract method means method without body, we can also be called as pure virtual functions.
• If a class is marked with keyword abstract then it is called an abstract class. It can NOT be instantiated by using new operator. But an abstract class can be used as the superclass reference for the subclass object.
• Abstract classes, by design, are not complete or functional. They are meant to serve as a base from which complete classes can be built, by aggregating the common members and methods that they all will need into an abstract base class, and then allowing the inheriting classes to fill out the necessary details. So abstract class can’t be instantiated
• Abstract method means method without body, we can also be called as pure virtual functions.
• If a class is marked with keyword abstract then it is called an abstract class. It can NOT be instantiated by using new operator. But an abstract class can be used as the superclass reference for the subclass object.
• Abstract classes, by design, are not complete or functional. They are meant to serve as a base from which complete classes can be built, by aggregating the common members and methods that they all will need into an abstract base class, and then allowing the inheriting classes to fill out the necessary details. So abstract class can’t be instantiated
Question 75 |
When one object reference variable is assigned to another object reference variable then
a copy of the object is created. | |
a copy of the reference is created. | |
a copy of the reference is not created. | |
it is illegal to assign one object reference variable to another object reference variable. |
Question 75 Explanation:
• A reference variable is an alias, that is, another name for an already existing variable. Once a reference is initialized with a variable, either the variable name or the reference name may be used to refer to the variable.
• A reference variable must be initialized at the time of declaration.
• A reference variable must be initialized at the time of declaration.
Question 76 |
Method overriding can be prevented by using final as a modifier at ______.
The start of the class. | |
The start of method declaration. | |
The start of derived class. | |
The start of the method declaration in the derived class. |
Question 76 Explanation:
Method overriding can be prevented by using final as a modifier at the start of method declaration.
Question 77 |
Which of the following is a correct statement?
Composition is a strong type of association between two classes with full ownership. | |
Composition is a strong type of association between two classes with partial ownership. | |
Composition is a weak type of association between two classes with partial ownership. | |
Composition is a weak type of association between two classes with strong ownership. |
Question 77 Explanation:

Question 78 |
Which of the following is not a correct statement?
Every class containing abstract method must be declared abstract. | |
Abstract class can directly be initiated with ‘new’ operator. | |
Abstract class can be initiated. | |
Abstract class does not contain any de nition of implementation. |
Question 78 Explanation:
A class which is declared as abstract is known as an abstract class. It can have abstract and non-abstract methods. It needs to be extended and its method implemented. It cannot be instantiated.
Rules:
1. An abstract class must be declared with an abstract keyword.
2. It can have abstract and non-abstract methods.
3. It cannot be instantiated.
4. It can have constructors and static methods also.
5. It can have final methods which will force the subclass not to change the body of the method.
Rules:
1. An abstract class must be declared with an abstract keyword.
2. It can have abstract and non-abstract methods.
3. It cannot be instantiated.
4. It can have constructors and static methods also.
5. It can have final methods which will force the subclass not to change the body of the method.
Question 79 |
Java uses threads to enable the entire environment to be ______.
Symmetric | |
Asymmetric | |
Synchronous | |
Asynchronous |
Question 79 Explanation:
→ Java uses threads to enable the entire environment to be asynchronous.
→ Synchronous (or) Synchronized means "connected", or "dependent" in some way. In other words, two synchronous tasks must be aware of one another, and one task must execute in some way that is dependent on the other, such as wait to start until the other task has completed.
→ Asynchronous means they are totally independent and neither one must consider the other in any way, either in initiation or in execution.
→ Synchronous (or) Synchronized means "connected", or "dependent" in some way. In other words, two synchronous tasks must be aware of one another, and one task must execute in some way that is dependent on the other, such as wait to start until the other task has completed.
→ Asynchronous means they are totally independent and neither one must consider the other in any way, either in initiation or in execution.
Question 80 |
Match the following w.r.t. programming language:


(a)-(iii), (b)-(i), (c)-(ii), (d)-(iv) | |
(a)-(i), (b)-(iii), (c)-(ii), (d)-(iv) | |
(a)-(i), (b)-(iii), (c)-(iv), (d)-(ii) | |
(a)-(ii), (b)-(iv), (c)-(i), (d)-(iii) | |
None of the above |
Question 80 Explanation:
→ Dynamic programming language is a class of high-level programming languages which, at runtime, execute many common programming behaviors that static programming languages perform during compilation. These behaviors could include extension of the program, by adding new code, by extending objects and definitions, or by modifying the type system.
→ Ada is a structured, statically typed, imperative, and object-oriented high-level computer programming language, extended from Pascal and other languages.
→ Prolog is a logic programming language associated with artificial intelligence and computational linguistics. Prolog is intended primarily as a declarative programming language: the program logic is expressed in terms of relations, represented as facts and rules.
→ Python is dynamically typed and garbage-collected. It supports multiple programming paradigms, including procedural, object-oriented, and functional programming
→ Ada is a structured, statically typed, imperative, and object-oriented high-level computer programming language, extended from Pascal and other languages.
→ Prolog is a logic programming language associated with artificial intelligence and computational linguistics. Prolog is intended primarily as a declarative programming language: the program logic is expressed in terms of relations, represented as facts and rules.
→ Python is dynamically typed and garbage-collected. It supports multiple programming paradigms, including procedural, object-oriented, and functional programming
Question 81 |
Which of the following is used to make an Abstract class?
Making at least one member function as pure virtual functions | |
Making at least one member function as virtual function | |
Declaring as Abstract class using virtual keyword | |
Declaring as Abstract class using static keyword |
Question 81 Explanation:
Abstract class may consist of at least one abstract method.
Abstract method means method without body, we can also be called as pure virtual functions.
Abstract method means method without body, we can also be called as pure virtual functions.
Question 82 |
Match the following with reference to object oriented modelling:

(a)-(iv), (b)-(iii), (c)-(i), (d)-(ii) | |
(a)-(iii), (b)-(iv), (c)-(i), (d)-(ii) | |
(a)-(iii), (b)-(i), (c)-(ii), (d)-(iv) | |
(a)-(iv), (b)-(iii), (c)-(ii), (d)-(i) |
Question 82 Explanation:
Polymorphism: Polymorphism means many forms. It is used to perform similar operations to do similar things.
Inheritance: It is the process of creating new classes(derived class) from existing classes( base class) by inheriting their properties into derived class.
Encapsulation:It is the process of Picking both operator and attributes with operations appropriate to model an object
Abstraction: Abstraction refers to the process of Hiding implementation details of methods from users of objects
Inheritance: It is the process of creating new classes(derived class) from existing classes( base class) by inheriting their properties into derived class.
Encapsulation:It is the process of Picking both operator and attributes with operations appropriate to model an object
Abstraction: Abstraction refers to the process of Hiding implementation details of methods from users of objects
Question 83 |
Which of the following is/are correct with reference to Abstract class and interface ?
(a)A class can inherit only one Abstract class but may inherit several interfaces.
(b)An Abstract class can provide complete and default code but an interface has no code.
(a)A class can inherit only one Abstract class but may inherit several interfaces.
(b)An Abstract class can provide complete and default code but an interface has no code.
(a) is true
| |
(b) is true
| |
Both (a) and (b) are true
| |
Neither (a) nor (b) is true |
Question 83 Explanation:
Statement (a) is true.
An abstract class may or may not have abstract methods so that it may provide the complete and default code.
An abstract class may or may not have abstract methods so that it may provide the complete and default code.
Question 84 |
What is the output of the following JAVA program?
public class Good{
Private int m;
Public Good(int m){this.m=m;}
public Boolean equals(Good n){return n.m=m;}
public static void main(String args [ ]){
Good m1=new Good(22);
Good m2=new Good(22);
Object S1=new Good(22);
Object S2=new good(22);
System.out.println(m1.equals(m2));
System.out.println(m1.equals(s2));
System.out.println(m1.equals(s2));
System.out.println(s1.equals(m2));
}
}
public class Good{
Private int m;
Public Good(int m){this.m=m;}
public Boolean equals(Good n){return n.m=m;}
public static void main(String args [ ]){
Good m1=new Good(22);
Good m2=new Good(22);
Object S1=new Good(22);
Object S2=new good(22);
System.out.println(m1.equals(m2));
System.out.println(m1.equals(s2));
System.out.println(m1.equals(s2));
System.out.println(s1.equals(m2));
}
}
True, True, False, False | |
True, false, True, false | |
True, True, False, True | |
true, False, False, False | |
None of the above
|
Question 84 Explanation:

Note: Question is wrong, Change boolean to int data type then possibility option 4). Marks will be added to all.
Question 85 |
In Java, when we implement an interface method, it must be declared as:
Private | |
Protected | |
Public | |
Friend |
Question 86 |
Which one of the following is correct?
Java applets can not be written in any programming language | |
An applet is not a small program | |
An applet can be run on its own | |
Applets are embedded in another applications |
Question 87 |
Let A be the base class in C++ and B be the derived class from A with protected inheritance.
Which of the following statement is false for class B?
Which of the following statement is false for class B?
Member function of class B can access protected data of class A | |
Member function of class access public data of class A | |
Member function of class B cannot access private data of class A | |
Object of derived class B can access public base class data |
Question 87 Explanation:
A→ Base class
B→ Derived class from A with protected inheritance.
The friend functions and the member functions of a friend class can have direct access to both the PRIVATE and PROTECTED data, the member functions of a derived class can directly access only the PROTECTED data.
However, they can access the PRIVATE data through the member functions of the base class TRUE: Member function of class B can access protected data of class A
TRUE: Member function of class access public data of class A
FALSE: Member function of class B cannot access private data of class A
TRUE: Object of derived class B can access public base class data
B→ Derived class from A with protected inheritance.
The friend functions and the member functions of a friend class can have direct access to both the PRIVATE and PROTECTED data, the member functions of a derived class can directly access only the PROTECTED data.
However, they can access the PRIVATE data through the member functions of the base class TRUE: Member function of class B can access protected data of class A
TRUE: Member function of class access public data of class A
FALSE: Member function of class B cannot access private data of class A
TRUE: Object of derived class B can access public base class data
Question 88 |
Which of the following statements are true regarding C++?
(a) Overloading gives the capacity to an existing operator to operate on other data types.
(b) Inheritance in object oriented programming provides support to reusability.
(c) When object of a derived class is defined, first the constructor of derived class in executed then constructor of a base class is executed.
(d) Overloading is a type of polymorphism. Choose the correct option from those given below:
(a) and (b) only | |
(a), (b) and (c) only | |
(a), (b) and (d) only | |
(b), (c) and (d) only |
Question 88 Explanation:
TRUE: Overloading gives the capacity to an existing operator to operate on other data types.
TRUE: Inheritance in object oriented programming provides support to reusability.
FALSE: When object of a derived class is defined, first the constructor of derived class in executed then constructor of a base class is executed.
2 important points Order of Constructor Call with Inheritance in C++
1. Whether derived class's default constructor is called or parameterised is called, base class's default constructor is always called inside them.
2. To call base class's parameterised constructor inside derived class's parameterised constructor, we must mention it explicitly while declaring derived class's parameterized constructor.
TRUE: Overloading is a type of polymorphism.
TRUE: Inheritance in object oriented programming provides support to reusability.
FALSE: When object of a derived class is defined, first the constructor of derived class in executed then constructor of a base class is executed.
2 important points Order of Constructor Call with Inheritance in C++
1. Whether derived class's default constructor is called or parameterised is called, base class's default constructor is always called inside them.
2. To call base class's parameterised constructor inside derived class's parameterised constructor, we must mention it explicitly while declaring derived class's parameterized constructor.
TRUE: Overloading is a type of polymorphism.
Question 89 |
Java Virtual Machine (JVM) is used to execute architectural neutral byte code. Which of the following is needed by the JVM for execution of Java Code?
Class loader only | |
Class loader and Java Interpreter | |
Class loader, Java Interpreter and API | |
Java Interpreter only |
Question 90 |
Which of the following is NOT a type of constructor
Copy constructor | |
Friend constructor | |
Default constructor | |
Parameterized constructor |
Question 90 Explanation:
Parameterized constructors: Constructors that can take at least one argument are termed as parameterized constructors. When an object is declared in a parameterized constructor, the initial values have to be passed as arguments to the constructor function.
Default constructors: If the programmer does not supply a constructor for an instantiable class, Java/C++ compiler inserts a default constructor into your code on your behalf. This constructor is known as default constructor.
Copy Constructor: Copy constructors define the actions performed by the compiler when copying class objects. A Copy constructor has one formal parameter that is the type of the class (the parameter may be a reference to an object). It is used to create a copy of an existing object of the same class. Even though both classes are the same, it counts as a conversion constructor.
Default constructors: If the programmer does not supply a constructor for an instantiable class, Java/C++ compiler inserts a default constructor into your code on your behalf. This constructor is known as default constructor.
Copy Constructor: Copy constructors define the actions performed by the compiler when copying class objects. A Copy constructor has one formal parameter that is the type of the class (the parameter may be a reference to an object). It is used to create a copy of an existing object of the same class. Even though both classes are the same, it counts as a conversion constructor.
Question 91 |
Which one of the following CAN NOT be a friend
function | |
class | |
object | |
operator function |
Question 91 Explanation:
The function is not in the scope of the class to which it has been declared as a friend. It cannot be called using the object as it is not in the scope of that class. It can be invoked like a normal function without using the object.
Question 92 |
What should be the name of the constructor
same as object
| |
same as member | |
same as class | |
same as function |
Question 92 Explanation:
Constructor: a constructor (abbreviation: ctor) is a special type of subroutine called to create an object. A constructor resembles an instance method, but it differs from a method in that it has no explicit return type, it is not implicitly inherited and it usually has different rules for scope modifiers. Constructors often have the same name as the declaring class. They have the task of initializing the object's data members
Question 93 |
Which among the following is the correct way of declaring object of a class
Classname objectname;
| |
Class classname obj objectname; | |
Class classname obj objectname; | |
Classname obj objectname |
Question 93 Explanation:
The correct way of declaring object of a class is
Classname objectname;
For example ,let there be some class of name Area. So we can declare object of Area class like,
Area A1;
For example ,let there be some class of name Area. So we can declare object of Area class like,
Area A1;
Question 94 |
How many objects can be created in a single class?
1 | |
2 | |
3 | |
as many as required |
Question 94 Explanation:
An object is nothing but an instance of a class. A class can have as many instances as required. There is no restriction on the number of objects a class can have.
Question 95 |
Which of this process occur automatically by JAVA run time system?
Serialization | |
Garbage collection | |
File Filtering | |
All the given options |
Question 95 Explanation:
Serialization and deserialization occur automatically by java runtime system, Garbage collection also occur automatically but is done by CPU or the operating system not by the java runtime system
Question 96 |
The ‘new’ operator in JAVA
Returns a pointer to a variable
| |
Creates a variable called new | |
Obtains memory for a new variable | |
Tells how much memory is available |
Question 96 Explanation:
“new” operator in java is used to create a new object. And an object is nothing but an instance of a class. Some memory is allocated to each object for its execution. Hence option(C) is the correct answer.
Question 97 |
“this” keyword in JAVA is used to
Refer to current class object | |
Refer to static method of the class
| |
Refer to parent class object | |
Refer to static variable of the class |
Question 97 Explanation:
“this” is a reference variable that refers to the current object of the class.
Question 98 |
Which of the following features is the best to support JAVA application development distributed across a network of Java Virtual machines?
Remove Method Invocation (RMI) | |
Remote Procedure Calls (RPC) | |
Multicast sockets | |
Remote Method Invocation (RMI) or Remote Procedure Calls (RPC) |
Question 99 |
Run-time polymorphism is achieved by
friend function | |
virtual function
| |
operator overloading | |
function overloading |
Question 99 Explanation:
Run-time polymorphism is achieved by function overriding.
Question 100 |
The operator that cannot be overloaded is
++ | |
:: | |
0 | |
~ |
Question 100 Explanation:
There are 4 operators that cannot be overloaded in C++. They are :: (scope resolution), . (member selection), . * (member selection through pointer to function) and ?: (ternary operator).
Question 101 |
The keyword friend does not appear in
the class allowing access to another class | |
the class desiring access to another class | |
the private section of a class
| |
the public section of a class |
Question 102 |
The C++ statement cout <<(0 ==0) will
Outputs as 0 | |
Outputs as 1 | |
Generate error at the time of compilation
| |
Generate run time |
Question 102 Explanation:
The above C++ statement outputs as 1.
Question 103 |
Which of the following supports the concept of multiple inheritance?
C++ | |
Java | |
Both C++ and Java | |
None |
Question 103 Explanation:
C++ supports multiple inheritance whereas java does not.
Question 104 |
Friend functions have access to
Private and protected members | |
Public members only | |
Private members only | |
None |
Question 104 Explanation:
A friend function of a class is defined outside that class' scope but it has the right to access all private and protected members of the class.
Question 105 |
Which of the following is not specified in Abstract data type?
Type | |
Set of operations on that type | |
How the type is implemented | |
(A) and (B) |
Question 105 Explanation:
An ADT does not specify how the data type is implemented.
Question 106 |
___________ is a class which implement lower level business abstractions required to manage the business domain class :
User interface class | |
System class | |
Business domain class | |
Process class |
Question 106 Explanation:
Process class is a class which implement lower level business abstractions required to manage the business domain class.
There are 106 questions to complete.