educationalera

  • Increase font size
  • Default font size
  • Decrease font size

Java Language

AddThis Social Bookmark Button

6.) Which two cause a compiler error? (Choose two)

A) float[] = new float(3);

B) float f2[] = new float[];

C) float[] f1 = new float[3];

D) float f3[] = new float[3];

E) float f5[] = { 1.0f, 2.0f, 2.0f };

F) float f4[] = new float[] { 1.0f. 2.0f. 3.0f};

View Answer

Answer: Option A, B


7.) What will be the result of compiling and running the given program?

public class Child extends Parent

{

             public static int test(int i)

           {

                  return 20;

           }

    public static void main(String[] args)

    {

                 Parent c = new Child();

                System.out.println (c.test(10));

          }

}

class Parent

{

            public static int test(int i)

           {

                 return 5;

           }

}

A) Compile time as we can't overide static methods.

B) Run time error as we can't overide static methods.

C) Program compiles correctly and prints 5 when executed.

D) Program compiles correctly and prints 20 when executed.

View Answer 

Answer: Option C


8.) What will be the result of compiling and running the given program?

public class Q4

{

              public static void main(String[] args)

              {

boolean t1 = true, t2 = false, t3 = t1;

boolean t = false;

t &&= (t1 || ( t2 && t3));

System.out.println(t);

            }

}

A)      Program compiles correctly and print true when executed.

B)      Program compiles correctly and print false when executed.

C)      Compile time error.

D)      Run time error.

View Answer 

Answer: Option C


9.) Which of the following statements about finalize methods is true?

A) The purpose of a finalize method is to recover system resources other than memory.

B) The purpose of a finalize method is to recover memory and other system resources.

C) You should always write a finalize method for every class.

D) The order in which objects are created controls the order in which their finalize methods are called.

  View Answer  

Answer: Option  C


10.) What keyword is used to prevent an object from being serialized?

A) Private

B) Volatile

C) Protected

D) Transient

  View Answer  

Answer:  Option D


 

 
JPAGE_CURRENT_OF_TOTAL


Oracle Certification

oracle_logo

The Oracle Certification Program is a professional certification program offered by the Oracle Corporation. There are three levels of Oracle Certification in several disciplines: Oracle Certified Associate (OCA), Oracle Certified Professional (OCP), and Oracle Certified Master (OCM).

Java Certification

java_logo

Sun Certified Professional (SCP) is a professional certification program by Sun Microsystems, a subsidiary of Oracle Corporation. There are two levels of java Certification in several disciplines: Sun Certified Java Associate (SCJA), Sun Certified Java Programmer (SCJP), and Sun Certified Java Developer (SCJD)

Red Hat Certification

red_hat_logo

The Red Hat Certification Program is Red Hat's professional certification program for Red Hat and general Linux related skills such as system administration on Red Hat Enterprise Linux Red Hat Certified Technician (RHCT)  and Red Hat Certified Engineer (RHCE)