Explore topic-wise MCQs in Java Spring Framework.

This section includes 59 Mcqs, each offering curated multiple-choice questions to sharpen your Java Spring Framework knowledge and support exam preparation. Choose a topic below to get started.

1.

By default, Grails applies a global layout to display an application’s content.

A. True
B. False
C. May be
D. Can't say
Answer» B. False
2.

Grails doesn’t supports the concept of templates.

A. True
B. False
C. May be
D. Can't say
Answer» C. May be
3.

A location where logging information is generated.

A. appender
B. logger
C. all of the mentioned
D. none of the mentioned
Answer» C. all of the mentioned
4.

To offer versatile logging functionality:-

A. loggers
B. appenders
C. all of the mentioned
D. none of the mentioned
Answer» D. none of the mentioned
5.

The default Log4J logger can be customized in a Grails application.

A. True
B. False
C. May be
D. Can't say
Answer» B. False
6.

A view’s body content is inside the:-

A. g:javascript library=”application”
B. g:layoutHead
C. g:layoutBody
D. g:layoutMeta
Answer» D. g:layoutMeta
7.

AbstractJUnit38SpringContext class also implements the ApplicationContextAware interface.

A. True
B. False
C. May be
D. Can't say
Answer» C. May be
8.

Where can you find series of *.properties files.

A. /grails-app/
B. /grails-app/i18n/
C. /grails-app/i18n/WEB-INF
D. /grails-app/i18n/WEB-APP
Answer» C. /grails-app/i18n/WEB-INF
9.

HSQLDB is a non-volatile database.

A. True
B. False
C. May be
D. Can't say
Answer» C. May be
10.

Grails uses RDBMS as a permanent storage system.

A. True
B. False
C. May be
D. Can't say
Answer» B. False
11.

Grails applications are equipped to support internationalization.

A. True
B. False
C. May be
D. Can't say
Answer» B. False
12.

Declaration name which indicates that object’s name field can’t be blank.

A. blank:false
B. blank:true
C. all of the mentioned
D. none of the mentioned
Answer» B. blank:true
13.

This encapsulates the context of a test’s execution:-

A. Test context
B. Test context manager
C. Test context listener
D. Test execution listener
Answer» B. Test context manager
14.

To run the script:-

A. roo.sh script –file ~/Desktop/myapp.roo
B. roo.sh –file ~/Desktop/myapp.roo
C. all of the mentioned
D. none of the mentioned
Answer» B. roo.sh –file ~/Desktop/myapp.roo
15.

Unlike in a web application, you can’t control URLs directly in a portlet.

A. True
B. False
C. May be
D. Can't say
Answer» B. False
16.

Test fixtures injected from the managed application context by annotating:-

A. @Autowired
B. @Resource
C. All of the mentioned
D. None of the mentioned
Answer» D. None of the mentioned
17.

Tag is used to define the contents of a layout’s head section.

A. g:layoutTitle
B. g:layoutHead
C. g:layoutBody
D. g:layoutMeta
Answer» C. g:layoutBody
18.

Grails is capable of inspecting an application’s domain classes and generating the corresponding controllers and views.

A. True
B. False
C. May be
D. Can't say
Answer» B. False
19.

An object that simulates a dependent object:-

A. stub
B. mock
C. test
D. none of the mentioned
Answer» B. mock
20.

Grails comes preconfigured to use:-

A. MySql
B. PostgreSQL
C. Access
D. HSQLDB
Answer» E.
21.

A variety of constraints can be used to enforce a domain class’s structure.

A. True
B. False
C. May be
D. Can't say
Answer» B. False
22.

You can chain multiple handler mapping annotations as required to portlet.

A. True
B. False
C. May be
D. Can't say
Answer» B. False
23.

Classes used to describe an application’s primary elements.

A. Domain Classes
B. Application
C. Context
D. View
Answer» B. Application
24.

Where is subdirectory called layouts located, containing the layouts available to an application?

A. /grails-app/view/
B. /grails-app/
C. /grails-app/view/WEB-INF
D. none of the mentioned
Answer» B. /grails-app/
25.

This class implements the ApplicationContextAware interface, so you can get access to the managed application context:-

A. AbstractJUnit38SpringContext
B. AbstractJUnit38Spring
C. AbstractJUnit38SpringContextTests
D. None of the mentioned
Answer» D. None of the mentioned
26.

An Object which usually knows how its methods are expected to be called:-

A. stub
B. mock
C. test
D. none of the mentioned
Answer» C. test
27.

Maven Directory to hold the non–unit-test Java files for your application.

