Sun Certified Java Programmer(SCJP 1.4)
MockQuestions - 20
1. Please select signed integrals
A. char, byte, and short
B. byte, short, int, and long
C. char, short, and long
2. Java characters are ...
A. ASCII code
B. Binary code
C. Unicode
D. ANSI code
3. Please select the size of an int type
A. 32 bytes
B. 16 bits
C. 32 bits
D. 16 bytes
4. Select default value of boolean type
A. true
B. false
C. 0
D. 1
5. Consider the following line of code:
char x[]=new char[10];
After execution, what is value of x[0]?
A. 0
B. '\u0000'
C. null
6. A package statement MUST exist in all classes
A. True
B. False
7. Please choose invalid identifiers
A. temp
B. BIGint
C. 25_length
D. !length
8. Please select floating point types
A. byte
B. int
C. double
D. short
E. long
F. float
8. All operands are evaluated left to right
A. true
B. false
9. Consider the following line of code:
byte x=64;
byte y=5;
byte z= (byte)(x*y);
After execution what is value of z?
A. 320
B. 0
C. 645
D. 64
10. Consider the following line of code:
int x=7;
int y=4;
int z=7/4;
After execution what is value of z?
A. 1.75
B. 0
C. 1
D. 2
11. Please select the true statement for ! operator
A. The ! operator inverts the value of a boolean expression
B. The ! operator inverts the bit pattern of an integral expression.
C. Both A and B
D. None of the above
12. Please select arithmetic operations which can result in AirthmeticException
A. Multiplication: *
B. Division: /
C. Modulo: %
D. Addition: +
E. Subtraction: -
13. Please select operators which perform bit shifts of the binary representation of
the integral types
A. <<
B. >>
C. >>>
D. ~
E. &
F. ^
G. |
14. A protected method may be overridden by ...
A. A private method
B. A protected method
C. A public method
D. All of the above
15. A public method may not be overridden by ...
A. A private method
B. A protected method
C. A public method
D. All of the above
16. The private modifier can be applied to ...
A. A variable
B. A method
C. A top level class
D. All of the above
17. The abstract modifier can NOT be applied to ...
A. A variable
B. A method
C. A class
D. A constructor
18. A class variable is declared using following modifiers
A. protected
B. private
C. public
D. static
19. An unary operator operates on a single value
A. True
B. False
20. The following types of loop are guaranteed to be executed at least once
A. The do loop
B. The while loop
C. The for loop
D. All of the above
21. The switch() construct is used to make a choice based upon ...
A. A char value
B. An int value
C. A String value
D. None of the above
22. The circumstances that can prevent execution of the code in a finally block are
A. The death of the thread
B. The use of System.exit()
C. It is always guaranteed to be executed.
23. Select correct statement(s)
A. The continue statement abandons the loop altogether
B. The break statement causes the current iteration of the loop to be abandoned.
C. The break statement abandons the loop altogether
24. How can you declare a overloaded method?
A. Reusing the method name with different arguments and same return type
B. Reusing the method name with different arguments and different return type
C. Reusing the name with identical arguments and return type
D. None of the above
25. How can you declare a overriding method?
A. Using the same method name with identical arguments and return type
B. Using the same method name with identical arguments and different return type
C. Using the same method name with different arguments and same return type
D. All of the above
26. When a default constructor is provided by the compiler?
A. If you define no constructor at all in a class
B. When you define at least one constructor
C. It is always provided whether you define a constructor or not
D. It is never provided
27. A static inner class can access ...
A. instance variables of the enclosing class
B. static variables of the enclosing class
C. Both A and B
D. None of the above
28. An inner class created inside a method can access
A. Any local variables of a method that contain an inner class.
B. Any instance variables of the enclosing class
C. Any final variables of the enclosing class or a method that contain an inner class.
D. None of the above
29. Please select true statement(s) for an anonymous inner class
A. An anonymous class can not extend to a superclass
B. An anonymous class can not implement an interface
C. An anonymous class can extend to a supperclass and implement an interface both.
D. An anonymous class can extend to a supperclass or implement an interface
30. Please select true statement(s) for a member inner class
A. An inner class in class scope can have any accessibility of the top level class,
including private.
B. An Inner class defined local to a block may be static
C. An anonymous inner class can not declare a constructor.
D. An inner class can not have same name as enclosing class.
E. All of the above
31. Please select invalid statement(s) for a thread
A. You can restart a dead thread
B. You can't call the methods of a dead thread
C. Both of the above
D. None of the above
32. Select correct statements for a java.lang.String
A. Strings are sequences of 16 bit Unicode characters.
B. Strings are immutable.
C. Both of the above
D. None of the above
33. Select correct statements for == operator.
A. It compare object reference of two objects
B. It compare the value of two objects
C. Both of the above
D. None of the above
34. Please select collection(s) that do not reject duplicates
A. java.util.List
B. java.util.Set
C. java.util.Map
D. All of the above
35. Please select a default layout manager of the java.awt.Panel
A. java.awt.FlowLayout with left justified
B. java.awt.FlowLayout with center justified
C. java.awt.FlowLayout with right justified
D. None of the above
36. Please select a default layout manager for the java.awt.Frame
A. java.awt.FlowLayout
B. java.awt.BorderLayout
C. java.awt.GridBagLayout
D. None of the above
37. Please select true statement for prefix operator(++x/--x).
A. The prefix operator(++x/--x) evaluates the value of the operand after
increment/decrement operation.
B. The prefix operator(++x/--x) evaluates the value of the operand before
increment/decrement operation.
C. Both A and B
D. None of the above
38. Please select true statement(s) for shift operators.
A. >>> operator always produces a positive number.
B. >> always produces a positive number for a positive number.
C. >> always produces a negative number for a negative number.
D. None of the above
39. Please select true statement(s) for shift operators.
A. Shifting is not allowed in long integral type
B. Shifting is not allowed in float integral type
C. Shifting is not allowed in double integral type
D. Shifting is not allowed in int integral type.
40. Please identify correct assignment for boolean type.
A. boolean javaExam=true;
B. boolean javaExam=True;
C. boolean javaExam=1;
D. All of the above
41. Bitwise operator can be applied to ...
A. Integral types
B. Float types
C. Both of the above
D. None of the above
42. instanceof operator can be used with ...
A. interfaces
B. Arrays
C. Classes
D. All of the above
43. Please select true statement(s)
A. The equals method compares content of two objects
B. The == operator tests reference of two objects
C. The equals method compares reference of two objects.
D. The == operator compares content of two objects
44. Please identify invalid use of comparison operator for the following code:
String s=new String("S");
String t=new String("T");
int x=83;
int y=84;
A. s == t
B. x!=y
C. x==s
D. s!=t
45. Please select true statement(s) for instanceof operator:
A. The instanceof operator can be applied to object reference
B. The instanceof operator can be applied to an array.
C. Both of the above
D. None of the above
46. please select true statement(s) for static modifier.
A. A static method can access non-static variables of the class.
B. A static method can call non-static methods.
C. A static method can be overridden by non-static method.
D. None of the above
47. Please, select true statement(s) for thread.
A. Invoking a constructor of a Thread registers the thread with thread scheduler.
B. Calling a start() method of thread registers the thread with thread scheduler.
C. Calling a run() method of thread registers the thread with thread scheduler.
D. All of the above.
48. Invoking yield() on a running thread cause following effect(s):
A. A running thread will be placed in suspended state.
B. A running thread will be placed in sleeping state.
C. A running thread will be placed in ready state.
D. Neither of the above.
49. The default priority of the thread is
A. 0
B. 1
C. 5
D. 10
50. Which of the following methods are NOT static of Thread class?
A. start()
B. sleep(long l)
C. run()
D. yield()
51. Select true statement(s) about an inner class declared inside a method, also
known as local inner class
A. The local inner class can access any local variables declared in the method and the
parameters passed to the method.
B. The local inner class can access only public variables declared in enclosing class
C. The local inner class can access public, private, and protected variables declared in
enclosing class.
D. The local inner class can access only final declared variables in the method.
52. How can you prevent class JavaExam from being extended?
A. declare class static JavaExam
B. declare class synchronized JavaExam
C. declare class final JavaExam
D. None of the above
54. Assume that following methods are declared in one class.
1. public void addElement(Object javaExam)
2. public void addElement( Object [] javaExam)
3. public Object addElement ( int index, Object javaExam)
Please select true statement(s) for above methods.
. All methods are example of overloading method
A. All methods are example of overriding method
B. Method # 1 and method # 2 are example of overloading method, whereas
method # 3 is an example of overriding method.
C. None of the above
55. When can't you override a method?
. when method is declared abstract
A. When method is declared final
B. when method is declared private
C. when method is declared static
56. Please select invalid declaration of the top level class
. public abstract final class JavaExam
A. public final class JavaExam implement Runnable
B. protected static class JavaExam
C. public class JavaExam extend Thread
57. Please select invalid types for a switch construct
. float
A. long
B. String
C. All of the above
58. Please select invalid java keywords
. include
A. ifdef
B. sizeof
C. goto
59. Which of the following statements are NOT true about Java garbage collection
Thread?
. The garbage collection thread has a low priority
A. The garbage collection thread can be invoked at any time
B. A call to System.gc() is guaranteed to invoke garbage collection thread
immediately
C. A call to Runtime.getRuntime().gc() is guaranteed to invoke garbage collection
thread immediately
60. An inner class can not declare______ variables.
. static
A. protected
B. final
C. transient
61. Which of the following types can be added to java.util.Vector?
. reference
A. null
B. int
C. All of the above
62. Please select a true statement about delete() method of java.io.File.
. It can delete a file
A. It can delete an empty directory
B. Both of the above
C. Neither of the above
63. The continue statement causes the current iteration of the loop to be skipped
and the next iteration starts.
. True
A. False
64. The return type of constructor is void.
. True
A. False
65. 'null' is valid java type.
. True
A. False
66. Invoking a constructor of java.io.File class creates a file on the file system.
. True
A. False
67. Select true statement(s) about native modifier.
native modifier can be applied to a class
A. native modifier can be applied to a method
B. native modifier can be applied to an instance variable
C. native variable can be applied to a class variable
68. What method(s) needed to be declared by a class implementing Runnable
interface?
public void start()
A. public void run()
B. public boolean start()
C. public boolean run()
69. The priority of a newly created thread is always Thread.NORM_PRIORITY.
True
A. False
70. What methods are declared in java.lang.Thread class?
public static void sleep(long millis, int nanos)
A. public static native void sleep(long millis, int nanos)
B. public static native void sleep(long millis)
C. public static void sleep(long millis)
71. A yield method of the Thread class suspends the operation of the current
thread.
True
A. False
72. What methods are NOT synchronized in java.util.Vector class?
size()
A. add(int index, Object element)
B. capacity()
C. get(int index)
73. Please select unchecked exception(s)?
java.lang.NullPointerException
A. java.lang.ClassNotFoundException
B. java.lang.ClassCastException
C. java.awt.AWTException
74. Which of the following declarations are valid to throw an exception?
throw new java.lang.Exception();
A. throws new java.lang.Exception();
B. Both of the above
C. None of the above
75. Which of the following classes are immutable?
java.lang.String
A. java.lang.StringBuffer
B. java.util.Vector
C. java.lang.Integer
76. Which of the following classes store and retrieve values based on a key?
java.util.Hashtable
A. java.util.Vector
B. java.util.LinkedList
C. java.util.HashMap
77. Which of the following classes can store null value for a key?
java.util.Hashtable
A. java.util.HashMap
B. java.util.Properties
C. All of the above
78. java.util.Vector uses synchronized methods to store and retrieve values.
True
A. False
79. java.util.Hashtable uses synchronized methods to store and retrieve values.
True
A. False
80. java.util.HashMap uses synchronized methods to store and retrieve values.
True
A. False
81. Which of the following collections maintain object references in the order they
were added?
java.util.Vector
A. java.util.Hashtable
B. java.util.HashMap
C. java.util.ArrayList
82. java.util.hashtable implements which of the following interfaces?
java.util.Dictionary
A. java.util.Map
B. java.util.HashMap
C. java.util.Hashmap
Answers:
1. B
2. C
3. C
4. B
5. B
6. B
7. C and D
8. C and F
9. A
10. D. Comment: A byte value can represent a range of -128 to +127. Arithmetically
answer is 320, but when you store this result to a byte variable you will get a value 64
since result is out of the range (-128 to +127).
11. C
12. A
13. B and C are correct
14. A, B, and C
15. B and C
16. A and B
17. A and B
18. A and D
19. D
20. A. Comment: + and - operator can take two values
21. A
22. A and B
23. A and B
24. C
25. A and B
26. A
27. A
28. B
29. C
30. D
31. A , C, and D
32. C. Thanks Chris Pereira for your feedback in our discussion area.
33. C
34. A
35. A
36. B
37. B
38. A
39. B, and C.
40. B and C
41. A
42. A
43. D
44. A and B
45. C
46. C
47. D
48. B
49. C
50. C
51. A and C
52. C and D
53. C
54. A
55. B
56. A, B, C, and D
57. D
58. A, B, and C
59. B, C, and D
60. A
61. A and B
62. C
63. A
64. B
65. A
66. B
67. B
68. B
69. B Comment: A newly created thread inherits the priority of the Thread that creates it.
70. A and C
71. A
72. A, B, and C
73. A and C
74. A
75. A and D
76. A and D
77. B
78. A
79. A
80. B
81. A and D
82. B
JavaBeat 2005, India (www.javabeat.net)
Submit a Site - Directory - Submit Articles
MockQuestions - 20
1. Please select signed integrals
A. char, byte, and short
B. byte, short, int, and long
C. char, short, and long
2. Java characters are ...
A. ASCII code
B. Binary code
C. Unicode
D. ANSI code
3. Please select the size of an int type
A. 32 bytes
B. 16 bits
C. 32 bits
D. 16 bytes
4. Select default value of boolean type
A. true
B. false
C. 0
D. 1
5. Consider the following line of code:
char x[]=new char[10];
After execution, what is value of x[0]?
A. 0
B. '\u0000'
C. null
6. A package statement MUST exist in all classes
A. True
B. False
7. Please choose invalid identifiers
A. temp
B. BIGint
C. 25_length
D. !length
8. Please select floating point types
A. byte
B. int
C. double
D. short
E. long
F. float
8. All operands are evaluated left to right
A. true
B. false
9. Consider the following line of code:
byte x=64;
byte y=5;
byte z= (byte)(x*y);
After execution what is value of z?
A. 320
B. 0
C. 645
D. 64
10. Consider the following line of code:
int x=7;
int y=4;
int z=7/4;
After execution what is value of z?
A. 1.75
B. 0
C. 1
D. 2
11. Please select the true statement for ! operator
A. The ! operator inverts the value of a boolean expression
B. The ! operator inverts the bit pattern of an integral expression.
C. Both A and B
D. None of the above
12. Please select arithmetic operations which can result in AirthmeticException
A. Multiplication: *
B. Division: /
C. Modulo: %
D. Addition: +
E. Subtraction: -
13. Please select operators which perform bit shifts of the binary representation of
the integral types
A. <<
B. >>
C. >>>
D. ~
E. &
F. ^
G. |
14. A protected method may be overridden by ...
A. A private method
B. A protected method
C. A public method
D. All of the above
15. A public method may not be overridden by ...
A. A private method
B. A protected method
C. A public method
D. All of the above
16. The private modifier can be applied to ...
A. A variable
B. A method
C. A top level class
D. All of the above
17. The abstract modifier can NOT be applied to ...
A. A variable
B. A method
C. A class
D. A constructor
18. A class variable is declared using following modifiers
A. protected
B. private
C. public
D. static
19. An unary operator operates on a single value
A. True
B. False
20. The following types of loop are guaranteed to be executed at least once
A. The do loop
B. The while loop
C. The for loop
D. All of the above
21. The switch() construct is used to make a choice based upon ...
A. A char value
B. An int value
C. A String value
D. None of the above
22. The circumstances that can prevent execution of the code in a finally block are
A. The death of the thread
B. The use of System.exit()
C. It is always guaranteed to be executed.
23. Select correct statement(s)
A. The continue statement abandons the loop altogether
B. The break statement causes the current iteration of the loop to be abandoned.
C. The break statement abandons the loop altogether
24. How can you declare a overloaded method?
A. Reusing the method name with different arguments and same return type
B. Reusing the method name with different arguments and different return type
C. Reusing the name with identical arguments and return type
D. None of the above
25. How can you declare a overriding method?
A. Using the same method name with identical arguments and return type
B. Using the same method name with identical arguments and different return type
C. Using the same method name with different arguments and same return type
D. All of the above
26. When a default constructor is provided by the compiler?
A. If you define no constructor at all in a class
B. When you define at least one constructor
C. It is always provided whether you define a constructor or not
D. It is never provided
27. A static inner class can access ...
A. instance variables of the enclosing class
B. static variables of the enclosing class
C. Both A and B
D. None of the above
28. An inner class created inside a method can access
A. Any local variables of a method that contain an inner class.
B. Any instance variables of the enclosing class
C. Any final variables of the enclosing class or a method that contain an inner class.
D. None of the above
29. Please select true statement(s) for an anonymous inner class
A. An anonymous class can not extend to a superclass
B. An anonymous class can not implement an interface
C. An anonymous class can extend to a supperclass and implement an interface both.
D. An anonymous class can extend to a supperclass or implement an interface
30. Please select true statement(s) for a member inner class
A. An inner class in class scope can have any accessibility of the top level class,
including private.
B. An Inner class defined local to a block may be static
C. An anonymous inner class can not declare a constructor.
D. An inner class can not have same name as enclosing class.
E. All of the above
31. Please select invalid statement(s) for a thread
A. You can restart a dead thread
B. You can't call the methods of a dead thread
C. Both of the above
D. None of the above
32. Select correct statements for a java.lang.String
A. Strings are sequences of 16 bit Unicode characters.
B. Strings are immutable.
C. Both of the above
D. None of the above
33. Select correct statements for == operator.
A. It compare object reference of two objects
B. It compare the value of two objects
C. Both of the above
D. None of the above
34. Please select collection(s) that do not reject duplicates
A. java.util.List
B. java.util.Set
C. java.util.Map
D. All of the above
35. Please select a default layout manager of the java.awt.Panel
A. java.awt.FlowLayout with left justified
B. java.awt.FlowLayout with center justified
C. java.awt.FlowLayout with right justified
D. None of the above
36. Please select a default layout manager for the java.awt.Frame
A. java.awt.FlowLayout
B. java.awt.BorderLayout
C. java.awt.GridBagLayout
D. None of the above
37. Please select true statement for prefix operator(++x/--x).
A. The prefix operator(++x/--x) evaluates the value of the operand after
increment/decrement operation.
B. The prefix operator(++x/--x) evaluates the value of the operand before
increment/decrement operation.
C. Both A and B
D. None of the above
38. Please select true statement(s) for shift operators.
A. >>> operator always produces a positive number.
B. >> always produces a positive number for a positive number.
C. >> always produces a negative number for a negative number.
D. None of the above
39. Please select true statement(s) for shift operators.
A. Shifting is not allowed in long integral type
B. Shifting is not allowed in float integral type
C. Shifting is not allowed in double integral type
D. Shifting is not allowed in int integral type.
40. Please identify correct assignment for boolean type.
A. boolean javaExam=true;
B. boolean javaExam=True;
C. boolean javaExam=1;
D. All of the above
41. Bitwise operator can be applied to ...
A. Integral types
B. Float types
C. Both of the above
D. None of the above
42. instanceof operator can be used with ...
A. interfaces
B. Arrays
C. Classes
D. All of the above
43. Please select true statement(s)
A. The equals method compares content of two objects
B. The == operator tests reference of two objects
C. The equals method compares reference of two objects.
D. The == operator compares content of two objects
44. Please identify invalid use of comparison operator for the following code:
String s=new String("S");
String t=new String("T");
int x=83;
int y=84;
A. s == t
B. x!=y
C. x==s
D. s!=t
45. Please select true statement(s) for instanceof operator:
A. The instanceof operator can be applied to object reference
B. The instanceof operator can be applied to an array.
C. Both of the above
D. None of the above
46. please select true statement(s) for static modifier.
A. A static method can access non-static variables of the class.
B. A static method can call non-static methods.
C. A static method can be overridden by non-static method.
D. None of the above
47. Please, select true statement(s) for thread.
A. Invoking a constructor of a Thread registers the thread with thread scheduler.
B. Calling a start() method of thread registers the thread with thread scheduler.
C. Calling a run() method of thread registers the thread with thread scheduler.
D. All of the above.
48. Invoking yield() on a running thread cause following effect(s):
A. A running thread will be placed in suspended state.
B. A running thread will be placed in sleeping state.
C. A running thread will be placed in ready state.
D. Neither of the above.
49. The default priority of the thread is
A. 0
B. 1
C. 5
D. 10
50. Which of the following methods are NOT static of Thread class?
A. start()
B. sleep(long l)
C. run()
D. yield()
51. Select true statement(s) about an inner class declared inside a method, also
known as local inner class
A. The local inner class can access any local variables declared in the method and the
parameters passed to the method.
B. The local inner class can access only public variables declared in enclosing class
C. The local inner class can access public, private, and protected variables declared in
enclosing class.
D. The local inner class can access only final declared variables in the method.
52. How can you prevent class JavaExam from being extended?
A. declare class static JavaExam
B. declare class synchronized JavaExam
C. declare class final JavaExam
D. None of the above
54. Assume that following methods are declared in one class.
1. public void addElement(Object javaExam)
2. public void addElement( Object [] javaExam)
3. public Object addElement ( int index, Object javaExam)
Please select true statement(s) for above methods.
. All methods are example of overloading method
A. All methods are example of overriding method
B. Method # 1 and method # 2 are example of overloading method, whereas
method # 3 is an example of overriding method.
C. None of the above
55. When can't you override a method?
. when method is declared abstract
A. When method is declared final
B. when method is declared private
C. when method is declared static
56. Please select invalid declaration of the top level class
. public abstract final class JavaExam
A. public final class JavaExam implement Runnable
B. protected static class JavaExam
C. public class JavaExam extend Thread
57. Please select invalid types for a switch construct
. float
A. long
B. String
C. All of the above
58. Please select invalid java keywords
. include
A. ifdef
B. sizeof
C. goto
59. Which of the following statements are NOT true about Java garbage collection
Thread?
. The garbage collection thread has a low priority
A. The garbage collection thread can be invoked at any time
B. A call to System.gc() is guaranteed to invoke garbage collection thread
immediately
C. A call to Runtime.getRuntime().gc() is guaranteed to invoke garbage collection
thread immediately
60. An inner class can not declare______ variables.
. static
A. protected
B. final
C. transient
61. Which of the following types can be added to java.util.Vector?
. reference
A. null
B. int
C. All of the above
62. Please select a true statement about delete() method of java.io.File.
. It can delete a file
A. It can delete an empty directory
B. Both of the above
C. Neither of the above
63. The continue statement causes the current iteration of the loop to be skipped
and the next iteration starts.
. True
A. False
64. The return type of constructor is void.
. True
A. False
65. 'null' is valid java type.
. True
A. False
66. Invoking a constructor of java.io.File class creates a file on the file system.
. True
A. False
67. Select true statement(s) about native modifier.
native modifier can be applied to a class
A. native modifier can be applied to a method
B. native modifier can be applied to an instance variable
C. native variable can be applied to a class variable
68. What method(s) needed to be declared by a class implementing Runnable
interface?
public void start()
A. public void run()
B. public boolean start()
C. public boolean run()
69. The priority of a newly created thread is always Thread.NORM_PRIORITY.
True
A. False
70. What methods are declared in java.lang.Thread class?
public static void sleep(long millis, int nanos)
A. public static native void sleep(long millis, int nanos)
B. public static native void sleep(long millis)
C. public static void sleep(long millis)
71. A yield method of the Thread class suspends the operation of the current
thread.
True
A. False
72. What methods are NOT synchronized in java.util.Vector class?
size()
A. add(int index, Object element)
B. capacity()
C. get(int index)
73. Please select unchecked exception(s)?
java.lang.NullPointerException
A. java.lang.ClassNotFoundException
B. java.lang.ClassCastException
C. java.awt.AWTException
74. Which of the following declarations are valid to throw an exception?
throw new java.lang.Exception();
A. throws new java.lang.Exception();
B. Both of the above
C. None of the above
75. Which of the following classes are immutable?
java.lang.String
A. java.lang.StringBuffer
B. java.util.Vector
C. java.lang.Integer
76. Which of the following classes store and retrieve values based on a key?
java.util.Hashtable
A. java.util.Vector
B. java.util.LinkedList
C. java.util.HashMap
77. Which of the following classes can store null value for a key?
java.util.Hashtable
A. java.util.HashMap
B. java.util.Properties
C. All of the above
78. java.util.Vector uses synchronized methods to store and retrieve values.
True
A. False
79. java.util.Hashtable uses synchronized methods to store and retrieve values.
True
A. False
80. java.util.HashMap uses synchronized methods to store and retrieve values.
True
A. False
81. Which of the following collections maintain object references in the order they
were added?
java.util.Vector
A. java.util.Hashtable
B. java.util.HashMap
C. java.util.ArrayList
82. java.util.hashtable implements which of the following interfaces?
java.util.Dictionary
A. java.util.Map
B. java.util.HashMap
C. java.util.Hashmap
Answers:
1. B
2. C
3. C
4. B
5. B
6. B
7. C and D
8. C and F
9. A
10. D. Comment: A byte value can represent a range of -128 to +127. Arithmetically
answer is 320, but when you store this result to a byte variable you will get a value 64
since result is out of the range (-128 to +127).
11. C
12. A
13. B and C are correct
14. A, B, and C
15. B and C
16. A and B
17. A and B
18. A and D
19. D
20. A. Comment: + and - operator can take two values
21. A
22. A and B
23. A and B
24. C
25. A and B
26. A
27. A
28. B
29. C
30. D
31. A , C, and D
32. C. Thanks Chris Pereira for your feedback in our discussion area.
33. C
34. A
35. A
36. B
37. B
38. A
39. B, and C.
40. B and C
41. A
42. A
43. D
44. A and B
45. C
46. C
47. D
48. B
49. C
50. C
51. A and C
52. C and D
53. C
54. A
55. B
56. A, B, C, and D
57. D
58. A, B, and C
59. B, C, and D
60. A
61. A and B
62. C
63. A
64. B
65. A
66. B
67. B
68. B
69. B Comment: A newly created thread inherits the priority of the Thread that creates it.
70. A and C
71. A
72. A, B, and C
73. A and C
74. A
75. A and D
76. A and D
77. B
78. A
79. A
80. B
81. A and D
82. B
JavaBeat 2005, India (www.javabeat.net)
Submit a Site - Directory - Submit Articles
I cannot thank you enough for the blog.Thanks Again. Keep writing.
ReplyDeletejava training
online training in java