0% found this document useful (0 votes)
31 views

II B.Tech I Sem (MR-21) OOPS Objective Types Questions Bank

The document appears to be a midterm exam for an Object Oriented Programming class. It contains 25 multiple choice questions related to Java programming concepts like data types, operators, arrays, classes and more.

Uploaded by

shinshumanne
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
31 views

II B.Tech I Sem (MR-21) OOPS Objective Types Questions Bank

The document appears to be a midterm exam for an Object Oriented Programming class. It contains 25 multiple choice questions related to Java programming concepts like data types, operators, arrays, classes and more.

Uploaded by

shinshumanne
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 14

MALLA REDDY ENGINEERING COLLEGE (AUTONOMOUS)

II B.Tech II Semester (MR22 2022-23 Batch) Mid Term Examinations-I, April 2024

Subject Code & Name: - Object Oriented Programming (C0511) Max. Marks: 20
Branch: CSE (AI and ML)
Answer ALL the Questions:
S.No Question Answer

Which of the following option leads to the portability and security of Java. A

1 a. Bytecode is executed by JVM

b. The applet makes the Java code secure and portable

c. Use of exception handling d. Dynamic binding between objects

Which of the following is not a Java features? C

2 a. Dynamic b. Architecture Neutral

c. Use of pointers d. Object-oriented

What is size of int data type in cpp? B

3 a.2 Bytes b.4 Bytes


c.1 Byte d.Depends on Compiler

Can we overload functions in java? A

4 a.Yes b.No
c. Compilation Error d.Runtime Error

Java does not support _______________? B

5 a.Inheritance b.Multiple inheritance for classes

c.multiple inheritance of interfaces d.compile time polymorphism

Encapsulation concept in java is A

6 a.Hiding complexity b.method hiding c.Hiding constructor d.None

Which of these selection statements test only for equality? A

7 a.if b.switch

c.if & switch d.none of the mentioned


Which of these are selection statements in Java?

8 a.if() b.for() c.continue d.break

Which of the following loops will execute the body of loop even when condition B
controlling the loop is initially false?

a.do-while b.while c.for d.none of the mentioned


9

Which of the following is used with the switch statement? C

10 a.Continue b.Exit c.break d.do

List of keywords used in swith statement C

11 a.switch b.switch,case c.switch,case,break d.none

In java arrays are B

12 a.objects b.object references c.primitive data type d.none of the above

which will legally declare, construct, and initialize an array? D

13 a.int[] mylist = {}; b.int[] mylist = (5,8,2);

c.int mylist[][] = {4,9,7}; d.int[] mylist = {4,3,7}

The Java Virtual Machine (JVM) implements arrays as ___ type. B

14 a.Primitive b.Object c.none d.both

An array declaration in Java without initialization ___ memory. A

15 a.Does not allocate b. Allocates memory c. none d. both

In Java language, an array index starts with ___. B

16 a.-1 b.0 c.1 d. any integer

17 In Java, an array can be declared without initialization without mentioning the A


size. (TRUE / FALSE)
a. TRUE b. FALSE c. none d. both

What is the output of the below Java code snippet? int[] balls = {}; A
System.out.println(balls.length);
18
a.0 b.-1 c.1 d. compile error

What is the output of the below Java program? B

int ages[3] = {25, 27, 30};

19 System.out.println(ages[1]);

a.25 b.27 c.30 d. compile error

Which component is responsible for converting bytecode into machine specific C


code?
20
a. JVM b.JDK c.JIT d.JRE

Which component is responsible to run java program? A

21 a.JVM b.JDK c.JIT d.JRE

Which of the below is invalid identifier with the main method? C

22 a. public b. static c. private d.none

is java strongly typed language? A

23 a.TRUE b.FALSE c.none d.both

how much memory does char occupies B

24 a.2 bytes b.1 byte c.4 bytes d.8 bytes

what is a variable? A

25 a.variable is the basic unit of storage in a Java program

b.aquiring the properties of other object

c.ability to take more than one form.

d.instance of a class

26 what is an expression? A
a.An expression is a sequence of operands and operators

b.variable is the basic unit of storage in a Java program

