Download Java Test Paper 10 30 X 0.5 = 15 Marks Which of these can be

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

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

Document related concepts
no text concepts found
Transcript
Java Test Paper 10
30 X 0.5 = 15 Marks
1. Which of these can be returned by the operator & ?
a) Integer
b) Boolean
c) Character
d) Integer or Boolean?
2. Which keyword is used to create constant variable?
3. Which software is required to only execute java program?
a) Java compiler
b) JRE
c) JDK
d) All
4. Which file is generated when java source code is compiled ?
5. Which exception isrelated with Thread Class?
a) NullPointerException
b) SynchronizeException
c) InterruptedException
d) IOException
6. Which of the following is not true about java.lang package?
a) java.lang package is imported implicitly
b) String class is located inside lang package
c) Exception class is located inside lang package
d) Scanner class is located inside lang package
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 interface contains no methods?
a) Runnable
b) Set
c) Collection
d)Serializable
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 maintains insertion order and eliminate duplicate?
a) ArrayList
b) LinkedHashSet
c) TreeSet
d) Vector
11. Which of the following string method returns the value of char type?
a) toCharArray()
b) indexOf()
c) substring()
d) charAt()
12. What is the output of the following code
class Test{
public static void main(String[] args){
String s1 = new String(“java”);
String s2 = new String(“java”);
System.out.println(s1==s2);
Visit us : [email protected] www.chromatech.in
}
13.
14.
15.
16.
17.
18.
19.
20.
}
a) True
b) Runtime Error
c) False
d) Compilation Error
What is the output of the following
class Test{
public static void main(String[] args){
int i;
System.out.println(i);
}
}
a) 0
b) 1
c) Compilation error
d) Runtime Error
What is the output of the following
interface A { public void print();}
interface B extends A{}
publicclassTestimplements B{
}
a) Compilation Error
b) Runtime Error
c) No Error
d) Exception
What is the output of the following
class Test extends Thread{
public void run(){ System.out.print(“10”); }
public static void main(String[] args){
new Test().start();
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
Which of the following is used to track user details
a) session
b) hidden field c) session
d) all
Which of these tag is used to write java code in JSP ?
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
How many sub tags are inside servlet tage in xml file?
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
Visit us : [email protected] www.chromatech.in
21. How many jdbc drivers are available ?
22. Which of the method returns object of ResultSet
a) executeQuery()
b) Only A
c) BothA & D
d) executeUpdate()
23. Which of the following has getConnection() method?
a) Connection
b) Statement c) ResultSet
d) DriverManager
24. Which of the following package contains Connection interface
a) java.query b) java.lang
c) java.db
d) java.sql
25. What does MVC stands for ?
a) Model View Connector
b) Model View Controller
c) Module View Controller
d) Module View Connector
26. What does IoC stands for
a) Internal Object Container
b) Inversion of Control
c) Implicit Object Code
d) none of these
27. Which of the following is the bean scope?
a) request
b) Singleton
c) prototype
d) all of these
28. Hibernateis
a) Framework for Database
b) MVC
c) software
d) none
29. Which of the following is used as controller in Spring?
a) DipatcherServlet
b) JSP
c) Java Bean
d) All
15X 2 = 30 Marks
30. Write a Java Program to count the number character and numbers in the given String
Output
------------Enter your String : abcd123
No of Characters: 4
No of Numbers : 3
31. Create a java program to add 5 String objects into ArrayList and sort in ascending order
Visit us : [email protected] www.chromatech.in