Java MCQ Set 1
1. IntelliJ’s IDEA product, versions 8 and 9, supports:-
a) Flex
b) AIR
c) None of the mentioned
d) All of the mentioned
Answer
Answer: d [Reason:] Particularly, IntelliJ’s IDEA product, versions 8 and 9, support Flex and AIR development with aplomb.
2. Flex is that it is, technically, a library implemented on top of the middleware.
a) True
b) False
Answer
Answer: b [Reason:] Flex is, technically, a library implemented on top of the Flash virtual machine.
3. In Flash, the displayed area where animation and rendering occurs.
a) Stage
b) Animation
c) Stagery
d) State
Answer
Answer: a [Reason:] In Flash, the displayed area where animation and rendering occurs is called the stage.
4. Flex uses a language called ActionScript 3.0.
a) True
b) False
Answer
Answer: b [Reason:] Flash uses a language called ActionScript 3.0.
5. ActionScript code pages end in .as, and ActionScript binaries are .sf files.
a) True
b) False
Answer
Answer: b [Reason:] ActionScript code pages end in .as, and ActionScript binaries are .swf files.
6. Linkable libraries have the extension.
a) .swc
b) .dll
c) .so
d) none of the mentioned
Answer
Answer: a [Reason:] You can use ActionScript tools to build linkable libraries, much like a .dll on Windows, or a .so on Linux. These linkable libraries have the extension .swc.
7. The source artifacts of a Flex application are:-
a) ActionScript files (ending in .as)
b) ActionScript files (ending in .mxml)
c) All of the mentioned
d) None of the mentioned
Answer
Answer: c [Reason:] The two source artifacts of a Flex application are the ActionScript files (ending in .as) and the .mxml files.
8. XML variant that describe the UI components and provide a DOM.
a) AS files
b) MXML files
c) XML Files
d) All of the mentioned
Answer
Answer: b [Reason:] MXML files are an XML variant that describe the UI components and provide a DOM.
9. MXML files support a limited form of expression language binding
a) True
b) False
Answer
Answer: a [Reason:] Limited when compared to the EL support in frameworks like Tapestry or JSF, anyway.
10. Outermost tag in Flex.
a) mx:Application
b) mx:WindowedApplication
c) all of the mentioned
d) none of the mentioned
Answer
Answer: a [Reason:] In the case of Flex applications, the outermost tag is the mx:Application tag.
11. Outermost tag in AIR.
a) mx:Application
b) mx:WindowedApplication
c) all of the mentioned
d) none of the mentioned
Answer
Answer: b [Reason:] In the case of AIR applications, the outermost tag is the mx:WindowedApplication tag.
12. As soon as the application has been loaded and all the objects configured, an event will be fired.
a) applicationEvent
b) applicationComplete
c) eventConfigure
d) eventComplete
Answer
Answer: b [Reason:] Just as you can in the browser, you have two choices for listening to events in Flex: programmatic registration and through MXML attributes on the component that fires the event.
13. JavaScript library dynamically adds the plug-in content to the page.
a) True
b) False
Answer
Answer: a [Reason:] Because of this property, it triggered the “Dynamic Content” warning in Internet Explorer 6 for a few years.
14. JavaScript library dynamically generates.
a) object
b) plugin
c) FlashVars
d) all of the mentioned
Answer
Answer: d [Reason:] The library dynamically generates the relevant object and plugin tags, along with the FlashVars parameters.
15.To talk to the containing HTML page.
a) flash.external.ExternalInterface
b) flash.external.External
c) flash.external.ExternalInterface
d) none of the mentioned
Answer
Answer: a [Reason:] To talk to the containing HTML page, you can use the flash.external.ExternalInterface class. This class defines two static methods, call() (which lets the Flex application talk to the host) and addCallback() (which lets the host talk to Flex).
Java MCQ Set 2
1. Grails is a self-contained framework that comes with various scripts to automate the creation of Java applications.
a) True
b) False
Answer
Answer: a [Reason:] In this sense, you simply need to unpack the distribution and perform a few installation steps in order to create Java applications on your workstation.
2. To invoke Grails operations from anywhere on your workstation.
a) GRAILS HOME
b) PATH
c) All of the mentioned
d) None of the mentioned
Answer
Answer: c [Reason:] After you unpack Grails on your workstation, define two environment variables on your operating system: GRAILS HOME and PATH.This allows you to invoke Grails operations from anywhere on your workstation.
3. To see Grails’s numerous commands.
a) grails help
b) grails -help
c) grails -h
d) help grails
Answer
Answer: a [Reason:] If you execute the command grails help from any directory on your workstation, you should see Grails’s numerous commands.
4. To create a Grails application, command:-
a) grails create-app
b) grails create-app grailsappname
c) grails create-app default
d) none of the mentioned
Answer
Answer: b [Reason:] To create a Grails application, invoke the following command wherever you wish to create an application: grails create-app grailsappname.
5. Working directories and files are placed under which directory.
a) User’s home directory under the name.grails/grails version/.
b) WEB-APP
c) WEB-INF
d) None of the mentioned
Answer
Answer: a [Reason:] Grails also creates a series of working directories and files (i.e., not intended to be modified directly) for an application. These working directories and files are placed under a user’s home directory under the name.grails/grails version/.
6. Grails generates a series of files and directories which includes.
a) Apache Ant file(build.xml)
b) Apache Ivy file(ivy.xml)
c) All of the mentioned
d) None of the mentioned
Answer
Answer: c [Reason:] Grails generates a series of files and directories that are common in most Java applications. This includes, an Apache Ant file (build.xml) and an Apache Ivy file (ivy.xml), as well as common directories like src for placing source code files and a web-app.
7. Used to define an application’s properties.
a) application.properties
b) build.xml
c) manifest.xml
d) court.iml
Answer
Answer: a [Reason:] Used to define an application’s properties, including the Grails version, servlet version, and an application’s name.
8. An Apache Ant script with a series of predefined tasks designed to create a Grails application.
a) application.properties
b) build.xml
c) manifest.xml
d) court.iml
Answer
Answer: b [Reason:] An Apache Ant script with a series of predefined tasks designed to create a Grails application.
9. An XML file containing configuration parameters for an application.
a) application.properties
b) build.xml
c) manifest.xml
d) court.iml
Answer
Answer: d [Reason:] An XML file containing configuration parameters for an application, such as directory locations and treatment of JARs.
10. An XML file containing configuration parameters for an application’s deployment.
a) application.properties
b) build.xml
c) court.iws
d) court.iml
Answer
Answer: c [Reason:] An XML file containing configuration parameters for an application’s deployment, such as web container port and project views.
11. An XML file containing configuration parameters for an application’s launch.
a) application.properties
b) build.xml
c) court.iws
d) court.launch
Answer
Answer: d [Reason:] An XML file containing configuration parameters for an application’s launch, such as JVM arguments.
12. An Apache Ivy configuration file used for defining repositories.
a) application.properties
b) ivysettings.xml
c) court.iws
d) court.launch
Answer
Answer: b [Reason:] An Apache Ivy configuration file used for defining repositories in order to download dependencies.
13. A directory containing the core of an application.
a) application.properties
b) ivysettings.xml
c) court.iws
d) grails-app
Answer
Answer: d [Reason:] A directory containing the core of an application, which further
contains the following folders:
1. conf: A directory containing an application’s configuration sources
2. controllers: A directory containing an application’s controllers files
3. domain: A directory containing an application’s domain files
4. i18n: A directory containing an application’s internationalization (i18n) files
5. services: A directory containing an application’s service files
6. taglib: A directory containing an application’s tag libraries
7. utils: A directory containing an application’s utility files
8. views: A directory containing an application’s view files
14. An XML file containing configuration parameters for an application.
a) application.properties
b) ivysettings.xml
c) court.iml
d) court.launch
Answer
Answer: c [Reason:] An XML file containing configuration parameters for an application, such as directory locations and treatment of JARs.
15. Some of the more popular Grails plug-ins follow:
a) App Engine
b) Quartz
c) Spring WS
d) All of the mentioned
Answer
Answer: d [Reason:]
• App Engine: Integrates Google’s App Engine SDK and tools with Grails.
• Quartz: Integrates the Quartz Enterprise Job Scheduler to schedule jobs and have
them executed using a specified interval or cron expression
• Spring WS: Integrates and supports the provisioning of web services, based on the
Spring Web Services project
• Clojure: Integrates Clojure and allows Clojure code to be executed in Grails
artifacts
Java MCQ Set 3
1. Element used to secure methods.
a) security:intercept-methods
b) global-method-security
c) all of the mentioned
d) none of the mentioned
Answer
Answer: c [Reason:] First, you can embed a security:intercept-methods element in a bean definition to secure its methods. Alternatively, you can configure a global global-method-security element to secure multiple methods.
2. @Secured annotation is used to secure methods implemented by beans.
a) True
b) False
Answer
Answer: a [Reason:] You can also annotate methods declared in a bean interface or an implementation class with the @Secured annotation and then enable security for them in global-method-security.
3 Element used to specify access attributes for bean’s methods.
a) security:protect
b) security:intercept
c) security:intercept-security
d) none of the mentioned
Answer
Answer: a [Reason:] In a bean’s security:intercept-methods, you can specify multiple security:protect elements to specify access attributes for this bean’s methods.
4. Attribute used to specify custom access decision manager.
a) access-decision-manager-ref
b) access-decision-ref
c) access-decision
d) none of the mentioned
Answer
Answer: a [Reason:] If you would like to use a custom access decision manager, you can specify it in the access-decision-manager-ref.
5. JSP technology is also used to handle security of JSP views.
a) True
b) False
Answer
Answer: a [Reason:] Spring Security provides a JSPtag library for you to handle security in JSP views.
6. Tag which displays user’s Authentication object.
a) security:tag
b) security_Tag
c) security:authentication
d) none of the mentioned
Answer
Answer: c [Reason:] The security:authentication tag exposes the current user’s Authentication object for you to render its properties.
7. Tag which renders the granted authorities one by one.
a) c:for
b) c:forEach
c) c:doWhile
d) c:while
Answer
Answer: b [Reason:] You can store the authorities property, which contains the authorities granted to the user, in the JSP variable authorities, and render them one by one with a c:forEach tag.
8. Tag used to render view contents conditionally.
a) security:authorize
b) security:authority
c) security:authenticate
d) none of the mentioned
Answer
Answer: a [Reason:] If you would like to render view contents conditionally according to a user’s authorities, you can use the security:authorize tag.
9. Attribute used to render enclosed content.
a) ifGranted
b) if_Granted
c) ifAllGranted
d) none of the mentioned
Answer
Answer: c [Reason:] If you want the enclosing content to be rendered only when the user has been granted certain authorities at the same time, you have to specify them in the ifAllGranted attribute.
10. Module that allows each domain to have it’s own access.
a) access share list
b) access common list
c) access control list
d) access list
Answer
Answer: c [Reason:] Spring Security provides a module named ACL that allows each domain object to have its own access control list (ACL).
11. ACL(Access control list) consists of:-
a) object identity
b) access control entities
c) none of the mentioned
d) all of the mentioned
Answer
Answer: a [Reason:] An ACL contains a domain object’s object identity to associate with the object, and also holds multiple access control entries (ACEs).
12. ACEs(Access control entries) core consists of:-
a) Permissions
b) Security Identity
c) All of the mentioned
d) None of the mentioned
Answer
Answer: c [Reason:] Multiple access control entries (ACEs), each of which contains the above mentioned two core parts.
13. Which of the following is/are part of BasePermission class:-
a) CREATE
b) READ/WRITE
c) DELETE
d) All of the mentioned
Answer
Answer: d [Reason:] The BasePermission class predefines five basic permissions as constant values for you to use: READ (bit 0 or integer 1), WRITE (bit 1 or integer 2), CREATE (bit 2 or integer 4), DELETE (bit 3 or integer 8), and ADMINISTRATION (bit 4 or integer 16).
14. SID(Security Identity) associates with permission using.
a) principal(PrincipalSid)
b) authority (GrantedAuthoritySid)
c) all of the mentioned
d) none of the mentioned
Answer
Answer: c [Reason:] Each ACE contains permissions for a particular SID. An SID can be a principal (PrincipalSid) or an authority (GrantedAuthoritySid) to associate with permissions.
15. Interfaces that defines operation of an ACL service.
a) AclService
b) MutableAclService
c) All of the mentioned
d) None of the mentioned
Answer
Answer: c [Reason:] In Spring Security, there are two interfaces that define operations of an ACL service: AclService and MutableAclService. AclService defines operations for you to read ACLs.
Java MCQ Set 4
1. Scripting languages supported by Spring?
a) JRuby
b) Groovy
c) BeanShell
d) All of the mentioned
Answer
Answer: d [Reason:] Spring supports the 3 above mentioned scripting languages.
2. Scripting language based on Ruby
a) JRuby
b) Groovy
c) BeanShell
d) All of the mentioned
Answer
Answer: a [Reason:] JRuby is an open source Java-based implementation of the popular Ruby programming language.
3. Dynamic Langauge for java platform to cope up with other languages
a) JRuby
b) Groovy
c) BeanShell
d) All of the mentioned
Answer
Answer: b [Reason:] Groovy is a dynamic language for the Java platform that integrates the features of other excellent programming languages.
4. Lightweight java scripting language executing java fragments
a) JRuby
b) Groovy
c) BeanShell
d) All of the mentioned
Answer
Answer: c [Reason:] BeanShell is a lightweight Java scripting language that can dynamically execute Java code fragments while supporting scripting features like those of other scripting languages.
5. In Ruby instance variable begins with
a) #
b) *
c) @
d) None of the mentioned
Answer
Answer: c [Reason:] In Ruby, an instance variable begins with the @ sign.
6. XML Element to declare a bean implemented by JRuby
a) lang:jruby
b) aop:jruby
c) beanscript:jruby
d) script:jruby
Answer
Answer: a [Reason:] In the bean configuration file, you can declare a bean implemented with JRuby by using the lang:jruby.
7. XML element to specify the property values for scripting bean
a) lang:property
b) bean:property
c) script:property
d) None of the mentioned
Answer
Answer: a [Reason:] You can specify the property values for a scripting bean in the lang:property elements.
8. XML Element to declare a bean implemented by Groovy
a) lang:groovy
b) lang:jruby
c) beanscript:jruby
d) script:jruby
Answer
Answer: a [Reason:] In the bean configuration file, you can declare a bean implemented with Groovy by using the lang:groovy.
9. Script’s location is specified by attribute
a) script-source
b) xml-source
c) script-annotation
d) none of the mentioned
Answer
Answer: a [Reason:] Specifying the script’s location in the script-source attribute.
10. XML Element to declare a bean implemented by JRuby
a) lang:bash
b) aop:bash
c) lang:bsh
d) script:bash
Answer
Answer: c [Reason:] In the bean configuration file, you can declare a bean implemented with BeanShell by using the lang:bsh.
11. Interface used to create additional features in groovy based beans
a) GroovyObjectCustomizer
b) GroovyBeanCustomizer
c) GroovyCustomizer
d) None of the mentioned
Answer
Answer: a [Reason:] The GroovyObjectCustomizer interface is a callback that allows you to hook additional creation logic into the process of creating a Groovy-backed bean.
12. Attribute which specifies all the interfaces
a) script-interfaces
b) lang:bsh
c) lang:script
d) script:bsh
Answer
Answer: a [Reason:] Spring creates a JDK dynamic proxy implementing all of the interfaces that are specified in the ‘script-interfaces’.
13. Class-based proxies are best way to advise scripted beans
a) True
b) False
Answer
Answer: b [Reason:] There is just one (small) thing that you need to be aware of when advising scripted beans. You cannot use class-based proxies, you must use interface-based proxies.
14. Element which allows you to control the scope
a) lang:jruby
b) lang:language
c) lang: bsh
d) lang:groovy
Answer
Answer: b [Reason:] The scope attribute on the various lang:language/ elements allows you to control the scope of the underlying scripted bean, just as it does with a regular bean.
15. BeanShell Library dependecies
a) bsh-2.0b4.jar
b) cglib-nodep-2.1_3.jar
c) all of the mentioned
d) none of the mentioned
Answer
Answer: c [Reason:] All of these libraries are available in the Spring-with-dependencies distribution of Spring (in addition to also being freely available on the web).
Java MCQ Set 5
1. View Technologies to render Spring Web MVC’s view.
a) JSP
b) Tiles
c) All of the mentioned
d) None of the mentioned
Answer
Answer: c [Reason:] By default, Spring Web Flow relies on Spring MVC’s view technologies (e.g., JSP and Tiles) to render its views.
2. Submodules of Spring Web Flow to simplify use of JSF and javascript in Spring.
a) Spring Faces
b) Spring Javascript
c) None of the mentioned
d) All of the mentioned
Answer
Answer: d [Reason:] Spring Web Flow provides two submodules, Spring Faces and Spring JavaScript, to simplify using JSF and JavaScript in Spring.
3. Spring Faces provides a set of client-side validation components for standard JSF input components.
a) True
b) False
Answer
Answer: a [Reason:] These components are provided as Facelets tags, so you have to use Facelets as your JSF view technology to use them.
4. To use JSF Validatio components provide by spring faces.
a) Faces
b) Spring Javascript
c) Facelets
d) None of the mentioned
Answer
Answer: c [Reason:] To use the JSF validation components provided by Spring Faces, you have to use Facelets to create your JSF views.
5. Attribute used to handle web flow requests.
a) servlet-mapping
b) servlet-attr
c) servlet-flow
d) servlet-requests
Answer
Answer: a [Reason:] If you are going to use the legacy JSF request handling at the same time, you will have to specify that.
6. JSF view handler to enable Facelets and a SpringBeanFacesELResolver to access Spring beans.
a) FaceletViewHandler
b) FaceletView
c) FaceletHandler
d) None of the mentioned
Answer
Answer: a [Reason:] You have to configure FaceletViewHandler as the JSF view handler to enable Facelets and a SpringBeanFacesELResolver to be able to access Spring beans through JSF’s expression language.
7. To resolve Facelets views we configure:-
a) ViewFacelets
b) ViewResolver
c) View-resolver
d) View_Resolver
Answer
Answer: b [Reason:] We configure a ViewResolver to resolve Facelets views by conventions we dictate.
8. File extension of a view state’s name which is by default loaded by facelet page.
a) .xml
b) .hbm.xml
c) .xhtml
d) none of the mentioned
Answer
Answer: c [Reason:] The JSF flow builder services internally use a JSF view factory, which will, by default, load a Facelets page using a view state’s name and .xhtml as the file extension.
9. Navigation in traditional JSF applications is handled by:-
a) linking directly linking to a resource
b) commandLink
c) invoking an action
d) all of the mentioned
Answer
Answer: d [Reason:] Navigation in traditional JSF applications is handled by linking directly linking to a resource or by invoking an action (for example, on a commandLink).
10. For cross field validation or some sort of barrier to ensure state before you start a flow, we use.
a) FacesContext
b) FaceletContext
c) FacesResolver
d) All of the mentioned
Answer
Answer: a [Reason:] There are many reasons to want to use the FacesContext from the action.
11. To use Spring Faces Components, we register which of the following?
a) Servlet API
b) ResourceServlet
c) All of the mentioned
d) None of the mentioned
Answer
Answer: b [Reason:] Before you can use the Spring Faces components, you have to register ResourceServlet, which is provided by Spring JavaScript for accessing static resources in JAR files, in the web deployment descriptor.
12. Resources retrieved by Spring Faces Component.
a) JavaScript
b) CSS
c) All of the mentioned
d) None of the mentioned
Answer
Answer: c [Reason:] Spring Faces components will retrieve static JavaScript and CSS resources from Spring JavaScript through this servlet.
13. Component which additionally provides a pop-up date picker control for its enclosed input field.
a) clientDateValidator
b) clientValidator
c) dateValidator
d) validator
Answer
Answer: a [Reason:] The validation components enable client-side validation for the inputText components. You will see that the clientDateValidator component additionally provides a pop-up date picker control for its enclosed input field.
14. Component which encloses command button.
a) validateAll
b) validateAllClick
c) validateAllInClick
d) validateAllOnClick
Answer
Answer: c [Reason:] When a command button enclosed by a validateAllInClick component is clicked, it will trigger all validators in the same page to validate their fields.
15. Libraries provided by RichFaces an integration suppport for Spring web flow.
a) RichFaces
b) Slf-4j
c) Log-4j
d) All of the mentioned
Answer
Answer: a [Reason:] RichFaces actually provides two libraries that each serve very different purposes. One, called Ajax4JSF, provides the ability to augment existing components and page elements with Ajax functionality. The other, RichFaces, provides an advanced component set with Ajax functionality baked into the core.