Post Test Flashcards
Which of the following statements are true for Java 8 environments?
a. JVM is responsible for converting java byte code into machine specific code
b. JDK is required to compile java programs.
c. JRE does not contain JVM.
d. JRE software contains javac compiler.
e. None of the above
a. JVM is responsible for converting java byte code into machine specific code b. JDK is required to compile java programs.
Which operator returns a boolean if the two operands have the same value?
a. ?:
b. ==
c. ^
d. =
e. None of the above
b. ==
Which of the following is valid initialization code?
a. Int x = 3;
b. String age = 44;
c. float f = “NewFloat”;
d. Integer int = new Integer;
e. None of the above
e. None of the above
If you want your conditional to depend on two conditions BOTH being true, what is the proper notation to put between the two boolean statements?
a. AND
b. &&
c. OR
d. II
e. None of the above
b. &&
What is the proper way to declare a variable?
a. variableName variableType;
b. variableName;
c. variableType;
d. variableType variableName;
e. None of the above
d. variableType variableName;
Which of the. following primitive data type may be used to store the integer value of 128?
a. byte
b. short
c. int
d. char
b. short c. int
What is the range of values for char data type variable?
a. -215-1 to -215
b. -215 to -215-1
c. \u0000 to \uFFFF
d. \0000 to \FFFF
e. None of the above
c. \u0000 to \uFFFF
What is the output of the following code?
System.out.println ;
a. The interest amount is =1005.0
b. The interest amount is =25.0
c. The interest amount is =125.0
d. The interest amount is =105.0
e. Code cannot compile, will result in compile error.
a. The interest amount is =1005.0
What is the output of the following code?
java.lang.Double height = new java.lang.Double32.34);
System.out.println;
a. 32.34
b. 32.0
c. 32
d. This code block will result in compile error.
e. none of the above
b. 32.0
Which of the following is the correct syntax to declare Scanner class object?
a. Scanner objectName = Scanner;
b. Scanner objectName = new Scanner;
c. Scanner objectName= Scanner;
d. Scanner objectName = new Scanner;
e. None of the above.
d. Scanner objectName = new Scanner(System.in);
Which is a valid structure for the syntax of a method declaration in a class?
a. private printOutput
b. protected Customer locateProfile CustomerNotFoundException
c. public Account openAccount
d. public Double getPrice;
e. None of the above
c. public Account openAccount(String name, double balance)
Which of the following statements about interfaces and abstract classes is FALSE?
a. A class can implement only one interface
b. Method declarations in interfaces must end in a semi-colon
c. A class can be a subclass of multiple abstract classes
d. Abstract classes can contain fields that are not static and final
e. None of the above
a. A class can implement only one interface
Which of these statements is true? Select the one correct answer.
a. For each try block there must be at least one catch block defined.
b. A try block may be followed by any number of finally blocks.
c. A try block must be followed by at least one finally or catch block.
d. Finally block is placed before any catch block.
e. None of the above
c. A try block must be followed by at least one finally or catch block.
Which access modifier makes a member available only to classes within the same
package and subclasses in any other package?
a. private
b. protected
c. public
d. package-private
e. None of the above
b. protected
What is the output of the following code block?
String[ ] numbers = {“10”, “20”, “34”, “56”};
System.out.println + 10);
a. 2010
b. 30
c. 20
d. 1010
e. None of the above
b. 30
Which of the following statements are true?
a. final methods cannot be overridden in sub classes
b. final field values cannot be changed after initialization
c. abstract classes cannot have final methods
d. abstract class cannot have final fields
e. None of the above
a. final methods cannot be overridden in sub classes
b. final field values cannot be changed after initialization
Which of the following is valid initialization code?
a. int x =3;
b. char c = 44;
c. String s = ‘b’;
d. Integer int = new Integer;
e. None of the above
a. int x =3;
b. char c = 44;
What is true about “casting”?
a. Casting is only possible between primitives
b. Involves the duplication of one object to another object
c. Casting implicitly takes place during numeric conversion
d. Casting requires a magic user with at least 16 in INT and DEX
e. None of the above
e. None of the above
Which statement best describes Spring Beans? Choose one.
a. They are instantiated using the ‘new’ keyword.
b. They are Java Classes.
c. They are objects managed by a Spring container.
d. They are configured using xml.
e. None of the above
c. They are objects managed by a Spring container.
True or False: the ApplicationContext is used to access the Spring container in your
code?
a. True
b. False
a. True
Which of the following is not a Spring application context?
a. ClassPathXmlApplicationContext
b. FileSystemXmlApplicationContext
c. FileSystemAnnotationApplicationContext
d. AnnotationConfigApplicationContext
e. None of the above
c.FileSystemAnnotationApplicationContext
Which of the following is not true of Annotations?
a. They start with the “@” symbol
b. They are used to add metadata to source code.
c. They only apply to classes.
d. They are recognized by the Spring container
e. None of the above
c. They only apply to classes.
Which one of the following is true of this XML element: ?
a. It is added to the web.xml file.
b. It provides functionality similar to that of @Autowired
c. It enables auto scanning for Spring Beans.
d. It typically includes the ‘base-classes’ attribute
e. None of the above
c. It enables auto scanning for Spring Beans.
Which of the following are true of ‘Dependency Injection’?
a. DI instantiates and provides objects required in Spring classes.
b. DI replaces the need for classes to instantiate objects on their own.
c. DI allows alternate implementations to be substituted based on configuration.
d. All the above.
e. None of the above
d. All the above.