Uploaded by Donuts (Gamers1423)

UGRD-CS6203C-2223T

advertisement
UGRD-CS6203C Object Oriented
Programming
Started on
State
Completed on
Time taken
Friday, 27 January 2023, 7:13 AM
Finished
Friday, 27 January 2023, 7:23 AM
9 mins 23 secs
Marks
20.00/20.00
Grade
100.00 out of 100.00
Question 1
Correct
Mark 1.00 out of 1.00
Flag question
Question text
Feature of java that is very easy to learn, and its syntax is simple, clean and easy to
understand.
Select one:
a.
Simple
b.
Object-Oriented
c.
Portable
d.
Platform Independent
Question 2
Correct
Mark 1.00 out of 1.00
Flag question
Question text
Allows developers to create Java programs that can be executed and run by the JVM and
JRE.
Select one:
a.
J2SE
b.
JDK
c.
JVM
d.
JRE
Question 3
Correct
Mark 1.00 out of 1.00
Flag question
Question text
A popular general-purpose programming language and computing platform. It is fast,
reliable, and secure.
Select one:
a.
C++
b.
Php
c.
C#
d.
Java
Question 4
Correct
Mark 1.00 out of 1.00
Flag question
Question text
The J2SE 5.0 was released on
Select one:
a.
September 2004
b.
February 2002
c.
February 2000
d.
September 2002
Question 5
Correct
Mark 1.00 out of 1.00
Flag question
Question text
The J2SE 1.4 was released on
Select one:
a.
February 2002
b.
September 2002
c.
September 2004
d.
February 2000
Question 6
Correct
Mark 1.00 out of 1.00
Flag question
Question text
Part of the Java Runtime Environment(JRE) which is used to load Java classes into the Java
Virtual Machine dynamically.
Select one:
a.
Security Manager
b.
Classloader
c.
JVM
d.
Bytecode Verifier
Question 7
Correct
Mark 1.00 out of 1.00
Flag question
Question text
Feature of java that means, organizing our software as a combination of different types of
objects that incorporates both data and behavior.
Select one:
a.
Platform Independent
b.
Simple
c.
Portable
d.
Object-Oriented
Question 8
Correct
Mark 1.00 out of 1.00
Flag question
Question text
It is a Java platform component that executes programs.
Select one:
a.
JVM
b.
JDK
c.
J2SE
d.
JRE
Question 9
Correct
Mark 1.00 out of 1.00
Flag question
Question text
The J2SE 1.3 was released on
Select one:
a.
May 1998
b.
December 2000
c.
December 1998
d.
May 2000
Question 10
Correct
Mark 1.00 out of 1.00
Flag question
Question text
Java is a write once, runObject Oriented Programming anywhere language.
Select one:
a.
Simple
b.
Platform Independent
c.
Object-Oriented
d.
Portable
Question 11
Correct
Mark 1.00 out of 1.00
Flag question
Question text
Java is an Object-Oriented programming language developed by ______________ in the early
1990s
Select one:
a.
Dennis Ritchie
b.
Bjarne Stroustrup
c.
James Gosling
d.
Guido Van Rossum
Question 12
Correct
Mark 1.00 out of 1.00
Flag question
Question text
It facilitates you to carry the Java bytecode to any platform.
Select one:
a.
Platform Independent
b.
Portable
c.
Object-Oriented
d.
Simple
Question 13
Correct
Mark 1.00 out of 1.00
Flag question
Question text
The JDK 1.0 was released on
Select one:
a.
February 1997
b.
January 1997
c.
February 1996
d.
January 1996
Question 14
Correct
Mark 1.00 out of 1.00
Flag question
Question text
The JDK 1.1 was released on
Select one:
a.
February 1996
b.
January 1996
c.
January 1997
d.
February 1997
Question 15
Correct
Mark 1.00 out of 1.00
Flag question
Question text
It determines what resources a class can access such as reading and writing to the local disk.
Select one:
a.
Bytecode Verifier
b.
JVM
c.
Security Manager
d.
Classloader
Question 16
Correct
Mark 1.00 out of 1.00
Flag question
Question text
The JAVA SE 12 was released on
Select one:
a.
March 2018
b.
September 2019
c.
March 2019
d.
September 2018
Question 17
Correct
Mark 1.00 out of 1.00
Flag question
Question text
It checks the code fragments for illegal code that can violate access right to objects.
Select one:
a.
Bytecode Verifier
b.
Security Manager
c.
JVM
d.
Classloader
Question 18
Correct
Mark 1.00 out of 1.00
Flag question
Question text
The name Java originates from a sort of ____________
Select one:
a.
Latte Bean
b.
Mocha Bean
c.
Cappuccino Bean
d.
Expresso Bean
Question 19
Correct
Mark 1.00 out of 1.00
Flag question
Question text
The J2SE 1.2 was released on
Select one:
a.
December 2000
b.
May 1998
c.
December 1998
d.
May 2000
Question 20
Correct
Mark 1.00 out of 1.00
Flag question
Question text
It is the on-disk part of Java that creates the JVM.
Select one:
a.
J2SE
b.
JRE
c.
JDK
d.
JVM
QUIZ
PRELIM LAB QUIZ 1
Started on
State
Completed on
Time taken
Question 1
Incorrect
Wednesday, 8 February 2023, 6:33 AM
Finished
Wednesday, 8 February 2023, 6:39 AM
5 mins 52 secs
Marks
12.00/15.00
Grade
80.00 out of 100.00
Mark 0.00 out of 1.00
Flag question
Question text
[1] was the codename assigned to J2SE 1.2, which was released on December 8th, 1998.
Answer:
Codename Playground
Question 2
Incorrect
Mark 0.00 out of 1.00
Flag question
Question text
A technique known as [1] makes it easier to create and maintain software by laying down
some guidelines.
Answer:
softw are
Question 3
Correct
Mark 1.00 out of 1.00
Flag question
Question text
Along with the Java Virtual Machine and the Java Runtime Environment, the [1] is one of the
three primary technology stacks used in Java programming.
Answer:
Java Development Kit
Question 4
Correct
Mark 1.00 out of 1.00
Flag question
Question text
In the early 1990s, [1] created the object-oriented programming language Java.
Answer:
James Gosling
Question 5
Correct
Mark 1.00 out of 1.00
Flag question
Question text
In order to prevent access rights to objects violations, [1] scans the code fragments for any
errant code.
Answer:
Bytecode Verifier
Question 6
Correct
Mark 1.00 out of 1.00
Flag question
Question text
Gosling began referring to the tree outside his office as "__________" after it remained there.
It represents unity and is regarded as the national tree of many countries.
a.
Oak
b.
Palm
c.
Maple
d.
Poplar
e.
Beech
Feedback
Your answer is correct.
Question 7
Correct
Mark 1.00 out of 1.00
Flag question
Question text
The component of the Java platform that runs programs is called the [1].
Answer:
JVM
Question 8
Correct
Mark 1.00 out of 1.00
Flag question
Question text
The Java features, often known as [1], are some exceptional characteristics that significantly
contribute to the language's success.
Answer:
java buzzw ords
Question 9
Correct
Mark 1.00 out of 1.00
Flag question
Question text
The software tool that converts plain text Java files, which are raw java files, into executable
class files is called a [1].
Answer:
compiler
Question 10
Correct
Mark 1.00 out of 1.00
Flag question
Question text
Java's [1] is a component of the Java Runtime Environment that is used to dynamically load
Java classes into the Java Virtual Machine.
Answer:
classloader
Question 11
Correct
Mark 4.00 out of 4.00
Flag question
Question text
Match the codenames for each Java version that was created.
J2SE 5.0 / September 20, 2004
Answer 1
JH2SE 1.3 / May 8, 2000
Answer 2
J2SE 1.4 / February 6, 2002
Answer 3
JAVA SE 6 / December 11, 2006 Answer 4
Feedback
Your answer is correct.
Question 12
Incorrect
TIGER
KESTREL
MERLIN
MUSTANG
Mark 0.00 out of 1.00
Flag question
Question text
Software-based platforms and [1]-based platforms are the two categories of platforms.
Platform Independent
Answer:
Started on
State
Completed on
Time taken
Thursday, 16 February 2023, 2:43 PM
Finished
Thursday, 16 February 2023, 2:51 PM
8 mins 14 secs
Marks
20.00/20.00
Grade
100.00 out of 100.00
Question 1
Correct
Mark 1.00 out of 1.00
Flag question
Question text
These are variables which have declarations inside methods, constructors or blocks.
Select one:
a.
Instance variables
b.
Class variables
c.
Variable Types
d.
Local variables
Question 2
Correct
Mark 1.00 out of 1.00
Flag question
Question text
The super keyword refers to the ______________, immediately above of the calling class in the
hierarchy.
Select one:
a.
Super Keyword
b.
Constructor
c.
Super Class
d.
Inheritance
Question 3
Correct
Mark 1.00 out of 1.00
Flag question
Question text
Sub class is invoked when we create the object of subclass, it by default invokes the default
constructor of super class.
Select one:
a.
Super Keyword
b.
Constructor
c.
Super Class
d.
Inheritance
Question 4
Correct
Mark 1.00 out of 1.00
Flag question
Question text
This is the least restrictive access modifier. Methods and attributes that use the public
modifier can be accessed within your current class and by all other classes.
Select one:
a.
No Modifier
b.
Protected
c.
Private
d.
Public
Question 5
Correct
Mark 1.00 out of 1.00
Flag question
Question text
The class whose properties and functionalities are use (inherited) by another class is known
as _______________?
Select one:
a.
Sub Class
b.
Child Class
c.
B and C
d.
Parent Class
Question 6
Correct
Mark 1.00 out of 1.00
Flag question
Question text
One of the OOPs feature that allows us to perform a single action in different ways.
Select one:
a.
Polymorphism
b.
Inheritance
c.
Abstraction
d.
Encapsulation
Question 7
Correct
Mark 1.00 out of 1.00
Flag question
Question text
These variables are inside a class however outside any method. They come into existence
when the class instantiates.
Select one:
a.
Variable Types
b.
Instance variables
c.
Class variables
d.
Local variables
Question 8
Correct
Mark 1.00 out of 1.00
Flag question
Question text
The following are the advantages of Inheritance except.
Select one:
a.
Allows you to define one interface
b.
One superclass can be used for the number of subclasses in a hierarchy
c.
Reusability of code
d.
Avoids duplicity and data redundancy
Question 9
Correct
Mark 1.00 out of 1.00
Flag question
Question text
This is the most restrictive and most commonly used access modifier. If you use the this
modifier with an attribute or method, it can only be accessed within the same class.
Select one:
a.
Public
b.
Private
c.
No Modifier
d.
Protected
Question 10
Correct
Mark 1.00 out of 1.00
Flag question
Question text
Attributes and methods with the access modifier protected can be accessed within your
class, by all classes within the same package, and by all subclasses within the same or other
packages.
Select one:
a.
No Modifier
b.
Public
c.
Private
d.
Protected
Question 11
Correct
Mark 1.00 out of 1.00
Flag question
Question text
The capability of a method to do different things based on the object that it is acting upon.
In other words, it allows you define one interface and have multiple implementations.
Select one:
a.
Polymorphism
b.
Encapsulation
c.
Inheritance
d.
Abstraction
Question 12
Correct
Mark 1.00 out of 1.00
Flag question
Question text
It has the static keyword as a prefix in its declaration. Its definition occurs only inside a class
and outside any function.
Select one:
a.
Local variables
b.
Instance variables
c.
Class variables
d.
Variable Types
Question 13
Correct
Mark 1.00 out of 1.00
Remove flag
Question text
Select one:
a.
Public
b.
Protected
c.
Private
d.
No Modifier
Question 14
Correct
Mark 1.00 out of 1.00
Flag question
Question text
The class that extends the features of another class is known as _____________?
Select one:
a.
Parent Class
b.
Child Class
c.
Sub Class
d.
B and C
Question 15
Correct
Mark 1.00 out of 1.00
Flag question
Question text
The superclass constructor can be called explicitly using the ____________________ ?
Select one:
a.
Super Class
b.
Inheritance
c.
Constructor
d.
Super Keyword
Question 16
Correct
Mark 1.00 out of 1.00
Flag question
Question text
The process by which one class acquires the properties (data members) and
functionalities(methods) of another class.
Select one:
a.
Polymorphism
b.
Abstraction
c.
Encapsulation
d.
Inheritance
Question 17
Correct
Mark 1.00 out of 1.00
Flag question
Question text
Use to define the visibility of classes, methods, and attributes.
Select one:
a.
Access Modifier
b.
Protected
c.
Public
d.
Private
Question 18
Correct
Mark 1.00 out of 1.00
Flag question
Question text
It is the most fundamental entity in Java or any other Object Oriented Language.
Select one:
a.
Class
b.
Behavior
c.
Method
d.
Object
Question 19
Correct
Mark 1.00 out of 1.00
Flag question
Question text
The same method in child class which is already present in the parent class.
Select one:
a.
Object Overloading
b.
Method Overriding
c.
Method Overloading
d.
Object Overriding
Question 20
Correct
Mark 1.00 out of 1.00
Flag question
Question text
It is a blueprint for objects to follow a specific schema defined in the class.
Select one:
a.
Method
b.
Behavior
c.
Object
Started on
State
Completed on
Time taken
Thursday, 16 February 2023, 2:57 PM
Finished
Thursday, 16 February 2023, 3:04 PM
7 mins 6 secs
Marks
8.00/10.00
Grade
80.00 out of 100.00
Question 1
Correct
Mark 1.00 out of 1.00
Flag question
Question text
A method's ability to perform various actions depending on the object it is interacting with
is known as [1].
Answer:
Polymorphism
Question 2
Incorrect
Mark 0.00 out of 1.00
Flag question
Question text
The class that expands the features of another class is known as a [1].
Answer:
subclass
Question 3
Correct
Mark 1.00 out of 1.00
Flag question
Question text
[1] is another name for encapsulation.
Answer:
data hiding
Question 4
Correct
Mark 1.00 out of 1.00
Flag question
Question text
In Java or any Object-Oriented Language, an [1] is the most fundamental entity. Due to the
possibility that each of them could have unique behavior, identity, and data, it reflects reallife entities.
Answer:
Object
Question 5
Correct
Mark 1.00 out of 1.00
Flag question
Question text
One OOP feature called [1] lets us carry out a single action in a variety of ways.
Answer:
Polymorphism
Question 6
Incorrect
Mark 0.00 out of 1.00
Flag question
Question text
The term "[1]" refers to a class whose features and capabilities are utilized by another class.
Answer:
w rong
Question 7
Correct
Mark 1.00 out of 1.00
Flag question
Question text
Binding object state and behavior together is the definition of [1].
Answer:
Encapsulation
Question 8
Correct
Mark 1.00 out of 1.00
Flag question
Question text
For any attributes and internal methods that shouldn't be invoked from other classes, the [1]
modifier should always be used as the default.
Private
Answer:
Question 9
Correct
Mark 1.00 out of 1.00
Flag question
Question text
[1] is the process by which one class gains the characteristics and capabilities of another
class.
Answer:
Inheritance
Question 10
Correct
Mark 1.00 out of 1.00
Flag question
Question text
The behavior of objects of a particular kind is defined by [1]. It displays a list of all the
objects' properties.
Answer:
Started on
State
Completed on
Time taken
Marks
Sunday, 5 March 2023, 3:28 AM
Finished
Sunday, 5 March 2023, 3:42 AM
13 mins 20 secs
17.00/20.00
Grade
85.00 out of 100.00
Question 1
Correct
Mark 1.00 out of 1.00
Flag question
Question text
A class can be made static only if it is _______________?
Select one:
a.
Static class
b.
Nested class
c.
Static methods
d.
Nested methods
Question 2
Correct
Mark 1.00 out of 1.00
Flag question
Question text
A final class can be inherited.
Select one:
a.
True
b.
False
Question 3
Correct
Mark 1.00 out of 1.00
Flag question
Question text
A constructor can be declared as final.
Select one:
a.
False
b.
True
Question 4
Correct
Mark 1.00 out of 1.00
Flag question
Question text
We can change the value of a final variable.
Select one:
a.
True
b.
False
Question 5
Correct
Mark 1.00 out of 1.00
Flag question
Question text
It is common to all the instances (or objects) of the class because it is a class level variable.
Select one:
a.
Static Keyword
b.
Static members
c.
Static Block
d.
Static variable
Question 6
Incorrect
Mark 0.00 out of 1.00
Flag question
Question text
A final variable that is not initialized at the time of declaration is known as _______________.
Select one:
a.
Global variable
b.
Local variable
c.
Final variable
d.
Blank final variable
Question 7
Incorrect
Mark 0.00 out of 1.00
Flag question
Question text
It belong to the class instead of a specific instance, this means you can access it without
object.
Select one:
a.
Static Keyword
b.
Static members
c.
Static variable
d.
Static Block
Question 8
Correct
Mark 1.00 out of 1.00
Flag question
Question text
A class can have multiple Static blocks, which will execute in the same sequence in which
they have been written into the program.
Select one:
a.
True
b.
False
Question 9
Correct
Mark 1.00 out of 1.00
Flag question
Question text
Variables that is constants. This variable cannot be change once it is initialized.
Select one:
a.
Blank final variable
b.
Final variable
c.
Global variable
d.
Local variable
Question 10
Correct
Mark 1.00 out of 1.00
Flag question
Question text
It is a good practice to name final variable in all CAPS.
Select one:
a.
True
b.
False
Question 11
Incorrect
Mark 0.00 out of 1.00
Flag question
Question text
Finally is a method that is called by JVM during garbage collection.
Select one:
a.
False
b.
True
Question 12
Correct
Mark 1.00 out of 1.00
Flag question
Question text
It is used for initializing the static variables.
Select one:
a.
Static Keyword
b.
Static variable
c.
Static members
d.
Static Block
Question 13
Correct
Mark 1.00 out of 1.00
Flag question
Question text
A final method cannot be overridden.
Select one:
a.
False
b.
True
Question 14
Correct
Mark 1.00 out of 1.00
Flag question
Question text
Static variables are also known as ______________________?
Select one:
a.
Static block
b.
Class methods
c.
Static Keyword
d.
Class variables
Question 15
Correct
Mark 1.00 out of 1.00
Flag question
Question text
It can access class variables(static variables) without using object(instance) of the class.
Select one:
a.
Static block
b.
Class variables
c.
Static methods
d.
Class methods
Question 16
Correct
Mark 1.00 out of 1.00
Flag question
Question text
Making a member static can access it without object.
Select one:
a.
True
b.
False
Question 17
Correct
Mark 1.00 out of 1.00
Flag question
Question text
Local final variable must be initializing during declaration.
Select one:
a.
True
b.
False
Question 18
Correct
Mark 1.00 out of 1.00
Flag question
Question text
All variables declared in an interface are by default final.
Select one:
a.
True
b.
False
Question 19
Correct
Mark 1.00 out of 1.00
Flag question
Question text
finalize is used in exception handling.
Select one:
a.
False
b.
True
Question 20
Correct
Mark 1.00 out of 1.00
Flag question
Question text
If method parameters are declared final then the value of these parameters cannot be
changed.
Select one:
a.
True
b.
False
QUIZ
Midterm Quiz 2
Started on
State
Completed on
Time taken
Wednesday, 15 March 2023, 7:08 PM
Finished
Wednesday, 15 March 2023, 7:16 PM
8 mins 11 secs
Marks
11.00/20.00
Grade
55.00 out of 100.00
Question 1
Correct
Mark 1.00 out of 1.00
Flag question
Question text
A class which is not abstract is referred as.
Select one:
a.
Abstract class
b.
Concrete class
c.
Parent class
d.
Child class
Question 2
Correct
Mark 1.00 out of 1.00
Flag question
Question text
An abstract class can be instantiated.
Select one:
a.
True
b.
False
Question 3
Correct
Mark 1.00 out of 1.00
Flag question
Question text
Interface which is declared inside another interface or class.
Select one:
a.
Hierarchical interface
b.
Nested interface
c.
Multiple interface
d.
Implementation interface
Question 4
Correct
Mark 1.00 out of 1.00
Flag question
Question text
Nested interface are also known as?
Select one:
a.
Inner interface
b.
Map interface
c.
Abstract interface
d.
Outer interface
Question 5
Incorrect
Mark 0.00 out of 1.00
Flag question
Question text
Abstract method has no body.
Select one:
a.
False
b.
True
Question 6
Incorrect
Mark 0.00 out of 1.00
Flag question
Question text
Class that implements any interface must implement all the methods of that interface, else
the class should be declared abstract.
Select one:
a.
True
b.
False
Question 7
Correct
Mark 1.00 out of 1.00
Flag question
Question text
A class that is declared using abstract keyword.
Select one:
a.
Parent class
b.
Concrete class
c.
Abstract class
d.
Child class
Question 8
Incorrect
Mark 0.00 out of 1.00
Flag question
Question text
An interface can implement another interface
Select one:
a.
True
b.
False
Question 9
Incorrect
Mark 0.00 out of 1.00
Flag question
Question text
If a child does not implement all the abstract methods of abstract parent class, then the
child class must need to be declared abstract as well.
Select one:
a.
True
b.
False
Question 10
Incorrect
Mark 0.00 out of 1.00
Flag question
Question text
You can not have abstract method in a concrete class.
Select one:
a.
False
b.
True
Question 11
Correct
Mark 1.00 out of 1.00
Flag question
Question text
An abstract class has no use until unless it is extended by some other class.
Select one:
a.
True
b.
False
Question 12
Correct
Mark 1.00 out of 1.00
Flag question
Question text
Have methods and variables just like the class but the methods declared in it are by default
abstract.
Select one:
a.
Abstract class
b.
Interface
c.
Abstract method
d.
Override
Question 13
Incorrect
Mark 0.00 out of 1.00
Flag question
Question text
We can instantiate an interface in java.
Select one:
a.
False
b.
True
Question 14
Correct
Mark 1.00 out of 1.00
Flag question
Question text
Interface provides full abstraction as none of its methods have body.
Select one:
a.
True
b.
False
Question 15
Correct
Mark 1.00 out of 1.00
Flag question
Question text
The class that implements interface must implement all the methods of that interface.
Select one:
a.
True
b.
False
Question 16
Incorrect
Mark 0.00 out of 1.00
Flag question
Question text
If you declare an abstract method in a class then you don't need to declare the class
abstract as well.
Select one:
a.
True
b.
False
Question 17
Incorrect
Mark 0.00 out of 1.00
Flag question
Question text
An abstract class must be extended and in a same way abstract method must be overridden.
Select one:
a.
False
b.
True
Question 18
Incorrect
Mark 0.00 out of 1.00
Flag question
Question text
Extending an interface can implement another interface.
Select one:
a.
False
b.
True
Question 19
Correct
Mark 1.00 out of 1.00
Flag question
Question text
A class derived from the abstract class must implement all those methods that are declared
as abstract in the parent class.
Select one:
a.
True
b.
False
Question 20
Correct
Mark 1.00 out of 1.00
Flag question
Question text
The variables declared in an interface are public, static & final by default.
Select one:
a.
True
b.
False
Started on
State
Completed on
Time taken
Saturday, 18 February 2023, 1:59 AM
Finished
Saturday, 18 February 2023, 3:30 AM
1 hour 30 mins
Marks
42.00/50.00
Grade
84.00 out of 100.00
Question 1
Correct
Mark 1.00 out of 1.00
Flag question
Question text
In java control statements break, continue, return, try-catch-finally and assert belongs to?
a.
Loop Statements
b.
Pause Statement
c.
Selection statements
d.
Transfer statements
Feedback
Your answer is correct.
Question 2
Correct
Mark 1.00 out of 1.00
Flag question
Question text
The fields in an interface are implicitly specified as,
a.
protected
b.
private
c.
static only
d.
both static and final
Feedback
Your answer is correct.
Question 3
Correct
Mark 1.00 out of 1.00
Flag question
Question text
Division operator has ____ precedence over multiplication operator
a.
Equal
b.
Least
c.
Highest
d.
None of These
Feedback
Your answer is correct.
Question 4
Incorrect
Mark 0.00 out of 1.00
Flag question
Question text
Which one is true about a constructor ?
a.
A constructor must have the same name as the class it is declared within
b.
All of the above
c.
A constructor may be declared private
d.
A constructor is used to create objects
Feedback
Your answer is incorrect.
Question 5
Correct
Mark 1.00 out of 1.00
Flag question
Question text
Which type of function among the following shows polymorphism?
a.
Inline function
b.
Undefined functions
c.
Class member functions
d.
Virtual function
Feedback
Your answer is correct.
Question 6
Correct
Mark 1.00 out of 1.00
Flag question
Question text
Which among the following can’t be used for polymorphism?
a.
Member functions overloading
b.
Predefined operator overloading
c.
Static member functions
d.
Constructor overloading
Feedback
Your answer is correct.
Question 7
Incorrect
Mark 0.00 out of 1.00
Flag question
Question text
What is printed by the following statement? System.out.print("Hello,\nworld!");
a.
None of the above.
b.
Hello, \nworld!
c.
Hello, world!
d.
"Hello, \nworld!"
Feedback
Your answer is incorrect.
Question 8
Correct
Mark 1.00 out of 1.00
Flag question
Question text
What will be printed as the output of the following program? public class testincr { public
static void main(String args[]) { int i = 0; i = i++ + i; System.out.println("I = " +i); } }
a.
I=2
b.
I=1
c.
I=3
d.
I=0
Feedback
Your answer is correct.
Question 9
Correct
Mark 1.00 out of 1.00
Flag question
Question text
Which provides runtime environment for java byte code to be executed?
a.
JRE
b.
JAVAC
c.
JVM
d.
JDH
Feedback
Your answer is correct.
Question 10
Correct
Mark 1.00 out of 1.00
Flag question
Question text
Modulus operator (%) can be applied to which of these?
a.
Both A and B
b.
Integers
c.
None of These
d.
Floating - point numbers
Feedback
Your answer is correct.
Question 11
Correct
Mark 1.00 out of 1.00
Flag question
Question text
Which statement transfers execution to different parts of your code based on the value of
an expression?
a.
If
b.
Nested-if
c.
if-else-if
d.
Switch
Feedback
Your answer is correct.
Question 12
Correct
Mark 1.00 out of 1.00
Flag question
Question text
To prevent any method from overriding, we declare the method as,
a.
static
b.
abstract
c.
const
d.
final
Feedback
Your answer is correct.
Question 13
Correct
Mark 1.00 out of 1.00
Flag question
Question text
Which one is a template for creating different objects ?
a.
A class
b.
Method
c.
An Array
d.
Interface
Feedback
Your answer is correct.
Question 14
Correct
Mark 1.00 out of 1.00
Flag question
Question text
Consider the following code fragment Rectangle r1 = new Rectangle();
r1.setColor(Color.blue); Rectangle r2 = r1; r2.setColor(Color.red); After the above piece of
code is executed, what are the colors of r1 and r2 (in this order)?
a.
Color.red Color.red
b.
Color.blue Color.red
c.
Color.red Color.blue
d.
Color.blue Color.blue
Feedback
Your answer is correct.
Question 15
Correct
Mark 1.00 out of 1.00
Flag question
Question text
Which of the following variable declaration would NOT compile in a java program?
a.
int var1;
b.
int var;
c.
int 1_var;
d.
int VAR;
Feedback
Your answer is correct.
Question 16
Correct
Mark 1.00 out of 1.00
Flag question
Question text
Consider the two methods (within the same class) public static int foo(int a, String s) { s =
"Yellow"; a=a+2; return a; } public static void bar() { int a=3; String s = "Blue"; a = foo(a,s);
System.out.println("a="+a+" s="+s); } public static void main(String args[]) { bar(); } What is
printed on execution of these methods?
a.
a = 5 s = Blue
b.
a = 3 s = Yellow
c.
a = 5 s = Yellow
d.
a = 3 s = Blue
Feedback
Your answer is correct.
Question 17
Correct
Mark 1.00 out of 1.00
Flag question
Question text
Which programming language doesn’t support multiple inheritance?
a.
C and C++
b.
Java and SmallTalk
c.
Java
d.
C++ and Java
Feedback
Your answer is correct.
Question 18
Correct
Mark 1.00 out of 1.00
Flag question
Question text
Who is known as the father of Java Programming Language?
a.
Charel Babbage
b.
Blais Pascal
c.
James Gosling
d.
M. P Java
Feedback
Your answer is correct.
Question 19
Correct
Mark 1.00 out of 1.00
Flag question
Question text
Which of the following could be written with little knowledge of java?
a.
Java Server Pages
b.
Common Gateway Interface
c.
Java Community Program
d.
Java Servlets
Feedback
Your answer is correct.
Question 20
Correct
Mark 1.00 out of 1.00
Flag question
Question text
What is byte code in Java?
a.
Code generated by a Java compiler
b.
Name of Java source code file
c.
Block of code written inside a class
d.
Code generated by a Java Virtual Machine
Feedback
Your answer is correct.
Question 21
Correct
Mark 1.00 out of 1.00
Flag question
Question text
Which symbol is used to contain the values of automatically initialized arrays?
a.
Parentheses
b.
Comma
c.
Brackets Brackets
d.
Braces
Feedback
Your answer is correct.
Question 22
Correct
Mark 1.00 out of 1.00
Flag question
Question text
In Java code, the line that begins with /* and ends with */ is known as?
a.
None of these
b.
Single line comment
c.
Both A & B
d.
Multiline comment
Feedback
Your answer is correct.
Question 23
Incorrect
Mark 0.00 out of 1.00
Flag question
Question text
Which of these is returned by operator '&' ?
a.
Float
b.
Boolean
c.
Integer
d.
Character
Feedback
Your answer is incorrect.
Question 24
Incorrect
Mark 0.00 out of 1.00
Flag question
Question text
Which of the following are not Java keywords ?
a.
double
b.
case
c.
then
d.
switch
Feedback
Your answer is incorrect.
Question 25
Correct
Mark 1.00 out of 1.00
Flag question
Question text
What is the full form of JVM ?
a.
Java Virtual Machine
b.
Java Very Small Machine
c.
Java Verified Machine
d.
Java Very Large Machine
Feedback
Your answer is correct.
Question 26
Correct
Mark 1.00 out of 1.00
Flag question
Question text
Data type long literals are appended by _____
a.
Uppercase L
b.
Lowercase L
c.
Long
d.
Both A and B
Feedback
Your answer is correct.
Question 27
Correct
Mark 1.00 out of 1.00
Flag question
Question text
Which of these is not a bitwise operator?
a.
|=' Operator
b.
&=' Operator
c.
<=' Operator
d.
&' Operator
Feedback
Your answer is correct.
Question 28
Correct
Mark 1.00 out of 1.00
Flag question
Question text
Which of the following are not Java modifiers?
a.
public
b.
transient
c.
private
d.
friendly
Feedback
Your answer is correct.
Question 29
Incorrect
Mark 0.00 out of 1.00
Flag question
Question text
Which of the following is true?
a.
A finally block is executed whether an exception is thrown or not.
b.
A finally block is executed, only if an exception occurs.
c.
A finally block is executed before the catch block but after the try block.
d.
A finally block is executed, only after the catch block is executed.
Feedback
Your answer is incorrect.
Question 30
Correct
Mark 1.00 out of 1.00
Flag question
Question text
What do you call the languages that support classes but not polymorphism?
a.
If classes are supported, polymorphism will always be supported
b.
Procedure Oriented language
c.
Object-based language
d.
Class based language
Feedback
Your answer is correct.
Question 31
Correct
Mark 1.00 out of 1.00
Flag question
Question text
Which among the following best defines single level inheritance?
a.
A class inheriting a derived class
b.
A class which gets inherited by 2 classes
c.
A class inheriting a base class
d.
A class inheriting a nested class
Feedback
Your answer is correct.
Question 32
Correct
Mark 1.00 out of 1.00
Flag question
Question text
The default value of a static integer variable of a class in Java is,
a.
0
b.
Garbage value
c.
1
d.
Null
Feedback
Your answer is correct.
Question 33
Incorrect
Mark 0.00 out of 1.00
Flag question
Question text
What is byte code in Java?
a.
Code generated by a Java compiler
b.
Code generated by a Java Virtual Machine
c.
Block of code written inside a class
d.
Name of Java source code file
Feedback
Your answer is incorrect.
Question 34
Correct
Mark 1.00 out of 1.00
Flag question
Question text
Among these expressions, which is(are) of type String?
a.
'0'
b.
"0"
c.
Both (A) and (B) above
d.
"ab" + "cd"
Feedback
Your answer is correct.
Question 35
Correct
Mark 1.00 out of 1.00
Flag question
Question text
Which of the following is not true?
a.
An interface can extend another interface.
b.
An interface is a solution for multiple inheritance in java.
c.
An interface can implement another interface.
d.
A class which is implementing an interface must implement all the methods of the interface.
Feedback
Your answer is correct.
Question 36
Correct
Mark 1.00 out of 1.00
Flag question
Question text
Consider, public class MyClass { public MyClass(){/*code*/} // more code... } To instantiate
MyClass, you would write?
a.
MyClass mc = MyClass();
b.
MyClass mc = new MyClass();
c.
MyClass mc = new MyClass;
d.
MyClass mc = MyClass;
Feedback
Your answer is correct.
Question 37
Correct
Mark 1.00 out of 1.00
Flag question
Question text
A constructor
a.
Must have the same name as the class it is declared within.
b.
Is used to create objects.
c.
May be declared private
d.
(a), (b) and (c) above.
Feedback
Your answer is correct.
Question 38
Correct
Mark 1.00 out of 1.00
Flag question
Question text
Consider the following class definition: public class MyClass { private int value; public void
setValue(int i){ /* code */ } // Other methods... } The method setValue assigns the value of i
to the instance field value. What could you write for the implementation of setValue?
a.
value = i;
b.
Both (A) and (B) and above
c.
this.value = i;
d.
value == i;
Feedback
Your answer is correct.
Question 39
Correct
Mark 1.00 out of 1.00
Flag question
Question text
Which access type data gets derived as private member in derived class?
a.
Protected and Private
b.
Protected
c.
Public
d.
Private
Feedback
Your answer is correct.
Question 40
Correct
Mark 1.00 out of 1.00
Flag question
Question text
Which variables are created when an object is created with the use of the keyword 'new' and
destroyed when the object is destroyed?
a.
Instance variables
b.
Static variables
c.
Class Variables
d.
Local variables
Feedback
Your answer is correct.
Question 41
Correct
Mark 1.00 out of 1.00
Flag question
Question text
In java control statements break, continue, return, try-catch-finally and assert belongs to?
a.
Selection statements
b.
Pause Statemen
c.
Transfer statements
d.
Loop Statements
Feedback
Your answer is correct.
Question 42
Correct
Mark 1.00 out of 1.00
Flag question
Question text
What is the output of the following program: public class testmeth { static int i = 1; public
static void main(String args[]) { System.out.println(i+” , “); m(i); System.out.println(i); } public
void m(int i) { i += 2; } }
a.
1,1
b.
1,0
c.
3,1
d.
1,3
Feedback
Your answer is correct.
Question 43
Correct
Mark 1.00 out of 1.00
Flag question
Question text
Which of the following is TRUE?
a.
In java, an instance field declared public generates a compilation error.
b.
int is the name of a class available in the package java.lang
c.
A class has always a constructor (possibly automatically supplied by the java compiler).
d.
Instance variable names may only contain letters and digits.
Feedback
Your answer is correct.
Question 44
Incorrect
Mark 0.00 out of 1.00
Flag question
Question text
Which of these have highest precedence?
a.
++
b.
>>
c.
*
d.
()
Feedback
Your answer is incorrect.
Question 45
Correct
Mark 1.00 out of 1.00
Flag question
Question text
What is the type and value of the following expression? (Notice the integer division) -4 +
1/2 + 2*-3 + 5.0
a.
int -5
b.
int -4
c.
double -4.5
d.
double -5.0
Feedback
Your answer is correct.
Question 46
Correct
Mark 1.00 out of 1.00
Flag question
Question text
Multiple inheritance means,
a.
None of the above
b.
more classes inheriting from one super class
c.
one class inheriting from more super classes
d.
more classes inheriting from more super classes
Feedback
Your answer is correct.
Question 47
Correct
Mark 1.00 out of 1.00
Flag question
Question text
Which polymorphism behavior do you see in below class?
class Paint {
// all methods have same name
public void Color(int x) {}
public void Color(int x, int y) {}
public void Color(int x, int y, int z) {}
a.
Method overloading
b.
Run time polymorphism
c.
Constructor overloading
d.
Method overriding
Feedback
Your answer is correct.
Question 48
Correct
Mark 1.00 out of 1.00
Flag question
Question text
Java language was initially called as ________
a.
Pine
b.
J++
c.
Sumatra
d.
Oak
Feedback
Your answer is correct.
Question 49
Correct
Mark 1.00 out of 1.00
Flag question
Question text
Which one of the following is not true?
a.
A class must be qualified as ‘abstract’ class, if it contains one abstract method.
b.
An abstract class cannot have non-abstract methods.
c.
Abstract methods should be implemented in the derived class.
d.
A class containing abstract methods is called an abstract class.
Feedback
Your answer is correct.
Question 50
Incorrect
Mark 0.00 out of 1.00
Flag question
Question text
Which statement is not true in java language?
a.
A private member of a class cannot be accessed by the methods of the same class.
b.
A private member of a class cannot be accessed from its derived class.
c.
A public member of a class can be accessed in all the packages.
d.
A protected member of a class can be accessed from its derived class.
Feedback
Your answer is incorrect.
Finish review
Download