Download Java Test Paper 9 30 X 1 = 30 Marks Which exactly helps java to be

Survey
yes no Was this document useful for you?
   Thank you for your participation!

* Your assessment is very important for improving the work of artificial intelligence, which forms the content of this project

Document related concepts
no text concepts found
Transcript
Java Test Paper 9
30 X 1 = 30 Marks
1. Which exactly helps java to be platform independent?
2. Which of the following keyword is related with float variable?
a) const
b) strictfp
c) transient
d) native
3. Which software is required to only execute java program?
4. Which of the following converts the byte code to machine code ?
a) Java Compiler
b) JVM
c) JDK
d) JRE
5. Which exception is generated by Scanner class’s methods?
a) ArithmeticException
b) InputMismatchException
c) NumberFormatException
d) IOException
6. Which of the following is not true about java packages?
a) java packages are used to avoid naming collisions
b) java package can have sub packages
c) packages are just like folders
d) package cannot have interface
7. Which of the following is true about abstract class ?
a) abstract class must have at least one abstract method
b) object cannot be instantiated for abstract class
c) abstract class cannot have more than one sub class
d) none of these
8. Which of the following keyword is used to restrict a class not to have any subclass?
a) finally
b) final
c) throw
d) throws
9. Which of the following is true about Interface?
a) Interface has non abstract methods
b) interface can have instance variable
c) interface’s variable cannot be modified
d) interface variables are private by default
10. Which of these Collection class is synchronized?
a) ArrayList
b) LinkedHashSet
c) TreeSet
d) Vector
11. Which of the following is the correct setter and getter method of age property?
a) public voidsetAge(){} & public void getAge(){}
b) publicintsetAge(int age){} & public void getAge(){}
c) public void setAge(intage){} & public void getAge(){}
d) public void setAge(intage){} & public intgetAge(){}
12. What is the output of the following code
class Test{
public static void main(String[] args){
Visit us : [email protected] www.chromatech.in
new Test().printMessage();
}
public static void printMessage(){ System.out.println(“Message”);}
13.
14.
15.
16.
17.
18.
19.
}
a) No Output b) Runtime Error
c) Message
d) Compilation Error
What is the output of the following
class Test{
public static void main(String[] args){
int i = 1;
while( i <= 10 ){ i++; }
System.out.println(i);
}
}
a) 1 to 11
b) 10
c) Compilation error
d) 11
What is the output of the following
interface A { public void print();}
interface B extends A{}
public abstractclassTestimplements B{
}
a) Compilation Error
b) Runtime Error
c) No Error
d) Exception
What is the output of the following
class Testimplements Runnable{
public void run(){System.out.print(“10”); }
public static void main(String[] args){
new Thread(new Test()).start();
new Thread(new Test()).start();
}
}
a) 10
b) 1010
c) Runtime Error
d) Compilation Error
Jsp is converted into ?
a) applet
b) servlet
c) both A & B
d) none
session is an implicit object
a) True
b) False
Which of these tag is used to declare variable globally inJSP ?
a) <% %>
b) <%! %>
c) <%= %>
d) <%@ %>
Which of these is an implicit object has setAttribute() method ?
a) request
b) response
c) session
d) Only A & B e) Only A & C
Visit us : [email protected] www.chromatech.in
20. Which method is used to read the init parameter from xml file?
a) getParameter()
b) getInitParam()
c) getInitParameter()
d) getInitParameters()
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. How many jdbc drivers are available ?
23. Which of the method is used to execute insert querystatement ?
a) executeQuery()
b) Only A
c) BothA & D
d) executeUpdate()
24. Which of the following has getConnection() method?
a) Connection
b) Statement c) ResultSet
d)DriverManager
25. Which of the following isnot available insidejava.sql package
a) DriverManager
b) Statement
c) ResultSet
d) Connector
26. What does MVC stands for ?
a) Model View Connector
b) Model View Controller
c) Module View Controller
d) Module View Connector
27. What does IoC stands for
a) Internal Object Container
b) Inversion of Control
c) Implicit Object Code
d) none of these
28. Which of the following is the bean scopereturns same object for every getBean() ?
a) request
b) Singleton
c) prototype
d) all of these
29. Hibernateis
a) Framework for Database
b) MVC
c) software
d) none
30. Which of the following is three tier Architecture design pattern
a) MVC
b) Spring
c) Hibernate
d) none
15 X 2 = 30 Marks
31. Write a Java Program to count the number of vowels in the given String
32. Create a java program to add 5 Employee details to HashMap and print it using Iterator
Visit us : [email protected] www.chromatech.in