Welcome to your Foundation Test - 3 Code - 819

Name
Email
Phone
1.

Question: Which of the following statements are true?

Select 2 option(s):
2.

Question: Which of the following statements are true?

Select 2 option(s):
3.

Question:

You have created several threads in your application. To ensure that important tasks are performed quickly, you have increased the priority of some threads and lowered the priority of others. At run time, however, you observe that the lower priority threads rarely get a chance to run.  

What is this problem called?

Select 1 option(s):
4.

Question:

Given:

class Triangle{
public int base;
public int height;
public double area = 0;
public Triangle(int pBase, int pHeight){
this.base = pBase; this.height = pHeight;
updateArea();
}
public void updateArea(){
double a = base*height/2;
area = a;
}
public void setBase(int b){ base = b; updateArea(); }
public void setHeight(int h){ height = h; updateArea(); }
}

Which variables are not accessible from anywhere within given class code except from the scope in which they are declared?

Select 1 option(s):
5.

Question: Java Module system achieves which of the following objectives for a Java project?

Select 3 option(s):
6.

Question: How many methods have to be provided by a class that is not abstract and that says it implements Serializable interface?

Select 1 option(s):
7.

Question:

Identify correct statements about the Java module system.

Select 2 option(s):
8.

Question:

Select the correct order of restrictiveness for access modifiers...

(First one should be least restrictive)

Select 1 option(s):
9.

Question: Which of the following statements about an array are correct?

Select 2 option(s):
10.

Question:

In Java, Strings are immutable. A direct implication of this is...

Select 2 option(s):
11.

Question: Which of the following statements are correct regarding abstract classes and interfaces?

Select 2 option(s):
12.

Question: Under what situations does a class get a default constructor?

Select 1 option(s):
13.

Question: Objects of which of the following classes can be thrown using a throw statement?

Select 3 option(s):
14.

Question: Which method must be implemented by a class implementing the Callable interface?

Select 1 option(s):
15.

Question: Which variables declared in the encapsulating class or in the method, can an inner class access if the inner class is defined in a static method of encapsulating class?

Select 2 option(s):
16.

Question:

Given the following definition of class, which member variables are accessible from OUTSIDE the package com.enthu.qb?

package com.enthu.qb;
public class TestClass{
   int i;
   public int j;
   protected int k;
   private int l;
}

Select 2 option(s):
17.

Question: Which of the following are benefits of polymorphism?

Select 2 option(s):
18.

Question: What will be the output of the following program (excluding the quotes)?

public class SubstringTest{
   public static void main(String args[]){
      String String = "string isa string";
      System.out.println(String.substring(3, 6));
   }
}

Select 1 option(s):
19.

Question: In which of these variable declarations, will the variable remain uninitialized unless explicitly initialized?

Select 1 option(s):
20.

Question:

You have a collection (say, an ArrayList) which is read by multiple reader threads and which is modified by a single writer thread. The collection allows multiple concurrent reads but does not tolerate concurrent read and write. Which of the following strategies will you use to obtain best performance?

Select 1 option(s):
21.

Question:

Identify correct statements about annotations.

Select 1 option(s):
22.

Question: Which of the following are valid?

Select 2 option(s):
23.

Question: Which of these interfaces are in the Java Collections framework?

Select 4 option(s):
24.

Question: Which of the following methods are available in java.util.concurrent.ConcurrentMap in addition to the methods provided by java.util.Map?

Select 1 option(s):
25.

Question:

In the following code what will be the output if 0 (integer value zero) is passed to loopTest()?

public class TestClass{
public void loopTest(int x){
loop: for (var i = 1; i < 5; i++){
for (var j = 1; j < 5; j++){
System.out.println(i);
if (x == 0) { continue loop; }
System.out.println(j);
}
}
}
}

Select 1 option(s):

26.

Question:

An abstract method cannot be overridden.

Select 1 option(s):
27.

Question: Which of the following are meta-annotations?

Select 3 option(s):
28.

Question: Which is/are the root interface(s) for all collection related interfaces?

Select 2 option(s):
29.

Question:

Using a break in a while loop causes the loop to break the current iteration and start the next iteration of the loop.

Select 1 option(s):
30.

Question: Which of the following are valid standard country locale codes as returned by getCountry() method of Locale?

Select 3 option(s):
31.

Question: Which of these statements concerning the use of collection interfaces of the Java standard class library are true?

Select 1 option(s):
32.

Question: Which of the following statements are true?

Select 2 option(s):
33.

Question: What can be the type of a catch argument?

Select 1 option(s):
34.

Question: Which of the following operators can be used in conjunction with a String object?

Select 3 option(s):
35.

Question:

Identify legal module names.

Select 3 option(s):
36.

Question: Which of these statements about interfaces are true?

Select 4 option(s):
37.

Question: A JDBC driver implementation must provide implementation classes for which of the following interfaces?

Select 3 option(s):
38.

Question: Which of the following statements is/are true?

Select 1 option(s):
39.

Question: What is the correct declaration for an abstract method 'add' in a class that is accessible to any class, takes no arguments and returns nothing?

Select 1 option(s):
40.

Question: Which of the following is not a primitive data value in Java?

Select 2 option(s):
41.

Question: Which of the following statements are correct?

Select 3 option(s):
42.

Question:

An overriding method must have a same parameter list and the same return type as that of the overridden method.

Select 1 option(s):
43.

Question: Which of the following code fragments can you use to get a JDBC connection?

Select 1 option(s):
44.

Question: 

Given:

//In file AccessTest.java
package a;
public class AccessTest {
int a;
private int b;
protected void c(){ }
public int d(){  return 0; }
}

//In file AccessTester.java
package b;
import a.AccessTest;

public class AccessTester extends AccessTest{
    public static void main(String[] args) {
        AccessTest ref = new AccessTest();

    }
}

Idenfity the correct statements -

Select 1 option(s):
45.

Question:

Consider the following code:

        Locale myLoc = new Locale("fr", "FR");
        ResourceBundle rb = ResourceBundle.getBundle("appmessages", myLoc);
        //INSERT CODE HERE


Which of the following lines of code will assign a ResourceBundle for a different Locale to rb than the one currently assigned?

Select 2 option(s):
46.

Question: Which of these statements are true?

Select 2 option(s):
47.

Question: What classes can a non-static nested class extend ?

(Provided that the class to be extended is visible and is not final.)

Select 1 option(s):
48.

Question:

Consider the following method :

public void myMethod(int m, Object p, double d){
  ... valid code here
}


Assuming that there is no other method with the same name, which of the following options are correct regarding the above method?

Select 1 option(s):
49.

Question: Which operators will always evaluate all the operands?

Select 2 option(s):
50.

Question:

Consider the following code:

public class Conversion{
   public static void main(String[] args){
     int i = 1234567890;
     float f = i;
     System.out.println(i - (int)f);
   }
}


What will it print when run?

Select 1 option(s):
51.

Question: Which of the following are valid operators in Java?

Select 4 option(s):
52.

Question: Which of the following are standard annotations used to suppress various warnings generated by the compiler?

Select 3 option(s):