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