A. src/main/java
B. src/main/resources
C. src/main/webapp
D. src/test/java
Answer» B. src/main/resources
28.

DataSource properties, Class name for the JDBC driver.

A. driverClassName
B. dataSource properties
C. all of the mentioned
D. none of the mentioned
Answer» B. dataSource properties
29.

Tag can also be used in GSP pages views.

A. g:message
B. g:string
C. g:msg
D. none of the mentioned
Answer» B. g:string
30.

*.properties files allow Grails applications to display messages.

A. True
B. False
C. May be
D. Can't say
Answer» B. False
31.

Attribute which specifies the exception type:-

A. after
B. expected
C. before
D. test
Answer» C. before
32.

Tag is used to define the contents of a layout’s title section.

A. g:layoutTitle
B. g:layoutHead
C. g:layoutBody
D. g:layoutMeta
Answer» B. g:layoutHead
33.

portlet deployment descriptor file is:-

A. portlet.xml
B. portlet.config
C. portlet.xhtml
D. none of the mentioned
Answer» B. portlet.config
34.

Indicates whether to enable SQL logging.

A. driverClassName
B. dataSource properties
C. logSql
D. none of the mentioned
Answer» D. none of the mentioned
35.

A location where logging information is sent.

A. appender
B. logger
C. all of the mentioned
D. none of the mentioned
Answer» B. logger
36.

Configure Grails to use another RDBMS by modifying:-

A. Data.groovy
B. DataSource.groovy
C. All of the mentioned
D. None of the mentioned
Answer» D. None of the mentioned
37.

Test data sets are provided by data providers, which are methods with the:-

A. @DataProvider
B. @Autowire
C. @JTest
D. None of the mentioned
Answer» B. @Autowire
38.

JSP Tag which declares statements using the Groovy.

A. g:message
B. g:string
C. g:msg
D. none of the mentioned
Answer» B. g:string
39.

Command to generate the corresponding CRUD controller and views for an application’s domain class.

A. grails create-domain-class domain class name
B. grails create-domain-class
C. grails generate-all domain class name
D. none of the mentioned
Answer» D. none of the mentioned
40.

An appender that logs to a JDBC connection.

A. jdbc
B. console
C. file
D. rollingFile
Answer» B. console
41.

Maven Directory which holds classpath resources that aren’t Java class files.

A. src/main/java
B. src/main/resources
C. src/main/webapp
D. src/test/java
Answer» C. src/main/webapp
42.

persistence setup –database HYPERSONIC_IN_MEMORY –provider HIBERNATE command creates files:-

A. src/main/resources/META-INF/persistence.xml
B. src/main/resources/META-INF/spring/database.properties
C. all of the mentioned
D. none of the mentioned
Answer» D. none of the mentioned
43.

Views corresponding to a controller class’s CRUD operations.

A. create.gsp
B. edit.gsp
C. list.gsp
D. all of the mentioned
Answer» E.
44.

Spring Roo file extension is:-

A. .xml
B. .xhtml
C. .roo
D. .groovy
Answer» D. .groovy
45.

Spring Roo’s root folder (or any of the source packages) is:-

A. src/main/java, src/main/resources
B. src/test/java
C. src/test/resources
D. all of the mentioned
Answer» E.
46.

Maven Directory which is used to hold the rest of a web application’s structure.

A. src/main/java
B. src/main/resources
C. src/main/webapp
D. src/test/java
Answer» D. src/test/java
47.

If you want to coerce users into using a specific language locale.

A. /grails-app/conf/spring/resource.groovy file
B. /grails-app/resource.groovy file
C. /grails-app/spring/resource.groovy file
D. none of the mentioned
Answer» B. /grails-app/resource.groovy file
48.

Command to create a Spring MVC controller that provides a UI:-

A. controller scaff –class ~.web.CustomerController –entity ~.domain.Customer
B. controller scaff –class ~.web.CustomerController –entity
C. none of the mentioned
D. all of the mentioned
Answer» B. controller scaff –class ~.web.CustomerController –entity
49.

Spring JUnit 3 legacy support in releases prior to 2.5, your test class can extend the:-

A. AbstractDependencyInjectionSpringContextTests
B. AbstractSingleSpringContextTests
C. All of the mentioned
D. None of the mentioned
Answer» B. AbstractSingleSpringContextTests
50.

Servlet Listener to load the root application context at startup.

A. ContextLoader
B. ContextLoaderListener
C. All of the mentioned
D. None of the mentioned
Answer» C. All of the mentioned