Sunteți pe pagina 1din 14

Career Ride:

1. What is the meaning of the return data type void? You answered: None of the above Incorrect Correct answer: void returns no data type. 2. A lower precision can be assigned to a higher precision value in Java. For example a byte type data can be assigned to int type. You answered: False Incorrect Correct answer: True 3. Which of the following statements about the Java language is true? You answered: None of the above. Incorrect Correct answer: Both procedural and OOP are supported in Java. 4. Which of the following statements is false about objects? Correct: Objects do not permit encapsulation 5. Which methods can access to private attributes of a class? You answered: Only classes available in the same package. Incorrect Correct answer: Only methods those defined in the same class 6. What is an aggregate object? You answered: None of the above Incorrect Correct answer: An instance which has other objects 7. Assume that File is an abstract class and has toFile() method. ImageFile and BinaryFile are concrete classes of the abstract class File. Also, assume that the method toFile() is implemented in both Binary File and Image File. A File references an ImageFile object in memory and the toFile method is called, which implementation method will be called? You answered: None of the above Incorrect

Correct answer: Image File 8. A class can have many methods with the same name as long as the number of parameters or type of parameters is different. This OOP concept is known as Correct: Method overloading 9. Which of the following is considered as a blue print that defines the variables and methods common to all of its objects of a specific kind? You answered: Real data types Incorrect Correct answer: Class 10. What are the two parts of a value of type double? You answered: Mode, Numerator Incorrect Correct answer: Significant Digits, Exponent 11. After the following code fragment, what is the value in fname? String str; int fname; str = "Foolish boy."; fname = str.indexOf("fool"); You answered: 0 Incorrect Correct answer: -1 12. What is the value of number after the following code fragment execution? int number = 0; int number2 = 12 while (number < number2) { number = number + 1; } Correct: 12 13. Given the following code snippet; int salaries[];

int index = 0; salaries = new int salaries[4]; while (index < 4) { salaries[index] = 10000; index++; } What is the value of salaries [3]? Correct: 10000 14. Which of the following is not a return type? You answered: Button Incorrect Correct answer: public 15. If result = 2 + 3 * 5, what is the value and type of result variable? You answered: 25, int Incorrect Correct answer: 17, int 16. What is the data type for the number 9.6352? You answered: Double Incorrect Correct answer: double 17. Assume that the value 3929.92 is of type float. How to assign this value after declaring the variable interest of type float? Correct: interest = 3929.92f 18. Which of the following statements is true? Correct: The default integer data type is int and real data type is double 19. How many numeric data types are supported in Java? Correct: 6 20. Which of the following statements declare class Sample to belong to the payroll.admindept package? Correct: package payroll.admindept; 21. The class java.lang.Exception is You answered: serializable

Incorrect Correct answer: extends Throwable 22. Which of the following statements is true? You answered: An exception can be thrown by throws keyword explicitly. Incorrect Correct answer: An exception can be thrown by throw keyword explicitly. 23. All the wrapper classes (Integer, Boolean, Float, Short, Long, Double and Character) in java Correct : are final 24. The code snippet if( "Welcome".trim() == "Welcome".trim() ) System.out.println("Equal"); else System.out.println("Not Equal"); will You answered: compile and display NULL Incorrect Correct answer: cause a compiler error 25. Consider the following code snippet. What will be assigned to the variable fourthChar, if the code is executed? String str = new String(Java); char fourthChar = str.charAt(4); You answered: null characater Incorrect Correct answer: throws StringIndexOutofBoundsException 26. Which of the following statements is preferred to create a string "Welcome to Java Programming"? You answered: String str; str = new String (Welcome to Java Programming ) Incorrect Correct answer: String str = Welcome to Java Programming

