Font size
WorksheetsCMPTR 2L Midterm Exam
Total questions: 55
Worksheet time: 28mins
Attributes of an object are also known as
methods
properties
classes
functions
Polymorphism related to :
PPO
Class
OPP
OOP
Which from the following is a feature that allows us to perform a single action in different ways.
Abstraction
Polymorphism
Encapsulation
Inheritance
The process by which objects of one class acquire the properties of objects of another class is known as
Polymorphism
Inheritance
Data Hiding
Association
Hiding complexity can also be termed as
Inheritance
Overloading
Data hiding
Abstraction
Which one is NOT the basic element of OOP?
Class
Abstraction
BlueJ
Polymorphism
Name of the Parent class of Mortgage and Current
Account
Current
Mortgage
Bank
Select ALL subclasses
Account
Current
Mortgage
Bank
+ getEndDate
+ setOverdraft
are examples of what in OOP?
Classes
Objects
Attributes / Properties
Methods
+ getAccountNumber
+ addInterest
are examples of what in OOP?
Classes
Objects
Attributes / Properties
Methods
-OpeningDate
-InterestRate
are examples of what in OOP?
Classes
Objects
Attributes / Properties
Methods
Mortgage, Current and Account
are examples of what in OOP?
Classes
Objects
Attributes / Properties
Methods
Which of the these is the functionality of ‘Encapsulation’?
Binds together code and data
Using single interface for general class of actions
Reduce Complexity
All of the mentioned
You can make changes to an object with
methods
attributes
modifiers
parameters
What keyword is used to create an object?
new
create
build
start
main
A method is...
A way of calculating things in Java
A strategy for programming
A predefined set of instructions in a class
A way to sore details in a class
What is the range of short data type in Java
-128 to 127
-32768 to 32767
-2147483648 to 2147483647
None of the mentioned
2. What is the range of byte data type in Java?
a) -128 to 127
b) -32768 to 32767
c) -2147483648 to 2147483647
d) None of the mentioned
An expression involving byte, int, and literal numbers is promoted to which of these?
Int
Long
Byte
Float
Which of these literals can be contained in float data type variable?
a) -1.7e+308
b) -3.4e+038
c) +1.7e+308
d) -3.4e+050
Which of these operators is used to allocate memory to array variable in Java?
malloc
alloc
new
new malloc
Which of these is necessary to specify at time of array initialization?
Row
Column
Both row and column
None of the mentioned
Which of these have highest precedence?
()
++
*
>>
What should be expression1 evaluate to in using ternary operator as in this line?
expression1 ? expression2 : expression3
Floating point number
Integer
Boolean
None of the mentioned
Which of these are selection statements in Java?
If()
For()
Continue
Break
Which of the following is not OOPS concept in Java?
Polymorphism
Inheritance
Encapsulation
Compliation
JDK stands for?
Java Data Kit
Java Development Kit
Java Development Kart
Java Development Kind
Which of the following classes belongs to lang package in Java?
String, Math, Integer, Float
Date, Scanner, Vector
String, InputStreamReader, InputStreamWriter
Button, Menu, Scrollbar, Checkbox
Which of the following classes belongs to util package in Java?
String, Math, Integer, Float
Date, Scanner, Vector
String, InputStreamReader, InputStreamWriter
Button, Menu, Scrollbar, Checkbox
Which function is used to input int value in Java using Scanner class?
scanner_object . nextInteger( )
scanner_object . nextInt( )
scanner_object . nextint( )
scanner_object . NextInt( )
Which function is used to input float value in Java using Scanner class?
scanner_object . nextFloat( )
scanner_object . nextInt( )
scanner_object . nextfloat( )
scanner_object . NextFloat( )
Which function is used to input String value in Java using Scanner class?
scanner_object . nextLine( )
scanner_object . nextString( )
scanner_object . nextText( )
scanner_object . nextChar( )
Package is a collection of __________ .
Objects
Classes and Interfaces
Data
Variables and Constants
Select TWO correct ways of including (importing) package in our program?
import package_name . java . *;
import java . package_name . *;
include java . package_name . *;
import java . package_name . Class_Name;
Java is Truly (Pure) _____________ Language?
OOP
POP
Object Based
All of the given
Which is NOT the access specifier (visibility mode) in Java?
private
protected
friendly
publicly
if (x==10)
{
if (y==20)
{
System.out.println("Coordinates: 10, 20");
}
}
switch (flavor)
{
case 'V':
cone="Vanilla";
case 'C':
cone="Chocolate";
case 'S':
cone="Strawberry";
default:
cone="Empty";
}
grandTotal = (itemTaxable == 'Y') ? 10.60 : 10.00;
