Find Us On: Facebook Twitter Rss Feed Blog
Need To Register? Sign Up Login

Java Multiple Choice Questions

x3Carrie
x3Carrie 


Question 1 The keyword extends indicates polymorphism. True False Question 2 The class ObjectOutputStream contains all of the following methods except: writeLine() writeChar() writeObject() writeInt() Question 3 Activation records are used to implement recursion. True False Question 4 You must implement the Serializable interface to be able to use the readObject() method of the class ObjectOutputStream. True False Question 5 Private methods of the base class are not available for use by derived classes. True False Question 6 Files whose contents must be handled as sequences of binary digits are called: text files ASCII files binary files output files Question 7 The FileNotFound Exception is a descendant of the class IOException True False Question 8 The nth harmonic number is defined non-recursively as: 1 +1/2 + 1/3 + 1/4 + ... + 1/n. Which of the following represents the 4th harmonic number? Answer (1/24) (12+6+4+3)/12 (4/24) (25/12) 2.08333 Question 9 Static variables are often used: in arithmetic expressions to communicate between objects within looping structures all of the above Question 10 What is the correct expression for accessing the 5th element in an array name colors? colors[3] colors[4] colors[5] colors[6] Question 11 Text files store data in the same format that is used by any common text editor. True False Question 12 The File class contains methods that allow you to check various properties of a file. Answer True False Question 13 The use of two methods with the same name is called overloading. True False Question 14 A recursive solution can be preferable to an iterative solution because: Answer recursive method calls are faster than iterative looping recursive solutions may be easier to understand than iterative ones recursion uses less memory than iteration iteration should be avoided. Question 15 An array's length instance variable's value can be changed by a program. Answer True False Question 16 A derived class is also called a Answer sub class super class base class all of the above Question 17 A try statement must have at least one catch statement, but could have many catch statements, and may or may not have a finally clause. True False Question 18 When using the Scanner class one should account for a/an: NumberFormatException InputMismatchException ArrayIndexOutOfBoundsException PowerFailureException Question 19 You cannot derive an interface from a base interface. True False Question 20 The output stream connected to the computer screen is: System.exit System.quit System.in System.out Question 21 Regarding recursion, if a base case is never reached the result is: infinite recursion iteration termination all of the above Question 22 The Exception class belongs to the package: Answer java.io java.util java.lang java.except Question 23 The methods of the Scanner class do not behave the same when reading from a text file as they do when used to read from the keyboard. True False Question 24 Wrapper classes also contain a number of useful predefined constants and methods. True False Question 25 Inheritance refers to a very specialized form of a class. True False Question 26 Which of the following initializer lists correctly initializes the indexed variables of an array name myDoubles? double myDoubles[double] = {0.0, 1.0, 1.5, 2.0, 2.5} double myDoubles[5] = {0.0, 1.0, 1.5, 2.0, 2.5} double[] myDoubles = {0.0, 1.0, 1.5, 2.0, 2.5} array myDoubles[double] = {0.0, 1.0, 1.5, 2.0, 2.5} Question 27 You can not place a try block and its following catch blocks inside a larger try block or inside a larger catch block. True False Question 28 Binary files can be handled more efficiently than text files. True False Question 29 The subscript of the first indexed variable in an array is: 0 1 2 3 Question 30 A condition that allows a programmer to circumvent the private modifier and changed the private instance variable is called: a copy constructor a privacy leak a class invariant an anonymous object Question 31 The correct syntax for passing an array as an argument in a method is: a[] a() a a[0]..a[a.length] Question 32 A collection of classes grouped together into a folder could be used to create a: import package method comment Question 33 The method trim of the String class trims off Leading white space Trailing white space Leading and trailing white space Blanks Question 34 An interface and all of its method headings are normally declared to be: Answer public private protected package access Question 35 An instance variable (or method) that is private in a base class is accessible by name in the definition of a method in any other class. True False Question 36 The call to the base class constructor (super) must always be the last action taken in a constructor definition. True False Question 37 While the Exception class is part of java.lang, IOException is part of java.io. True False Question 38 The catch block has _____ parameters. zero one two three Question 39 To use a package, the program must contain an import statement that names the package. True False Question 40 A(n) _____ allows data to flow from your program. input stream output stream file name all of the above Question 41 The special syntax for invoking a constructor of the base class is: super() base() parent() child() Question 42 Inheritance is the process by which a new class - known as a _____ - is created from another class, called the _____. base class, derived class derived class, base class inherited class, base class base class, inherited class Question 43 All recursive methods must have a/an: starting case intermediate case stopping case none of the above Question 44 The preferred stream classes for processing text files are PrintWriter and Scanner. Answer True False Question 45 During recursion, if the stack attempts to grow beyond its limit, a _____________ occurs. Answer Stack underflow Stack overflow Recursive underflow Recursive overflow Question 46 When a recursive call is encountered, computation is temporarily suspended; all of the information needed to continue the computation is saved and the recursive call is evaluated. True False Question 47 An object of a derived class has the type of the derived class, and it also has the type of the base class, and more generally, has the type of every one of its _____ classes. descendent child ancestor sub Question 48 Try blocks contain code that could possibly: handle an exception throw an exception catch an exception display an exception Question 49 The class ObjectOutputStream contains all of the following methods except: writeInteger() writeDouble() writeFloat() close() Question 50 A class may only implement one interface. True False Please hurry. I'm willing to increase the price. Attachments
Tags Clarifications

Answers

Java Questions answered

SW_wizard
SW_wizard 



I have attached the doc file containing all answers Attachments
answers.txt (1 K) Download Preview
simple text editor.) 12. true 13. true 14. recursive solutions may be easier to understand than iterative ones 15. false 16. sub class 17. true 18. input mismatch 19. true 20. system.out 21. infinite recursion 22. java.lang 23. false 24. true 25. true 26. double[] myDoubles

answersToQuiz.docx (14 K) Download
Screenshots
Purchase Answer

Some corrections to above answers

SW_wizard
SW_wizard 



Buy above answers and make following corrections which makes it perfect 100 %.

Question 4 : True
Question 8 : 25/12
Question 9 : to communicate between objects
Question 25 : False
Question 30 : Privacy leak
Attachments
Screenshots
Purchase Answer