27. Which of the following statements is true? You answered: the class Class is the super class of all other classes in Java. Incorrect Correct answer: A super class is a sub set of a sub class 28. What kind of thread is the Garbage collector thread is? You answered: None of the above Incorrect Correct answer: Daemon thread 29. When a thread terminates its processing, into what state that thread enters? You answered: Beginning state Incorrect Correct answer: Dead state 30. Which statement is true? You answered: Vector is a subclass of Stack Incorrect Correct answer: HashTable is a sub class of Dictionary 31. Which of these statements is true? You answered: WeakHashMap extends HashMap Incorrect Correct answer: HashSet extends AbstractSet 32. Which of the following is synchronized? You answered: WeakHashMap Incorrect Correct answer: Vector 33. Select all the true statements from the following. Correct: All of the above (abstractSet, abstractList, Hashset, vector) 34. Which of the methods should be implemented if any class implements the Runnable interface? You answered: notify() and notifyAll() Incorrect

Correct answer: run() 35. A thread which has invoked wait() method of an object, still owns the lock of the object. Is this statement true or false? Correct: False 36. Which of the following is not a method of the Thread class. You answered: public final int getPriority() Incorrect Correct answer: public void exit() 37. To execute the threads one after another You answered: None of the above Incorrect Correct answer: the keyword synchronizable is used 38. The object of DataInputStream is used to You answered: All of the above Incorrect Correct answer: To covert binary stream into character stream 39. DataInputStream is an example of You answered: File stream Incorrect Correct answer: Filtered stream

PART 2: 1. ____________ method of java is invoked by JVM to reclaim the inaccessible memory location You answered: Both b and c Incorrect Correct answer: finalize() 2. Does equals() method and == do the same thing in Java? Correct: No 3. What are field variables? You answered: Variable that is declared as a member of a class Incorrect Correct answer: Both b and d 4. What is the difference between throw and throws? Correct: The throw key word is used to explicitly throw an exception, while throws is utilized to handle checked
exceptions

5. Which of the following below is FALSE for abstract class? You answered: A class can extend only one abstract class Incorrect Correct answer: An abstract class can have only abstract methods 6. ____________ allows java code to run in the JVM to call and be called by native applications You answered: FJI Incorrect Correct answer: JNI 7. Which of the following is TRUE for serialization in JAVA? Correct: operation in which an objects internal state is converted into a stream of bytes 8. Which of the following below are valid isolation levels in J2EE? You answered: TRANSACTION_SERIALIZABLE_COMMIT Incorrect Correct answer: Both a and c 9. Session beans are created by the client submitting the query to the database You answered: False Incorrect

Correct answer: True 10. Which of the following is false for stateless session beam? Correct: they are slow 11. Which of the below are create method(s) for Entity bean? You answered: ejbPostCreate() Incorrect Correct answer: Both b and d 12. There is no default transaction attribute for an EJB. Correct:true 13. We can use Extend Thread class only when the class ____________ extending another class Correct: is not 14. ____________ means each method in a multithreaded environment doesnt access data by multiple threads at the same time. You answered: Thread lock Incorrect Correct answer: Thread safety 15. ______________ is a command that disassembles a class file Correct: javap 16. What is the purpose of code attribute of applet tags? You answered: Defines the horizontal spacing around the applet Incorrect Correct answer: A URL that points to the class of the applet 17. BY restricting the state change of a class object, I can make a class immutable? Correct: yes 18. Which of the following below are abilities of Reflection API in Java? Correct: Determination of the class of an object 19. ____________ are utilized to control the access to an object especially in multi threaded programming You answered: Both a and c Incorrect

Correct answer: Synchronized methods 20. In Runnable, many threads share the same object instance. You answered: False Incorrect Correct answer: True 21. What is the difference between java beans and EJB? You answered: Java beans are reusable components that can be used for customized user objects while EJB are reusable components that are developed to comply with enterprise specification adhering to setter and getter methods with no public constructor. Incorrect Correct answer: Java beans are reusable components that can be used for customized user objects while EJB are reusable components that are developed to comply with enterprise specification adhering to setter and getter methods and one public constructor. 22. Java beans have no types. You answered: False Incorrect Correct answer: True 23. The inner class can access private members of the outer class Correct: true 24. ____________ allow primitive data types to be accessed as objects Correct: Wrapper class 25. The Dictionary class is ______________ class You answered: both a and c Incorrect Correct answer: abstract 26. A ResourceBundle is a group of related sub classes which are _____________ Correct: sharing same base name 27. Which of the following is false for vector class? You answered: The size of a Vector increases or decreases as needed to accommodate the items. Incorrect

