![]() |
About  | Contact  | Site Map  |  Mirror    |
Voodoo Exam  |  Question Bank  |  Databases  |  Tutorials    |
|
    |
Question Bank 3 We have moved to a new website(www.irixtech.com) where you can now take mock exams online, come back & review your answers later, ask questions in our forums & SCJP questions ranging from SCJP 1.4 to SCJP 6.0, including these question banks & dumps from this site. Click here to be taken to our new website. Comments & suggestions will be highly appreciated . If you'd like to see your question's here mail me . 1. Will the following code compile ? If yes choose the most correct two options . class Q011{ public static void main(String args[]){ char a = 'a' + 2; System.out.println(a); int i = 2; char c = 'a' + i;//---1 System.out.println(c);//---2 } }; Options :
2. What is the output ? FYI ( int ) ' A ' = 65 class Q1{ public static void main(String args[]){ byte b = 65; switch (b) { case 'A': System.out.println("A"); break; case 65: System.out.println("65"); break; default: System.out.println("default"); } } }; Options :
3. Will the output from the following two code snippets be any different ? Snippet 1 : for ( int i = 0 ; i < 5 ; i++ ) { System.out.println(i); } Snippet 2 : for ( int i = 0 ; i < 5 ; ++i ) { System.out.println(i); } Options :
4. What is the output of the following code ? FYI 1 divided by 2 = 0.5 class Q009{ public static void main(String args[]){ float f = 1/2; System.out.println(f); } }; Options :
5. What is the output for the following code ? class Torment{ int i = 2; public static void main(String args[]){ int i = 12; System.out.println(i); } }; Options :
6. What is the output ? class FearFactory{ static{ System.out.println("Genesis"); } FearFactory(){ System.out.println("Birth"); } public static void main(String args[]){ //I'm Lazy } }; Options :
7. Consider the following class . Which of the marked lines need to be commented out for the class to compile correctly ? class Evolve{ static int i = 1; static int j = 2; int x = 3; static int y = 6; public static void main(String args[]){ System.out.println(i + j);//---1 System.out.println(x + i);//---2 System.out.println(i + y);//---3 System.out.println(x + j);//---4 } }; Options :
8. What is the compiler error generated ( if any ) by the following piece of code . class Jelly{ public static void main(String args[]){ float f = 1./2; System.out.println(f); } }; Options :
9. Will the following class compile ? If yes what is the output ? class Envy{ static int i; Envy(){ ++i; } public static void main(String args[]){ System.out.println(i); } }; Options :
10. Choose all the valid declarations for the main method from the list below ( any three ) a. public void main(String args[]) b. public static int main(String args[]) c. public static void main(String [] ka) d. public static void main(String [] args) e. public static void main(String ka []) Answer :
|
© 2000-2002 Ashish Hareet |