Sei sulla pagina 1di 6

www.einterviewquestions.

com
1. The Java interpreter is used for the execution of the source code. A. True B. False 2. On successful compilation a file with the class extension is created. A. True B. False 3. The Java source code can be created in a Notepad editor. A. True B. False 4. The Java Program is enclosed in a class definition. A. True B. False 5. Which of the following is TRUE? A. B. C. D. A. In java, an instance field declared public generates a compilation error. B. int is the name of a class available in the package java.lang C. Instance variable names may only contain letters and digits. D. A class has always a constructor (possibly automatically supplied by the java compiler). E. E. The more comments in a program, the faster the program runs. 6. Consider the following code snippet String river = new String(Columbia); System.out.println(river.length()); What is printed? A. 6 B. 7 C. 8 D. Columbia E. riverCSC142 7. A constructor A. must have the same name as the class it is declared within. B. is used to create objects. C. may be declared private D. A and B E. A, B and C 8. Which of the following may be part of a class definition? A. instance variables B. instance methods C. constructors

1|Page

www.einterviewquestions.com
D. all of the above E. none of the above 9. What is different between a Java applet and a Java application? A. An application can in general be trusted whereas an applet can't. B. An applet must be executed in a browser environment. C. An applet is not able to access the files of the computer it runs on D. (A), (B) and (C). E. None of the above 10. Consider public class MyClass{ public MyClass(){/*code*/} // more code... } To instantiate MyClass, you would write?

A. MyClass mc = new MyClass(); B. MyClass mc = MyClass(); C. MyClass mc = MyClass; D. MyClass mc = new MyClass; E. It can't be done. The constructor of MyClass should be defined as public void MyClass(){/*code*/}

11. What is byte code in the context of Java? A. The type of code generated by a Java compiler B. The type of code generated by a Java Virtual Machine C. It is another name for a Java source file D. It is the code written within the instance methods of a class. E. It is another name for comments written within a program. CSC142 Quiz 1 3

12. What is garbage collection in the context of Java? A. The operating system periodically deletes all of the java files available on the system. B. Any package imported in a program and not used is automatically deleted. C. When all references to an object are gone, the memory used by the object is automatically reclaimed. D. The JVM checks the output of any Java program and deletes anything that doesnt make sense. E. Janitors working for Sun MicroSystems are required to throw away any Microsoft documentation found in the employees' offices.

2|Page

www.einterviewquestions.com

13. You read the following statement in a Java program that compiles and executes submarine.dive(depth); What can you say for sure? A. depth must be an int B. dive must be a method. C. dive must be the name of an instance field. D. submarine must be the name of a class E. submarine must be a method. 14. The symbol ! in java means? A. B. C. D. Logical NOT Logical OR Logical XOR AND

15. Which is the first web browser developed in Java? A. B. C. D. Internet Explorer Netscape Navigator Opera HotJava

16. What defines how the components will be arranged in a container? A. B. C. D. Layout Manager Tool Manager None of these Both

17. The ability of an Java application to perform multiple tasks at the same time is called? A. B. C. D. Multiprogramming Multithreading Multiprocessing Multitasking

18. Which one below is the first graphical browser? A. B. C. D. Mosaic Opera Google Chrome None of these

19. Which is the process of converting typed code to machine code? A. Compilation B. Interpretation C. Assembling

3|Page

www.einterviewquestions.com
D. None of these 20. What consist of data and methods? A. B. C. D. Variable Class Vectors None of these

21. What are the classes are derived from Throwable class? A. B. C. D. Error and Exception Try and catch Throw and throwable All the above

22. Which one below is one of the features of object oriented programming that allows the creation of hierarchical classifications? A. B. C. D. inheritance polymorphism dynamic binding virtual binding

23. Which symbol denotes the current working directory? A. B. C. D. . (dot) #(hash) / (front-slash) None of these

24. The Java language is A. B. C. D. Interpreted language Compiled to obtain executable target files. Both Interpreted and Compiled Designed for matrix algorithm processing.

25. The Java language is designed to A. B. C. D. Run on a simulated Java machine. Run directly on Intel microprocessors. Designed for RISC computing architectures. Designed for CISC computing architectures.

26. The Java language will run A. B. C. D. On any computer where the Java simulated machine is installed. On any computer attached to the Internet. On any computer with a Web browser installed. On any computer which will also run C++.

4|Page

www.einterviewquestions.com

27. The Java language provides the programmer with A. B. C. D. No ability to access or manipulate memory. Protected access to machine memory. Dynamically created data structures linked with pointers. Access to the memory of a local machine through a network.

28. The Java language is A. B. C. D. An object oriented programming language. A structured programming language. A procedural programming language. A stack oriented programming language.

29. The Java language was designed A. B. C. D. To create event driven programs with graphical interfaces. To unify all different approaches to object orientation. To provide a learning tool for beginning programmers. To force programmers to implement all needed program elements themselves.

30. The Java language has most in common with the following language A. B. C. D. C#. C. C++. Basic.

31. The basis for object oriented programming can be found in which of the following? A. B. C. D. All of the items listed. It is an outgrowth of the availability of powerful hardware. It is useful in the development of graphical user interfaces. It solved some of the problems associated with structured programming.

32. That unit of code in Java that contains the specifications for objects is A. B. C. D. A class. A method. An instance variable. A constructor.

5|Page

www.einterviewquestions.com
33. Java programs have to be saved with the following extension: A. B. C. D. .java .txt .doc .xls

34. In Java programs, the name of the class has to: E. F. G. H. Be the same as the name of the file it is saved in. Be different from the name of the file it is saved in. Be all capital letters. Be all small letters.

6|Page

Potrebbero piacerti anche