Correct answer: The size of a Vector is static 28. The System class can be instantiated Correct: false 29. What is the difference between this() and super() You answered: this() constructor is invoked within a method of a class while super() constructor is used outside the constructor of the sub class Incorrect Correct answer: this() constructor is invoked within a method of a class while super() constructor is used within the constructor of the sub class 30. Which of the following below is true for StringBuffer? Correct:Stringbuffer is thread safe 31. For an interface class, All methods in an interface must not have abstract access modifier You answered: False Incorrect Correct answer: True 32. ____________ compiler coverts a byte code of one operating system to the current operating systems executable code You answered: JVM Incorrect Correct answer: JJT 33. Does Java support multiple inheritance? You answered: Yes Incorrect Correct answer: No 34. The __________ describes the behavior of converting a named class into the bits responsible for implementing that class. You answered: bit class Incorrect Correct answer: class loader 35. In ______________ we clone the object and their constituent parts. Correct: Deep cloning 36. _____________ can be used to control the order of certain data

structures and collection of objects too. You answered: All of above Incorrect Correct answer: Comparators 37. Private Constructors can't be access from any derived classes neither from another class You answered: False Incorrect Correct answer: True 38. Which of the following is false for Static Initializers? Correct: both a ,b
A static initializer block resembles a method with a name, arguments, and return type They need to be referred from outside the class definition.

39. _____________ is the process of converting a primitive type data into its corresponding wrapper class object instance. Correct: autoboxing 40. The Externizable interface extends the serializable interface. You answered: False Incorrect Correct answer: True

Applet: 1. Which one of the following is a valid declaration of an applet? Correct: public class MyApplet extends java.applet.Applet { 2. AppletViewer tool is available in which of the folder of JDK You answered: class Incorrect Correct answer: bin 3. Which is the method that starts the applet? You answered: repaint() Incorrect Correct answer: init() 4. To determine the width and height of an application, which of the following method is used? You answered: setHeightWidth() Incorrect Correct answer: getSize() 5. The means by which the browser and the applet communicates is You answered: AppletWindow interface Incorrect Correct answer: AppletStub interface 6. What tags are mandatory when creating HTML to display an applet? Correct: code, height, width 7. What are the Applets life cycle methods? You answered: init(), start() and stop() Incorrect Correct answer: init(), start(), paint(). stop() and destroy() 8. All Applets must import java.applet and java.awt. You answered: False Incorrect Correct answer: True 9. What are the interfaces to deal with Applet applications?

You answered: AppletConfit,AppletStub, VideoClip Incorrect Correct answer: AppletContext, AppletStub, AudioClip 10. What is the color of the line, which is drawn by the following code snippet? grph.setColor(Color.red.green.yellow.red.cyan); grph.drawLine(0, 0, 100,100); Correct: cyan 11. The implementation-specific properties like ascent, descent of a font object is implemented by You answered: Graphics class Incorrect Correct answer: FontMetrics class 12. Which of the following objects are input to the paint() method? You answered: Image Incorrect Correct answer: Graphics 13. Which of the following methods set the frame surface color to pink? You answered: None of the above Incorrect Correct answer: setBackground(Color.pink); 14. How to create TextArea with 80 character-width wide and 10 character-height tall? Correct: new TextArea(10, 80) 15. What is the immediate super class of Applet class? You answered: Component Incorrect Correct answer: Panel 16. Which Component method is used to access a component's immediate Container? You answered: getContainer() Incorrect Correct answer: getParent()

17. Which of the following creates a List with 3 visible items and multiple selection disabled? You answered: new List(false,3) Incorrect Correct answer: new List(3, false) 18. Window, Panel and ScrollPane are the subclasses of You answered: None of the above Incorrect Correct answer: Container class 19. Which of the following components allow multiple selections? You answered: Text Boxes Incorrect Correct answer: Non-exclusive Checkboxes 20. Which layout is used as their default layout by Window, Frame and Dialog classes? You answered: GridLayout Incorrect Correct answer: BorderLayout

S-ar putea să vă placă și