This set of Java Spring Multiple Choice Questions & Answers (MCQs) focuses on “Application’s Domain Classes”.
1. Classes used to describe an application’s primary elements.
a) Domain Classes
b) Application
c) Context
d) View
View Answer
Explanation: Domain classes are used to describe an application’s primary elements and characteristics.
2. In web applications, domain classes are generally the first things to be defined.
a) True
b) False
View Answer
Explanation: Domain classes represent data that is saved for posterity—in a permanent storage system—so it interacts with controllers, as well as representing data displayed in views.
3. In Grails, domain classes are placed under:-
a) /grails-app/WEB-INF/
b) /grails-app/domain/
c) /grails-app/domain/WEB-APP
d) /grails-app/
View Answer
Explanation: In Grails, domain classes are placed under the /grails-app/domain/ directory.
4. The creation of domain classes by executing a simple command which is:-
a) grails create-domain-class
b) grails create-domain-class domain class name
c) domain class name
d) none of the mentioned
View Answer
Explanation: The creation of domain classes, like most other things in Grails, can be carried out by executing a simple command in the following form:
grails create-domain-class domain class name
5. The command domain class name in creation of domain classes generates a file named domain class name.groovy.
a) True
b) False
View Answer
Explanation: It generates a skeleton domain class file named domain class name.groovy inside the /grails-app/domain/ directory.
6. Corresponding unit tests files are also generated for each domain class while creating domain classes.
a) True
b) False
View Answer
Explanation: In addition, corresponding unit tests files are also generated for each domain class under an application’s test/unit directory.
7. Static field which defines constraints on the domain class.
a) static{}
b) static field{}
c) static constraint{}
d) static constraints{}
View Answer
Explanation: static constraints = { }, defines constraints on the domain class.
8. 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
View Answer
Explanation: The declaration name(blank:false) indicates that a Player object’s name field cannot be left blank.
9. A variety of constraints can be used to enforce a domain class’s structure.
a) True
b) False
View Answer
Explanation: Under certain circumstances, if a constraint is too elaborate, it’s often incorporated within an application’s controller prior to creating an object of a certain domain class.
10. 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
View Answer
Explanation: You can execute the following command to generate the corresponding CRUD controller and views for an application’s domain class:
grails generate-all domain class name.
11. Grails is capable of inspecting an application’s domain classes and generating the corresponding controllers and views.
a) True
b) False
View Answer
Explanation: Grails is capable of inspecting an application’s domain classes and generating the corresponding controllers and views necessary to create, read, update, and delete instances belonging to an application’s domain classes.
12. Views corresponding to a controller class’s CRUD operations.
a) create.gsp
b) edit.gsp
c) list.gsp
d) all of the mentioned
View Answer
Explanation: Four views are created corresponding to a controller class’s CRUD operations named create.gsp, edit.gsp, list.gsp, and show.gsp.
13. .gsp extension stands for:-
a) Groovy Server Pages
b) Groovy Service Pages
c) All of the mentioned
d) None of the mentioned
View Answer
Explanation: .gsp extension stands for “Groovy Server Pages,” which is equivalent to JavaServer Pages except it uses Groovy to declare programmatic statements instead of Java.
14. Views are placed under which directory:-
a) app/views/
b) app/
c) grails-app/views/WEB-INF
d) grails-app/views/domain class
View Answer
Explanation: These views are placed under an application’s grails-app/views/domain class directory.
15. Command to start the Grails application:-
a) grails run
b) grails start-app
c) grails run-app
d) none of the mentioned
View Answer
Explanation: You can start the Grails application using grails run-app and work as an end user with the application.
Sanfoundry Global Education & Learning Series – Java Spring.
To practice all areas of Java Spring, here is complete set of 1000+ Multiple Choice Questions and Answers.
- Get Free Certificate of Merit in Spring
- Participate in Spring Certification Contest
- Become a Top Ranker in Spring
- Take Spring Tests
- Chapterwise Practice Tests: Chapter 1, 2, 3, 4, 5, 6, 7, 8, 9, 10
- Chapterwise Mock Tests: Chapter 1, 2, 3, 4, 5, 6, 7, 8, 9, 10
- Apply for Programming Internship
- Practice Programming MCQs
- Buy Spring Books
- Buy Information Technology Books
- Apply for Spring Internship