TOTAL QS = 27Time [ 00 : 00 : 00 ]
00:00:00

Java Interface Basics Online Practice Test 1

Instructions

Total Questions: 27

Total Minutes: 27

This ExamTray Free Online Test or Quiz or Trivia tests your Programming Skills on the basics of Java Interface. This practice test displays answers after finishing the exam for review. You can easily clear Competitive Exams and Job Interview Questions. Students can learn Java basics.

Go through Java Theory Notes on Interface and Java 8 Default and Static Methods in Interfaces before attempting this test.

All the Best

Challenge SCORE

0 / 27

Take This Exam
1) An interface in Java is like a 100% ____.
2) A Java Interface is not considered a class. State TRUE or FALSE.
3) Choose the correct syntax below for defining an Interface in Java.
4) Choose a correct statement about Java Interfaces?
5) A Java Class inherits Constants and Methods of an Interface using ____ keyword.
6) What is the output of the below Java program with an Interface?
interface Bus
{
  void move();
}
class ElectricBus implements Bus
{
  public void move()
  {
    System.out.println("Implemented  move() method.");
  }	
}
public class InterfaceTest1
{
  public static void main(String[] args)
  {
    new ElectricBus().move();
  }
}
7) 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();
  }
}
8) What is the output of the below Java program with an Interface?
interface Book
{
  char type='C';	
}
public class InterfaceTest3
{
  public static void main(String[] args)
  {
    System.out.println(new Book().type);
  }
}
9) All Interface variables are ___ by default in Java.
10) All Interface methods in Java are ____ by default.
11) A Class implementing an Interface can use ____ access modifier before the implemented methods.
12) A Java Class implementing an Interface can define a variable with the same name as that of the Interface constant. State TRUE or FALSE.
13) What is the output of the below Java program with an Interface?
interface Worm
{
  int teeth=2;
}
class BookWorm implements Worm
{
  int teeth=4;
  void show()
  {
    teeth= 5;
    System.out.println("Teeth: " + teeth);
  }
}
public class InterfaceTest4
{
  public static void main(String[] args)
  {
    new BookWorm().show();
  }
}
14) A Java Interface can not declare constructors. State TRUE or FALSE.
15) What is the output of the below Java program with an Interface?
interface Floor
{
  Floor(){ }
}
public class InterfaceTest5
{
  public static void main(String[] args)
  {
    System.out.print("Floor");
  }
}
16) Java 8 (Java 1.8) introduced the ___ feature.
17) Java Interface static methods have ___ compatibility with the existing project code.
18) Java Interface DEFAULT methods have ___ compatibility with the existing project code.
19) The DEFAULT methods of an Interface are suitable mostly for ___ type of projects.
20) Is it possible to remove the keyword DEFAULT and make the method abstract again in an Interface, if the Interface belongs to a Closed-Source project?
21) The annotation used in Java to override the method of a super-class or interface by the subclass or implementing class is ___.
22) It is ___ to override the static method of an Interface in Java.
23) A Java static method can not be ___.
24) Which is the missing java code in the class implementing an Interface below?
interface Linein
{  void addInput();	}

interface Lineout
{  void addOutput(); }

class Speaker implements Linein, Lineout
{
  //MISSING CODE
}

25) Which is the missing code to successfully compile the below Java program with abstract classes and Interfaces?
interface A
{  void a(); }

abstract class B implements A
{  abstract void b(); }

class C extends B
{
  //Missing methods
}
26) A Superinterface is comparable to a Superclass. State TRUE or FALSE.
27) A Static method of an Interface should be accessed with _____ and a DOT operator.

Open Certification Helper Popup Reset Popup