Skip to main content

Posts

Test : Java_7

This test contains 10 questions based on Java . Each question answered correctly awards you 1 point and each incorrect answer has a penalty of -0.25 points, no points are deducted for unattempted answers. Select Test Type Timed Test UnTimed Test You Get +1 for each correct answer and -0.25 for each incorrect answer Time Left - minutes :seconds What will be the output of the program? public class Test { public static void main(String[] args) { int x = 0; assert (x > 0) ? "assertion failed" : "assertion passed" ; System.out.println("finished"); } } finished Compiliation fails. An AssertionError is thrown and finished is output. An AssertionError is thrown with the message "assertion failed." B Compilation Fails. You can't use the Assert statement in a similar way to the ternary operator. Don't confuse. Which of thes...

Test : Java_6

This test contains 10 questions based on Java . Each question answered correctly awards you 1 point and each incorrect answer has a penalty of -0.25 points, no points are deducted for unattempted answers. Select Test Type Timed Test UnTimed Test You Get +1 for each correct answer and -0.25 for each incorrect answer Time Left - minutes :seconds Given the class definitions System.out.print(b.display() + " "); System.out.print(d.display() + " "); System.out.print(bd.display() + " "); System.out.println(); will display: Base Derived Derived Base Base Derived Base Derived Base Derived Derived Derived A Which of the following keywords are used to control access to a class member? (A) default (B) abstract (C) protected (D) interface (E) public (C) & (E) (A), (C) & (E) (B), (C) & (E) All of these C Which operator is us...

Test : Java_5

This test contains 10 questions based on Java . Each question answered correctly awards you 1 point and each incorrect answer has a penalty of -0.25 points, no points are deducted for unattempted answers. Select Test Type Timed Test UnTimed Test You Get +1 for each correct answer and -0.25 for each incorrect answer Time Left - minutes :seconds What is the output of this program? class box { int width; int height; int length; } class mainclass { public static void main(String args[]) { box obj = new box(); obj.widht = 10; obj.height = 2; obj.length = 10; int y = obj.widht * obj.height * obj.length; System.out.print(y); } } 12 200 400 100 B What will be the output of the following code: public class Point extends Shape { static int x, y; public Point() { x = ...

Test : Java_4

This test contains 10 questions based on Java . Each question answered correctly awards you 1 point and each incorrect answer has a penalty of -0.25 points, no points are deducted for unattempted answers. Select Test Type Timed Test UnTimed Test You Get +1 for each correct answer and -0.25 for each incorrect answer Time Left - minutes :seconds Class A      {        public   static   void  main(String a1[])       {         String s1= ?Hello?;         StringBuffer s2=  new  StringBuffer(?Hello?);         s1 = s1 + ?World?;         s2.append(?World?);       }      }   In the above code how many String and StringBuffer objects are created? 1 & 1 2 & 1 2 & 2 1 & 2 B Difference between String and StringBuffer object is immutable and mutable respectively. Code s1+ ?World? will create a new String object ?HelloWorld? with new reference is assigned to s1 and looses ?Hello? String object reference. ...

Test : Java_3

This test contains 10 questions based on Java . Each question answered correctly awards you 1 point and each incorrect answer has a penalty of -0.25 points, no points are deducted for unattempted answers. Select Test Type Timed Test UnTimed Test You Get +1 for each correct answer and -0.25 for each incorrect answer Time Left - minutes :seconds Which of these lines will give an error line 1 :int a=1; line 2 :char c=25; line 3 :double d=2.9; line 1 line 2 line 3 none of these D no error since character can take integer value Following code prints ? int  a= 5 ;   System.out.println(a -= a+ = a -= a += a);   0 5 -5 none of these B It is evaluated as a -= (a += ( a -= (a += 5) )) a -= (a += ( a -= 10 )) The value of a is still 5 a -= (a += -5 ) a -= 0 which is 5 If a class inheriting an abstract class does not define all of its function then it will be know...

Test : Java_2

This test contains 10 questions based on Java . Each question answered correctly awards you 1 point and each incorrect answer has a penalty of -0.25 points, no points are deducted for unattempted answers. Select Test Type Timed Test UnTimed Test You Get +1 for each correct answer and -0.25 for each incorrect answer Time Left - minutes :seconds What is the output of this program? class box { int width; int height; int length; } class mainclass { public static void main(String args[]) { box obj1 = new box(); box obj2 = new box(); obj1.height = 1; obj1.length = 2; obj1.width = 1; obj2 = obj1; System.out.println(obj2.height); } } 1 2 Runtime error Garbage value A What is the output of this program? class A { int i; } class B extends A { ...

Test : Java_1

This test contains 10 questions based on Java . Each question answered correctly awards you 1 point and each incorrect answer has a penalty of -0.25 points, no points are deducted for unattempted answers. Select Test Type Timed Test UnTimed Test You Get +1 for each correct answer and -0.25 for each incorrect answer Time Left - minutes :seconds What was the original name of Java Oak Pok James Coffee A Java was initially named as Oak Who is know as the father of Java Ken Arnold David Holmes James Gosling Peter Dibble C James Arthur Gosling, OC (born May 19, 1955) is a Canadian computer scientist, best known as the father of the Java programming language Java Source Code is compiled into which format .java .class .exe .bytecode B Java Source code in .java format is compiled by the compiler to form .class file ...