1)Which of the following statements are true about the Entity class?
a)Entity class must not have no-arg constructor
b)Entity class must be declared as top level class
c)Interface cannot be Entity
d)Enum can be declared as Entity.
2)Which of the following are correct?
a)
@EntityBean public class Employees{ ... }
b)
@Entity public class Employees{ ... }
c)
@EntityBean public class Employees implements Serializable{ ... }
d)
class Employees{ @Entity private class Address{ ... } ... }
3)If you want to send an entity object as the pass by value through a remote interface, which of the following statements are valid?
a)
@Entity public class Employees implements SessionSynchronization{ ... }
b)
@Entity public class Employees implements Serializable{ ... }
c)
public class Employees implements Serializable{ ... }
d)
@entity public class Employees implements Serializable{ ... }
4)Whic of the following statements are correct?
a)
@Entity final public class Employees{ ... }
b)
@Entity abstract public class Employees{ ... }
c)
@Entity public class Employees extends Parent{ ... }
5)Which of the following statements are correct?
a)
@Entity public class Company{ ... } public class Employee extends Company{ ... }
b)
@Entity public class Company{ ... } @Entity public class Employee extends Company{ ... }
c)
public class Company{ ... } @Entity public class Employee extends Company{ ... }
d) All the above
6)Which of the following statements are correct?
a)Entities supports inheritance
b)Abstract class and concrete classes can be entities.
c)Intance variables of an entity class can be public
d)Instance variables of an entity class must be private,protected or package visibility
7)Which of the following statements are correct?
a)Every entity must have a primary key
b)It is not necessary to define primary key for an Entity
c)@Primary annotation is used for denoting a simple primary key
d)All the above
8)Select the valid primary key types.
a)long
b)Integer
c)java.lang.String
d)java.sql.Date
e)java.util.Date
f)All the above
9)Which of the following are true about composite primary keys.
a)The primary key class must be Serilizable
b)The application must not change the value of the primary key.
c)Properties of primary key class must be public or protected.
d)Primary key class must be public
e) All the above
10)Which of the following are not true about composite primary keys.
a)The primary key class must define equals and hasfCode methods
b)The primary key class may not define equals and hashCode methods
c)Must have public no-arg constructor
d)May not have public no-arg constructor
SCBCD 5.0 Mock Exam Answers – 4
1)b,d
2)b,c
Must be annotated with @Entity
Entity class must be a top level class
3)b
Entity class must implement the Serializable interface when the entity object is passed by value.
@Entity is used for annotating the Entity class
4)b,c
Entity class extends another entity or non-entity class.
Abstract classes can be entity.
Final classes cannot be entity
5)d
6)a,b,d
7)a
8)f
9)e
10)b,d