
JAVA MCQ TEST-I SLOT L31+L32
Authored by SRINIVASARAO 22PHD7042
Computers
University
Used 10+ times

AI Actions
Add similar questions
Adjust reading levels
Convert to real-world scenario
Translate activity
More...
Content View
Student View
20 questions
Show all answers
1.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Creating an object from a class is also called ____.
Initializing
Instantiating
Interfacing
NONE
2.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Which is the correct way of converting an int value to Integer in below Java code?
Integer in = new Integer(9);
Integer in = Integer.valueOf(9);
Integer in = new Integer("9");
NONE
3.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Choose the correct syntax of a Java Package below.
package PACKAGE_NAME;
package PACKAGE_NAME.*;
pkg PACKAGE_NAME;
pkg PACKAGE_NAME.*;
4.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What is a package in Java?
A Package is a collection of files of type Java Class, Interfaces, or Abstract Class
A Package is simply a Directory or Folder with Java Classes
A Package usually contains Java Classes written for a specific purpose or problem
All the above
5.
MULTIPLE CHOICE QUESTION
45 sec • 1 pt
What is the output of the below Java program with an Interface?
interface Car {
int basePrice=1000; }
public class InterfaceTest2 implements Car {
void changePrice() {
basePrice = 2000;
System.out.print(basePrice); }
public static void main(String[] args) {
new InterfaceTest2().changePrice(); } }
1000
2000
COMPILE TIME ERROR
NONE
6.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
An interface in Java is like a 100% ____.
abstract class
public class
inner class
anonymous class
7.
MULTIPLE CHOICE QUESTION
45 sec • 1 pt
What is the output of the below Java program
class Sweet {
void price() {
System.out.print("Sweet=$10 "); } }
class Sugar extends Sweet {
void price() {
super.price(); System.out.print("Sugar=$20"); } }
public class JavaInheritance1 {
public static void main(String[] args) {
Sugar su = new Sugar();
su.price(); } }
Sweet=$10 Sugar=$20
Sweet=$10 Sugar=$10
Sweet=$20 Sugar=$20
Compiler error
Access all questions and much more by creating a free account
Create resources
Host any resource
Get auto-graded reports

Continue with Google

Continue with Email

Continue with Classlink

Continue with Clever
or continue with

Microsoft
%20(1).png)
Apple
Others
Already have an account?