0

Select the output of Java Program

Description: You will be given sample program or statement, Select appropriate output or statement from the given option
Number of Questions: 20
Created by:
Tags: java programming language
Attempted 0/20 Correct 0 Score 0

Syntax of System.arraycopy method??

  1. System.arraycopy(fromarray,frominden,toarray,toindex,count);

  2. System.arraycopy(toarray,toinden,fromarray,fromindex,count);

  3. System.arraycopy(fromarray,toarray,count);

  4. System.arraycopy();


Correct Option: A

interface <interface name> extends <interface name1>Is correct???

  1. True

  2. False


Correct Option: A

Is Multiple Inheritance allowed in JAVA???

  1. True

  2. False


Correct Option: B

Is typecasting is allowed between two different objects of different classes???

  1. True

  2. False


Correct Option: B

clone method used for..???

  1. Used for Cloning or copying integer var

  2. Used for Cloning or copying float var

  3. Used for Cloning or copying String var

  4. Used for Cloning an array


Correct Option: D

By default type of variable(data members) in interface..???

  1. public,final

  2. Only Final

  3. Only Public

  4. public,final,static


Correct Option: D

String name="ALIEN"; name.reverse();
Is code successfully compiled..???

  1. True

  2. False


Correct Option: B
int x = 10;
do {
 x--;
} while (x &lt; 10);

How many times the loop will be executed?

  1. ten times

  2. zero times

  3. one to nine times

  4. more than ten times


Correct Option: D
String[] elements = {
 "for",
 "tea",
 "too"
};
String first = (elements.length &gt; 0) ? elements[0] : null;

What is the result?

  1. Compilation fails

  2. An exception is thrown at runtime

  3. The variable first is set to null

  4. The variable first is set to elements[0]


Correct Option: D
public class CreditCard {
 private String cardID;
 private Integer limit;
 public String ownerName;
 public void setCardInformation(String cardID, String ownerName, Integer limit) {
  this.cardID = cardID;
  this.ownerName = ownerName;
  this.limit = limit;
 }
}

Which statement is true?

  1. The class is fully encapsulated

  2. The code demonstrates polymorphism

  3. The ownerName variable breaks encapsulation

  4. The cardID and limit variables break polymorphism


Correct Option: C

System.out.format("Pi is approximately %d.", Math.PI); What is the result?

  1. Compilation fails

  2. Pi is approximately 3

  3. Pi is approximately 3.141593

  4. An exception is thrown at runtime


Correct Option: D
String[] elements = { "for", "tea", "too" }; 
String first = (elements.length &gt; 0) ? elements[0] : null;    

What is the result?

  1. Compilation fails

  2. An exception is thrown at runtime

  3. The variable first is set to null

  4. The variable first is set to elements[0]


Correct Option: D
public class CreditCard {  
  private String cardID;  
  private Integer limit;  
  public String ownerName;
  public void setCardInformation(String cardID,  String ownerName,  Integer limit) {  
  this.cardID = cardID;  
  this.ownerName = ownerName;
  this.limit = limit; 
 }  
}    

Which statement is true?

  1. The class is fully encapsulated

  2. The code demonstrates polymorphism

  3. The ownerName variable breaks encapsulation

  4. The cardID and limit variables break polymorphism


Correct Option: C
- Hide questions