c.aquiring the properties of other object

d.ability to take more than one form.

the other name for Conditional operator. B

27 a.arithmetic operator b.ternary operator c.relational operator d.none

why do we use relational operators? A

28 a.to determine the relationship b.to compare bit level c.Both above.
d.none

which are the following short circuit operators? B

29 a.-,*,/, + b.||, && c.Both above. d.none

what is type conversion? A

30 a.converting from one type to another type b.is a logical entity

c.which doesn’t have physicalorm d.none

how many types of type conversions are in java? B

31 a.1 b.2 c.4 d.5

Automatic type conversion is also called as A

32 a.implcit type conversion b.explicit type conversion

c.Both above. d.none

type casting means B

33 a.implcit type conversion b.explicit type conversion c.Both above. d.none

selection statement means B

34 a.lock of statements gets executed repeatedly until some condition met.

b.among different paths, only one path gets executed based on the condition

c.Both above. d.none


Iterative statement means A

a.block of statements gets executed repeatedly until some condition met.

35 b.among different paths, only one path gets executed based on the condition

c.Both above. d.none

do-while control statements executes the block atleast______ times. B

36 a.0 b.1 c.until condition met d.none

Among the following which is not jump statement C

37 a.Continue b.break c.for d.return

Among the following which is jump statement D

38 a.while b.for c.if & switch d.break

what is an array? A

39 a.collection of variables of homogeneous type that occupy contiguous memory


locations.

b.aquiring the properties of other object

c.ability to take more than one form. d.none

How much memory does byte occupies B

40 a.2 bytes b.1 byte c.4 bytes d.8 bytes

Which of the following is not type of class? C

41 a.Abstract Class b.Final Class c.Start Class d.none

What is default access specifier for data members or member functions declared D
within a class without any specifier in java
42
a.Private b.Protected c.Public d.no access modifier

Java is invented by C

a.Bjame Stroustrup b.Donald E. Knuth c.James Gosling d.charled


babbage
43
What does the expression float a = 35 / 0 return? D

44 a.0 b.Not a Number c.Infinity d.Run time exception

Evaluate the following Java expression, if x=3, y=5, and z=10: ++z + y - y + z + D
x++
45
a.24 b.23 c.20 d.25

What is the range of byte data type in Java? B

a.27 to -128 b.32767 to -32768

46 c.2147483647 to -2147483648 d.None of the mentioned

Which of these can not be used for a variable name in Java? B

a.identifier b.keyword c.identifier & keyword d.none of the


mentioned
47

Which of these is necessary condition for automatic type conversion in Java? B

a.The destination type is smaller than source type

48 b.The destination type is larger than source type

c.The destination type can be larger or smaller than source type d.None of the
mentioned

If an expression contains double, int, float, long, then the whole expression will C
be promoted into which of these data types?
49
a.long b.int c.double d.float

What is Truncation is Java? A

a.Floating-point value assigned to an integer type

50 b.Integer value assigned to floating type

c.Floating-point value assigned to an Floating type

d.Integer value assigned to floating type

which feature of OOP encourages the code reusability? B

51 a.polymorphism b.inheritance c.abstraction d.encapsulation


What is the extension of compiled java classes? A

52 a..class b..java c..txt d..js

polymorphism means B

53 a.aquiring the properties of other object b.ability to take more than one form.

c.instance of a class d.none

the new operator A

54 a.dynamically allocate memory b.statically allocates memory

c.both d. none

Which among the following is called first, automatically,whenever an object is B


created?
55
a.class b.constructor c.new d.none

Which among the following is not a necessary condition for constructors? C

56 a.Its name must be same as that of class b.It must not have any return type

c.It must contain a definition body d.It can contains arguments

In which access should a constructor be defined, so that object of the class can be A
created in any function?
57
a.public b.protected c.private d.any access specifier

Which of the following is a garbage collection technique? B

58 a.Cleanup model b.Mark and sweep model

c.Space management model d.Sweep model

Garbage Collection can be controlled by a program? B

59 a.TRUE b.FALSE c.both d.none

To successfully overload a method in Java, the return types must be ___. B

