Survey
* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
Java Test Paper 6 30 X 0.5 = 15 Marks 1. How many bytes are allocated for char type in java? 2. Which of the following keyword is not the keyword of Java ? a) for b) String c) goto d) strictfp 3. What is the use of JRE? a) hardare which gives Java Runtime Environment b) Software which gives Java Runtime Environment c) Software which compiles the Java Code d) Hardware which converts the java source code 4. What is the default value of boolean variable in java ? 5. Which package contains NumberFormatExceptionClass? 6. Which of the following is used to call the super class constructor? a) super b) parent c) inherit d) this 7. What is method overriding ? a) recreating the same method in sub class which already exists in the parent class b) recreating the same method with different parameter in sub class c) giving the same name to any one of the method of super class d) none of these 8. Which of the following statement is nottrue about Exception Handling? a) Exception is the super class of all the exceptions b) CheckedException is the super class of IOException c) RuntimeException is the immediate sub class of Exception d)Exception class is located inside java.lang package 9. Which of the following is used to implement multithreading? a) Runnable Interface b) Thread Class c) Both A & B d) none of these 10. Which of these Collection class is synchronized ? a) ArrayList b) LinkedHashSet c) TreeSet d) Vector 11. Which of the following is not the right syntax of main method ? a) public static void main(String[] args){} b) static public void main(String[] params){} c) public static void main(String num[]){} d) none of these 12. What is the output of the following code class Test{ public static void main(String[] args){ System.out.println((int)Test.printMessage()); } Visit us : [email protected] www.chromatech.in 13. 14. 15. 16. 17. 18. 19. staticvoidprintMessage(){ return ‘a’;} } a) a b) Runtime Error c) 97 d) Compilation Error What is the output of the following class Test{ public static void main(String[] args){ inti, j = 0; for(j=1; j<=10; j++) if( j % 2 == 0) continue; else System.out.print(j+” “); } } a) 1 3 5 7 9 b) 2 4 6 8 10 c) Runtime error d) compilation error What is the output of the following abstract classA { public void print();} publicclass Bextends A{ public void print () { } } a) Compilation Error b) Runtime Error c) No Error d) Exception What is the output of the following class Testimplements Runnable{ public static void main(String[] args){ new Test().start(); } } a) No Output b) Thread Started c) Runtime Error d) Compilation Error HttpServletRequest and HttpServletResponse is the parameter of which method? a) doGet b) doPost c) doPut d) All of these HttpServletResponse&HttpServletRequest objects are created implicitly a) True b) False Which of these tag is used to import pages in JSP ? a) <% %> b) <%! %> c) <%= %> d) <%@ %> Which of these is an implicit object ? a) request b) response c) session d) Only A & B e) All Visit us : [email protected] www.chromatech.in 20. Init parameter should be configure in ? a) method b) java file c) xml d) all of these 21. Which of the following is the correct driver for connection with MySql a) com.jdbc.mysql.driver b)com.mysql.jdbc.Driver c)com.java.mysql.Driver d)com.connect.mysql.Driver 22. Which class has getConnection() method ? a) Connection b) Connector c) Statement d) DriverManager 23. Which of the method is used to execute DML statement ? a) executeQuery() b) update() c) execute() d) executeUpdate() 24. Which of the following is the PreparedStatement’sMethod? a) next() b) getString c) setInt d)B & C 25. Which of the following is available insidejava.sql package a) DriverManager b) Statement c) ResultSet d) Alll of the above 26. What does MVC stands for ? a) Model View Connector b) Model View Controller c) Module View Controller d) Module View Connector 27. Spring uses xml file for ______________ a) bean configuration b) class configuration c) Both A & B d) none of these 28. Which of the following is the bean scope of spring ? a) request b) Singleton c) prototype d) all 29. FileSystemResource isused in a) BeanFactory b) ApplicationContext c) Context d) All of these 30. Which of the following is Three tier Architecture a) MVC b) Spring c) Hibernate d) JQuery 15 X 2 = 30 Marks 31. Write a Java Program to copy an array to another array? 32. Create an ArrayList object and add five employee names and sort it in ascending order Visit us : [email protected] www.chromatech.in