Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                

Java-Springboot Test Paper

Download as doc, pdf, or txt
Download as doc, pdf, or txt
You are on page 1of 4

Java-SpringBoot Post Test Paper

Duration : 30 Mins.
FOR OFFICE USE ONLY
Total Marks : 25 Marks

Name : _______________________________ Checked by ……………………………………

General Instructions:
Date ……………………………………
1) All questions are compulsory
2) Each question carries equal marks Marks Obtained
3) No negative marking system

1. Which of these interface must contain a unique element?


a. Set
b. List
c. Array
d. Collection
Ans: A
2. Thread priority in Java is?
a. Integer
b. Float
c. double
d. long
Ans: A
3. Which of the following is not OOPS concept in Java?
a. Inheritance
b. Encapsulation
c. Polymorphism
d. Compilation
Ans: D
4. When does method overloading is determined?
a. At run time
b. At compile time
c. At coding time  
d. At execution time
Ans: B
5. What is true about constructor?
a. It can contain return type
b. It can take any number of parameters
c. It can not be overloaded
d. Constructor cannot throw an exception
Ans: B
6. Which of the following keywords is used for throwing exception manually?
a. finally
b. try
c. throw
d. catch
Ans: C
7. Which of the following is a super class of all exception type classes?
a. Catchable
b. RuntimeExceptions
c. String
d. Throwable
Ans: D
8. Which of the following keyword is used by called function to declare exceptions it may throw?
a. throws
b. throw
c. try
d. catch
Ans : A
9. Which is the new method introduced in java 8 to iterate over a collection?
a. for (String i : StringList)
b. foreach (String i : StringList)
c. StringList.forEach()
d. List.for()
10. What is the return type Of executeQuery() method ?
a. String
b. RowSet
c. void
d. ResultSet
Ans: D
11. What would be the behaviour if this() and super() used in a method?
a. Runtime error
b. Throws exception
c. compile time error
d. Runs successfully
Ans:C
12. What is false about constructor?
a. Constructors cannot be synchronized in Java
b. Java does not provide default copy constructor
c. this and super can be used in a constructor
d. None of the above.
Ans: D
13. Which of these are marker interface?
a. Runnable
b. Serializable
c. Comparable
d. Comparator
Ans: B
14. If you want to work Spring MVC application "spring–boot–starter–web" should be included in
pom.xml. State True or False.
a. true
b. false
Ans:
15. @Repository – indicates that the class defines a data repository; its job is to catch platform-
specific exceptions and re-throw them as one of Spring’s unified unchecked exceptions
a. true
b. false
Ans: A
16. Spring Beans are by default singleton in nature. State True or False
a. true
b. false
Ans: A
17. @Controller – indicates that the class serves the role of a controller, and detects
@RequestMapping annotations within the class
a. true
b. false
Ans: B
18. In spring boot ____________ xml file is used to simplify your Maven configuration.
a. web.xml
b. pom.xml
c. mypom.xml
d. springconfig.xml
Ans: B
19. Using __________ tool spring boot, provides production-ready features such as metrics, health
checks and externalized configuration.
a. actuator
b. logging
c. securing
d. None of the above
Ans: A
20. Remove odd approach used for creating spring boot project.
a. Spring Maven Project
b. Spring Starter Project Wizard
c. Spring Dynamic application development
d. Spring Boot CLI
Ans: D
21. @RestController is often used for APIs that serve JSON, XML, Your controller methods will
return an object that will be serialized to one or more of these formats.State True or False
a. True
b. False
Ans: B
22. which property in spring boot is used to reset tomcat port number?
a. server.port
b. server.port.number
c. server.port.value
d. server.port.setValue
Ans: A
23. Which scope is used to create stateful spring beans?
a. singleton
b. prototype
c. request
d. session
Ans: B
24. ___________ is the configuration file used in Spring boot projects.
a. application.properties
b. server.properties
c. spring.xml
d. applicationContext.xml
Ans: C
25. @SpringBootApplication is equivalent to @Configuration @EnableAutoConfiguration
@ComponentScan
a. True
b. False
Ans: B

You might also like