60 a.same b.different c.Same but using superclass or subclass types also work

d.none
To successfully overload a method in Java, the argument-list or parameter-list B
must be
61
a.same b.different c.same or different d.none

To successfully overload a method in Java, the method names must be ___. C

62 a.same b.different c.same or different d.none

Java method overloading implements the OOPS concept ___. B

63 a.Inheritance b.polymorphism c.encapsulation d.none

what is a class? D

a.is a logical construct b.a new data type

64 c.doesn’t have physcial form d.all the above

65 Constructor is like A
a. Method b. a class c. an object d. none

Constructor doesn’t have return type? B


66
a. FALSE b. TRUE c. both d. none

The following are the constructor types D


67
a. default constructor b. explicit constructor
c. parameterized constructor d. all the above

The purpose of constructor is? A


68
a.initialization b.adding numbers c.both d.none

The following are the inheritance types in java D


69 a.single inheritance b.multilevel inheritance

c.Cyclic inheritance d.all the above

class A Extends B {} In the above statement which is super class B


70
a.A b.B c.both d.none

class A Extends B {} In the above statement which is derived class A


71
a.A b.B c.both d.none
Method overloading is also called as A
72
a.static polymorphism b.dynamic polymorphism c.both d.none

Method overriding is also called as B


73
a.static polymorphism b.dynamic polymorphism c.both d.none

this keyword can be applied to D


74
a.variables b.methods c.constructor d.all the above

super keyword can be applied to D


75
a.variables b.methods c.constructor d.all the above

Java doesn’t support multiple inheritance through classes A


76
a.TRUE b.FALSE c.none d.all

It doesn’t support multiple inheritance through classes because B


77
a.to make it simple b.to avoid ambiguity c.both d.none

Is it possible to have a class with an abstract method B


78
a.FALSE b.TRUE c.all d.none

Is it possible to have an abstract class without an abstract method B


79
a.FALSE b.TRUE c.all d.none

An abstract class can be instantiated B


80
a.TRUE b.FALSE c.all d.none

final can be used as D

a.to create a named constant b.to disallow a method from being


81
overridden

c.to prevent a class from being inherited d.all the above

Can we overload main method? A


82
a.yes b.no c.all d.none

83 Which of these is correct way of inheriting class A by class B? C

a.class B + class A {} b.class B inherits class A {}


c.class B extends A {} d.class B extends class A {}

What is not type of inheritance? B

84 a.Single inheritance b.Double inheritance

c.Hierarchical inheritance d.Multiple inheritance

Using which of the following, multiple inheritance in Java can be implemented? C


85
a.Private methods b.Multithreading c.Interfaces d.Protected methods

All classes in Java are inherited from which class? C


86 a.java.lang.class b.java.class.inherited c.java.lang.Object
d.java.class.object

If super class and subclass have same variable name, which keyword should be C
87 used to use super class?

a.this b.upper c.super d.classname

A
Does Java support multiple level inheritance through classes?
88
a.TRUE b.FALSE c.all d.none

Which of these keywords can be used to prevent Method overriding? C


89
a.static b.constant c.final d.protected

Which of these is correct way of calling a constructor having no parameters, of D


90 superclass A by subclass B?

a.super(void); b.superclass.(); c.super.A(); d.super();

Which of these is supported by method overriding in Java? C


91
a.Abstraction b.encapsulation c.polymorphism d.none

Can we achieve 100% abstraction using abstract class? B


92
a.Yes b.No c.either Yes or No d.neither Yes or No

Does abstract class doesn't support multiple inheritances? B


93
a.Yes b.No c.either Yes or No d.neither Yes or No

94 Does an abstract class can provide the implementation of interface? B


a.Yes b.No c.either Yes or No d.neither Yes or No

Does an Interface can provide the implementation of abstract class? B


95
a.Yes b.No c.either Yes or No d.neither Yes or No

Does abstract class can contain non-abstract methods? A


96
a.Yes b.No c.either Yes or No d.neither Yes or No

In Java what is Method overriding? B

a.If a subclass uses a method that is already provided by its parent class, it is
known as Method Overriding.

