Java MCQ Set 1
1. ________ submits a value-returning task for execution and returns a Future representing the pending results of the task.
a) submit(Callable<T> task)
b) awaitTermination
c) submit(Runnable task, T result)
d) invokeAll()
Answer
Answer: a [Reason:] The Future’s get method will return the task’s result upon successful completion.
2. ______ submits a Runnable task for execution and returns a Future representing that task.
a) submit(Callable<T> task)
b) awaitTermination
c) submit(Runnable task, T result)
d) invokeAll()
Answer
Answer: c [Reason:] The function takes as parameters the task to submit and the result to return.
3. _______ returns true if all tasks have completed following shut down.
a) submit(Callable<T> task)
b) isTerminated
c) submit(Runnable task, T result)
d) invokeAll()
Answer
Answer: b [Reason:] isTerminated is never true unless either shutdown or shutdownNow was called first.
4. _______ returns true if this executor has been shut down.
a) isShutdown
b) isTerminated
c) submit(Runnable task, T result)
d) invokeAll()
Answer
Answer: a [Reason:] The isShutdown() method is used to check whether the executor has been shut down.
5. ___ is used for the execution of the given tasks, returning a list of Futures holding their status and results after completion.
a) isShutdown
b) isTerminated
c) invokeAll(Collection<? extends Callable<T>> tasks)
d) invokeAll(Collection<? extends Callable<T>> tasks, long timeout, TimeUnit unit)
Answer
Answer: c [Reason:] Future.isDone() is true for each element of the returned list.
6. ________ executes the given tasks, returning the result of one that has completed successfully.
a) isShutdown
b) invokeAny(Collection<? extends Callable<T>> tasks)
c) invokeAll(Collection<? extends Callable<T>> tasks)
d) invokeAll(Collection<? extends Callable<T>> tasks, long timeout, TimeUnit unit)
Answer
Answer: b [Reason:] Upon normal or exceptional return, tasks that have not completed are cancelled.
7. _______ exception is thrown while invokeAll() is interrupted while waiting.
a) InterruptedException
b) NullPointerException
c) RejectedExecutionException
d) ArrayIndexOutOfBoundsException
Answer
Answer: a [Reason:] If the exception is thrown, the unfinished tasks are cancelled.
8. NullPointerException is thrown if tasks or any of its elements are null.
a) True
b) False
Answer
Answer: a [Reason:] If any of the tasks or elements are null, the methods throws a NullPointerException.
9. InterruptedException is thrown if any task cannot be scheduled for execution.
a) True
b) False
Answer
Answer: b [Reason:] RejectedExecutionException is thrown if any task cannot be scheduled for execution.
10. ____ initiates an orderly shutdown in which previously submitted tasks are executed.
a) Shutdown
b) invokeAny(Collection<? extends Callable<T>> tasks)
c) invokeAll(Collection<? extends Callable<T>> tasks)
d) invokeAll(Collection<? extends Callable<T>> tasks, long timeout, TimeUnit unit)
Answer
Answer: a [Reason:] No new tasks will be accepted after calling Shutdown().
Java MCQ Set 2
1. LSD stands for ____
a) Lean Software Development
b) Live Software Development
c) Less Software Data
d) Least Software Dataloss
Answer
Answer: a [Reason:] LSD stands for Lean Software Development which is a type of Agile development.
2. Lean philosophy regards everything not adding value to the customer as ____
a) Unnecessary
b) Waste
c) Useful
d) Necessary
Answer
Answer: b [Reason:] Waste includes partially work done and defects.
3. A value ______ technique is used to identify waste.
a) Mapping
b) Stream
c) Stream Mapping
d) Flow
Answer
Answer: c [Reason:] Waste removal takes place iteratively until even processes and procedures which are seemingly essential are liquidated.
4. The ____ is a management paradigm that specifies any manageable system as being limited in achieving more of its goals by a very small number of constraints.
a) RCM
b) TPM
c) QRM
d) TOC
Answer
Answer: d [Reason:] TOC or theory of constraints uses a focussing process to identify the constraint.
5. ____ in the code are signs of bad code designs and should be avoided.
a) Repetitions
b) Modularity
c) Functions
d) Documentation
Answer
Answer: a [Reason:] Repetition leads to redundancy which results in bad code designs.
6. Lean Development follows the principle of ________
a) Decide as late as possible
b) Deliver as late as possible
c) Decide as early as possible
d) Not building integrity
Answer
Answer: a [Reason:] Lean Development uses the principle of Deciding as late as possible to as software development is always associated with some level of uncertainty.
7. ____ is a client-centric, architecture-centric, and pragmatic software process.
a) Loss Testing
b) Feature Driven Development
c) DSDM
d) Scrum
Answer
Answer: b [Reason:] Feature Driven Development or FDD is an iterative and incremental development process which is client and architecture centric.
8. _______ consists of exploring and explaining the domain of the problem to be solved.
a) Feature Teams
b) Inspections
c) Domain Object Modelling
d) Configuration Management
Answer
Answer: c [Reason:] The resulting domain object model provides an overall framework which can be used to add features.
9. ___ ensure there is always an up-to-date system that can be demonstrated to the client.
a) Domain Object Modelling
b) Individual Class (Code) Ownership
c) Visibility of progress and results
d) Regular Builds
Answer
Answer: d [Reason:] Regular builds helps highlighting integration errors of source code for the features early.
10. _______ helps visualizing both the processes and the data of a method.
a) Configuration Management.
b) Domain Object Modelling
c) MetaModeling
d) Inspections
Answer
Answer: c [Reason:] The advantage of metamodeling is that it is clear, compact, and consistent with UML standards.
Java MCQ Set 3
1. _____ is a technique for gathering information about the possible set of values calculated at various points in a computer program.
a) Data flow analysis
b) Equivalence partitioning
c) Inspections
d) Decision testing
Answer
Answer: a [Reason:] Data flow analysis uses the process of collecting information about the way the variables are used, defined in the program.
2. ____ is a technique used to identify the requirements of a system (usually associated with software/process design) and the information used to both define both processes used and classes (a collection of actors and processes).
a) Data flow analysis
b) Use Case analysis
c) Exploratory testing
d) Decision testing
Answer
Answer: b [Reason:] The use case analysis is the foundation upon which the system will be built.
3. A Use-case realization describes how a particular ____ is realized within the design model.
a) Class
b) Object
c) Use case
d) Function
Answer
Answer: c [Reason:] A use case is realized within the design in terms of collaborating objects.
4. ____ is an approach to software testing that is concisely described as simultaneous learning, test design and test execution.
a) Data flow analysis
b) Decision testing
c) Exploratory testing
d) Use Case analysis
Answer
Answer: c [Reason:] Exploratory testing is defined as a style of software testing that emphasizes the personal freedom and responsibility of the individual tester.
5. Exploratory testing is often thought of as a ________ technique.
a) White box testing
b) Functional testing
c) Non-functional testing
d) Black box testing
Answer
Answer: d [Reason:] Exploratory testing does not require the internals of the product to be known and hence, is thought of as a type of black box testing.
6. The main advantage of exploratory testing is that less ___ is needed.
a) Investment
b) Preparation
c) Knowledge
d) Accuracy
Answer
Answer: b [Reason:] Important bugs are found quickly in exploratory testing.
7. A major benefit of exploratory testing is that testers can use ________ based on the results of previous results.
a) Deductive Reasoning
b) Object Creation
c) Garbage Collection
d) Modularity
Answer
Answer: a [Reason:] Deductive reasoning helps testers to guide their future testing on the fly.
8. Exploratory testing is particularly suitable if ___ and specifications are incomplete.
a) Investment
b) Time
c) Requirements
d) Deadlines
Answer
Answer: c [Reason:] Exploratory testing can be used to verify that previous testing has found the most important defects.
9. ______ is a software testing technique that divides the input data of a software unit into partitions of equivalent data from which test cases can be derived.
a) Data flow analysis
b) Equivalence partitioning
c) Inspections
d) Decision testing
Answer
Answer: b [Reason:] In principle of Equivalence partitioning, test cases are designed to cover each partition at least once.
10. Equivalence Partitioning, Use Case Testing and Decision Testing are ______ techniques.
a) Static
b) Dynamic
c) Outdated
d) Infeasible
Answer
Answer: b [Reason:] All of these test the dynamic behaviour of the code.
Java MCQ Set 4
1. _______ checks if an attribute is blank or not.
a) BaseIfAttribute
b) IfBlankAttribute
c) IfTrueAttribute
d) IfSetAttribute
Answer
Answer: b [Reason:] IfBlankAttribute.Unless is the “unless” version of ifBlankAttribute.
2. ________ check if an attribute value is true or not.
a) BaseIfAttribute
b) IfBlankAttribute
c) IfTrueAttribute
d) IfSetAttribute
Answer
Answer: c [Reason:] IfTrueAttribute.Unless is the “unless” version of ifTrueAttribute.
3. _______ is an interface indicating that a reader may be chained to another one.
a) TokenFilter.Filter
b) BaseFilterReader
c) BaseParamFilterReader
d) ChainableReader
Answer
Answer: d [Reason:] The ChainableReader interface indicates that a reader may be chained to another one.
4. ________ is the base class for core filter readers.
a) TokenFilter.Filter
b) BaseFilterReader
c) BaseParamFilterReader
d) ChainableReader
Answer
Answer: b [Reason:] The original filter reader is only used for chaining purposes, never for filtering purposes.
5. ________ is a parameterized base class for core filter readers.
a) TokenFilter.Filter
b) BaseFilterReader
c) BaseParamFilterReader
d) ChainableReader
Answer
Answer: c [Reason:] The constructor is public BaseParamFilterReader(java.io.Reader in).
6. ___ class is used for assembling the constants declared in a Java class in key1=value1(line separator)key2=value2 format.
a) ClassConstants
b) BaseFilterReader
c) BaseParamFilterReader
d) ChainableReader
Answer
Answer: a [Reason:] The ClassConstants filter uses the BCEL external toolkit.
7. ________ converts text to local OS formatting conventions along with repairing the text damaged by file transfer programs.
a) ClassConstants
b) BaseFilterReader
c) BaseParamFilterReader
d) FixCrLfFilter
Answer
Answer: d [Reason:]FixCrLfFilter generalises the handling of EOL characters, and allows for CR-only line endings.
8. ____ reads the first n lines of a stream.
a) ClassConstants
b) HeadFilter
c) BaseParamFilterReader
d) FixCrLfFilter
Answer
Answer: b [Reason:] The constructor public HeadFilter(java.io.Reader in) creates a new filtered reader.
9. ___ is a Sax2 based project reader.
a) AntXMLContext
b) DefaultExecutor
c) ProjectHelperImpl
d) ProjectHelper2
Answer
Answer: d [Reason:] ProjectHelper 2 can be used to check whether this instance of ProjectHelper can parse an Antlib descriptor given by the URL.
10. ________ is a “Single-check” Target executor implementation.
a) SingleCheckExecutor
b) DefaultExecutor
c) ProjectHelperImpl
d) ProjectHelper2
Answer
Answer: a [Reason:] SingleCheckExecutor differs from DefaultExecutor in that the dependencies for all targets are computed together.
Java MCQ Set 5
1. ___ contains implementations of the core interfaces that are used to adjust or extend jMock’s basic functionality.
a) org.jmock
b) org.jmock.api
c) org.jmock.lib
d) org.jmock.integration.junit3
Answer
Answer: c [Reason:] The org.jmock.lib package contains implementations of the core interfaces.
2. ________ integrates jMock with JUnit 3.
a) org.jmock
b) org.jmock.api
c) org.jmock.lib
d) org.jmock.integration.junit3
Answer
Answer: d [Reason:] org.jmock.integration.junit4 is used to integrate jMock with JUnit 4.
3. Which package contains interfaces that define jMock’s Domain Specific Embedded Language?
a) org.jmock
b) org.jmock.syntax
c) org.jmock.lib
d) org.jmock.integration.junit3
Answer
Answer: b [Reason:] org.jmock.syntax defines interfaces that define jMock’s Domain Specific Embedded Language.
4. ____ contains classes to help test concurrent code with jMock.
a) org.jmock.concurrent
b) org.jmock.syntax
c) org.jmock.lib
d) org.jmock.integration.junit3
Answer
Answer: a [Reason:] The classes defined under org.jmock.concurrent help test concurrent code with jMock.
5. ________ is a class that “blitzes” an object by calling it many times, from multiple threads.
a) Blitzer
b) DeterministicExecutor
c) DeterministicScheduler
d) Synchroniser
Answer
Answer: a [Reason:] The Blitzer class calls an object many times from different and multiple threads.
6. ____ class is an Executor that executes commands on the thread that calls runPendingCommands or runUntilIdle.
a) Blitzer
b) DeterministicExecutor
c) DeterministicScheduler
d) Synchroniser
Answer
Answer: b [Reason:] The DeterministicExecutor executes commands on the thread calling runPendingCommands.
7. ______ Exception is thrown to report that a DeterministicScheduler has been asked to perform a blocking wait, which is not supported.
a) UnsupportedSynchronousOperationException
b) ArrayIndexOutOfBounds
c) StringIndexoutOfBounds
d) Arithmetic
Answer
Answer: a [Reason:] UnsupportedSynchronousOperationException reports that a DeterministicSchedular has been asked to perform a blocking wait.
8. ________ is a ScheduledExecutorService that executes commands on the thread that calls runNextPendingCommand, runUntilIdle or tick.
a) Blitzer
b) DeterministicExecutor
c) DeterministicScheduler
d) Synchroniser
Answer
Answer: a [Reason:] DeterministicScheduler executes on the thread calling runNextPendingCommand.
9. _____ is a ThreadingPolicy that makes the Mockery thread-safe and helps tests synchronize with background threads.
a) Blitzer
b) DeterministicExecutor
c) DeterministicScheduler
d) Synchroniser
Answer
Answer: d [Reason:] The Synchroniser class is used to make mockery thread safe.
10. ______ Interface objects executes submitted Runnable tasks.
a) Executor
b) Execution
c) Runner
d) RunWith
Answer
Answer: a [Reason:] Executor interface provides a way of decoupling task submission.