JavaBeat
calling cards | international calling cards | phone card
Search JavaBeat

SCBCD TOPICS

scbcd Home

objectives

mock exams

scbcd mock - 1

scbcd mock - 2

scbcd mock - 3

scbcd mock - 4

scbcd mock - 5

scbcd mock - 6

scbcd mock - 7

scbcd mock - 8

scbcd mock - 9

scbcd mock - 10

scbcd mock - 11

scbcd mock - 12

scbcd mock - 13

scbcd mock - 14

JAVABEAT
home
articles
tips
code junction
forums
OUR NETWORK
javabeat

SCBCD Mock Questions - 1 - Answers

1)2
IS NULL is used to test whether a cmp-field or single-valued cmr-field value is NULL. This does not test if a collection is empty.
IS EMPTY tests whether or not the collection designated by the collection-valued path expression is empty (i.e., has no elements). A collection-valued path expression can only be used in the WHERE clause in an empty collection comparison expression or in a collection member expression.
ISEMPTY is incorrect as it requires a space between the two words.
IS NOTHING is fictional and is not used within EJB QL.

2)1,3,4
Answers 1, 3 and 4 are correct.
An EJB QL query consists of a SELECT clause, which determines the type of the objects or values to be selected, a FROM clause, which provides declarations that designate the domain to which the expressions specified in the SELECT clause and WHERE clause of the query apply and optionally a WHERE clause, which may be used to restrict the results that are returned by the query.

3)2
Answer 1 is incorrect you cannot use an asterisk in the SELECT clause of an EJB QL query.
Answer 2 is correct you can pass parameters into EJB QL queries. Input parameters can only be used in the WHERE clause of an EJB QL query. Input parameters are specified using the question mark "?" prefix followed by the number of the parameter .e.g. ?1. The number of input parameters in an EJB QL query must not exceed the number of input parameters for the finder or select method. It is not required that the EJB QL query use all of the input parameters for the finder or select method. An input parameter evaluates to the type of the corresponding parameter defined in the signature of the finder or select method with which the query is associated.
Answer 3 is incorrect for an EJB QL query to be valid it must have both a valid SELECT clause and a valid FROM clause.
Answer 4 is incorrect the FROM clause is used to specify the query domain of the EJB QL query. The WHERE clause is used to specify the criteria of the query.

4)3
Answer 1 is incorrect as the parameters of a finder method use a 1 based index (instead of a zero based index).
Answer 2 is incorrect as there is no alias 'o' specified in the FROM clause of the query.
Answer 3 is correct as it uses the correct syntax for an EJB QL query and labels the parameter using a "?1" which specifies the only parameter for the finder method.
Answer 4 is incorrect because there is no alias 'b' specified in the FROM clause of the EJB QL query (this would have been correct if the FROM has aliased Accounts as 'b').

5)3
Answer 3 is the correct answer as it conforms to the correct EJB QL syntax and uses an alias of "a" for the SELECT, FROM and WHERE clause.
Answer 1 refers to o.department in the WHERE clause which is wrong because Accounts is aliased using "a" in the FROM clause.
Answer 2 uses the wrong alias of "o" in the SELECT clause, as the alias is defined as "a" in the FROM clause.
Answer 4 selects all the accounts apart from the sales department ones, which is incorrect.

6)1,4
Answer 1 is correct the EJB QL does not support the use of comments.
Answer 2 is incorrect, using the keyword DISTINCT allows you to specify a query that only returns unique results from a query.
Answer 3 is incorrect and so therefore answer 4 is correct. The data model for container-managed persistence does not support inheritance. For this reason entity objects or value classes of different types cannot be compared. Any EJB QL queries that contain such comparisons are invalid. Another restriction regarding the use of EJB QL is that date and time values should use the standard Java long millisecond value.

7)1
Answer 1 is the only correct answer. Answers 2 and 3 are SQL Queries which EJB QL will not understand. Answer 4 uses EJB instead of OBJECT, this which will not work.
An EJB QL query must consist of a SELECT clause and a FROM clause. An EJB QL query can also optionally use a WHERE clause.
The SELECT clause determines the type of the objects or values to be selected by the query.
The FROM clause provides declarations that determine the domain to which the expressions SELECT and WHERE clause should apply.
A WHERE clause (which is optional) can be used to filter the results returned by the EJB QL query.

8)2
Answers 1 and 2 are correct. The following are the reserved identifiers in EJB QL: SELECT, FROM, WHERE, DISTINCT, OBJECT, NULL, TRUE, FALSE, NOT, AND, OR, BETWEEN, LIKE, IN, AS, UNKNOWN (not used as yet but reserved), EMPTY, MEMBER, OF and IS.
An identifier in EJB QL must be a valid Java identifier and is not allowed to have the same name as either an abstract-schema-name or an ejb-name within the same deployment descriptor. Case is not important for an identifier as EJB QL is case insensitive. An identifier is not allowed to be any of the EJB QL reserved keywords.

9)1,3
Answer 1 is correct, EJB-QL uses a SQL-like syntax to select objects or values based on the abstract schema types and relationships of entity beans.
Answer 2 is incorrect, EJB QL has similarities to ANSI SQL however they do not use the same statements and keywords. SQL is used for querying relational database management systems such as DB2 or Oracle. EJB QL provides facility for querying objects and their relationships.
Answer 3 is correct, a path expression is an identification variable followed by a period (.) and either a cmr-field or cmp-field. As in Java notation e.g. object.childobject.name, Path expressions can be composed from other path expressions as long as the original path expression evaluates to a single type i.e. not a collection.
Answer 4 is incorrect as EJB QL is a query language and does not provide access to underlying persistence storage functionality.

10)2
Answers 2 and 4 are correct.
The Between expression is the equivalent of using a combination of '<' and '>' and is used in the same way as the BETWEEN expression in SQL.
If the value of an arithmetic expression used in a between expression is NULL, the value of the BETWEEN expression is unknown.


Favorites
AffiliatedAds.com
Buy movies
Access Control
Busby seo challenge contest
Sohbet
Chat
Webmaster Hosting Forum
Java Jobs
MyVideoLib
India News
Internet Advances
Sohbet
chat
Latest QnA
SCJD Tips
When we start a thread by applying start() method on it ,how does it knows that to execute run()method?
About Wrapper class in Java
How to configure weblogic 7.0 in MyEclipse?
Static Block and Static Initializer in Java

JavaBeat Website (2004-2008), India
javabeat | about us | planetoss
Copyright (2004 - 2008), JavaBeat