97 b.If a subclass provides a specific implementation of a method that is already


provided by its parent class, it is known as Method Overriding.

c.Both o f the above

d.None of the above

In Java “is a” relationship between classes represents B


98
a.Static class b.Inheritance c. Composition d.Overriding

What type of inheritance does Java have? A


99 a.single inheritance b.double inheritance
c.multiple inheritance d.class inheritance

In Java can an object be a subclass of another object? B

a. Yes---as long as single inheritance is followed.

100 b.No---inheritance is only between classes.

c. Only when one has been defined in terms of the other.

d. Yes---when one object is used in the constructor of another.

Which keyword is used to declare an interface in java? B


101 a. class b. interface c. implements d.
abstract

102 A java interface can contain ———— C


a.public static Final Variables only b.public Abstract methods

c.Abstract methods(unimplemented) and implemented methods both

d.public static Final Variables and abstract methods both

Which is the correct way to inherit and implement the interface? Consider an A
example,

Interface is IAnimal and a class is Cat that wants to implement interface.


103
a.class Cat implements IAnimal{} b.class Cat extends
IAnimal{}

c.class Cat import IAnimal{} d.None is correct

Which of the following is true about methods in an interface in java? B

a.An interface can contain only abstract method.

b.We can define a method in an interface


104
c.Private and protected access modifiers can also be used to declare methods in
interface

d.None

Which one is correct declaration for implementing two interfaces? Consider, A


Interface A and B. class C wants to implements both interfaces.
105
a.class C implements A, B b.class C implements A, implements B

c.class C implements A extends B d.None

Java supports multiple inheritance through B


106
a.class b.interface c.implements d.abstract

Can we instantiate an interface B


107
a.TRUE b.FALSE c.either True or False d.neither True or False

Can we achieve 100% abstraction? B


108
a.TRUE b.FALSE c.either True or False d.neither True or False

109 Interface A{ } interface B extends A{}the above code is true? A


a.TRUE b.FALSE c.either True or False d.neither True or False

interface A{} class B implements A{} the above code is true? B


110
a.TRUE b.FALSE c.either True or False d.neither True or False

interface A{} interface B implements A{} the above code is true? B


111
a.TRUE b.FALSE c.either True or False d.neither True or False

interface A{} class B extends A{} the above code is true? A


112
a.TRUE b.FALSE c.either True or False d.neither True or False

Default access specifier of an abstract method in interface A


113
a.public b.private c.both d.none

By default a variable in an interface is a static constant. A


114
a.TRUE b.FALSE c.either True or False d.neither True or False

Which of these keywords is used to define packages in Java? C


115
a.pkg b.Pkg c.package d.Package

Which of these is a mechanism for naming and visibility control of a class and its B
116 content?
a.Object b.Packages c.Interfaces d.None of the Mentioned

Which of this access specifies can be used for a class so that its members can be C
117 accessed by a different class in the same package?

a.Public b.Protected c.No Modifier d.All of the mentioned

Which of these access specifiers can be used for a class so that its members can A
118 be accessed by a different class in the different package?

a.Public b.Protected c.No Modifier d.All of the mentioned

Which of the following is the correct way of importing an entire package ‘pkg’? C
119
a.import pkg b.Import pkg c.import pkg.* d.none

120 Which of the following is an incorrect statement about packages? D

a.Package defines a namespace in which classes are stored


b.A package can contain other package within it

c.Java uses file system directories to store packages

d.A package can be renamed without renaming the directory in which the classes
are stored

Which of the following package stores all the standard java classes? A
121
a.lang b.java c.util d.java.packages

Which of the following packages is used to includes utility classes like Calendar, D
122 Collection, Date?

a.java.lang b.java.net c.java.awt d.java.util

Packages that are inside another package are the _________ B


123
a.packages b.nested packages c.util subpackages d.subpackages

Which of these packages contains abstract keyword? A


124
a.java.lang b.java.util c.java.io d.java.system

Which of the following package stores all the standard java classes? A
125
a.java.lang b.java.util c.java.io d.java.system

Faculty Signatures HOD Signature

You might also like