All Matches
Solution Library
Expert Answer
Textbooks
Search Textbook questions, tutors and Books
Oops, something went wrong!
Change your search query and then try again
Toggle navigation
FREE Trial
S
Books
FREE
Tutors
Study Help
Expert Questions
Accounting
General Management
Mathematics
Finance
Organizational Behaviour
Law
Physics
Operating System
Management Leadership
Sociology
Programming
Marketing
Database
Computer Network
Economics
Textbooks Solutions
Accounting
Managerial Accounting
Management Leadership
Cost Accounting
Statistics
Business Law
Corporate Finance
Finance
Economics
Auditing
Ask a Question
Search
Search
Sign In
Register
study help
computer science
java programming 8th
Questions and Answers of
Java Programming 8th
Which of these parameter lists can be found in a constructor of the StringBuilder class?Select the four correct answers.(a) ()(b) (int capacity)(c) (char[] data)(d) (String str)(e) (CharSequence
Which of the following methods is not defined in the StringBuilder class?Select the one correct answer.(a) trim()(b) length()(c) append(String)(d) reverse()(e) setLength(int)
What will the following program print when run?Select the one correct answer.(a) The program will print false true.(b) The program will print false false.(c) The program will print true false.(d) The
What will the following program print when run?Select the one correct answer.(a) The program will print false true.(b) The program will print false false.(c) The program will print true false.(d) The
What will the following program print when run?Select the one correct answer.(a) The program will print WW!.(b) The program will print WOW!.(c) The program will print W.(d) The program will print
Which of the following statements is true?Select the one correct answer.(a) Objects can be explicitly destroyed using the keyword delete.(b) An object will be garbage collected immediately after it
Identify the location in the following program where the object, initially referenced by arg1, is eligible for garbage collection.Select the one correct answer.(a) After the line labeled (1)(b) After
How many objects are eligible for garbage collection when control reaches (1)?Select the one correct answer. (a) 0 (b) 5 (c) 10 (d) Hard to say public class Eligible { public static void
How many objects are eligible for garbage collection when control reaches (1)?Select the one correct answer.(a) 0 (b) 5 (c) 10 (d) Hard to say public class Link ( private Link next; Link (Link next)
Which of the following statements is true?Select the one correct answer.(a) If an exception is thrown during execution of the finalize() method of an eligible object, the exception is ignored and the
Which of the following statements is true?Select the one correct answer.(a) The compiler will fail to compile code that explicitly tries to call the finalize() method.(b) The finalize() method can be
Which method headers will result in a correct implementation of a finalizer for the following class?Select the two correct answers.(a) void finalize() throws Throwable(b) void finalize() throws
Which scenario can definitely not be the result of compiling and running the following program?Select the one correct answer. (a) The program may print AF. (b) The program may print FA. (c) The
Which scenarios can be the result of compiling and running the following program?Select the two correct answers.(a) The program may print AB.(b) The program may print BA.(c) The program may print
Given the following class, which of these static initializer blocks can be independently inserted at (1)?Select the three correct answers.(a) static { alive = true; count = 0; }(b) static { STEP =
What will be the result of compiling and running the following program?Select the one correct answer.(a) The code will fail to compile, because of the instance initializer block.(b) The code will
Given the following class, which instance initializer block inserted independently at (1) will allow the class to be compiled?Select the one correct answer.(a) instance { active = true; }(b)
What will be the result of compiling and running the following program?Select the one correct answer.(a) The program will fail to compile.(b) The program will compile, and print 1, 2, and 3 at
Which of the labeled lines in the following code can be independently uncommented by removing the // characters, such that the code will still compile?Select the two correct answers.(a) Line A (b)
Which statement is true about the java.util.ArrayList class?Select the one correct answer.(a) The method delete() can be used to delete an element at a specific index in an ArrayList.(b) The method
What will the following program print when compiled and run?Select the one correct answer.(a) The program will not compile.(b) The program will throw an IndexOutOfBoundsException at runtime.(c) The
What will the following program print when compiled and run?Select the two correct answers.(a) (1) will print [Anna, Ada, Bob, null].(b) (1) will print [Anna, adA, Bob, null].(c) (2) will print
What will the following program print when compiled and run?Select the one correct answer.(a) The program will not compile.(b) The program will throw an IndexOutOfBoundsException at runtime.(c) The
What will the following program print when compiled and run?Select the one correct answer.(a) The program will not compile.(b) The program will throw an IndexOutOfBoundsException at runtime.(c) The
What will the following program print when compiled and run?Select the one correct answer.(a) The program will not compile.(b) The program will throw a NullPointerException at runtime.(c) The program
Which statement is true about functional interfaces and lambda expressions?Select the one correct answer.(a) A functional interface can be implemented only by lambda expressions.(b) A functional
Which statements are true about the following code?Select the two correct answers.(a) (1) will not compile.(b) (2) will not compile.(c) (3) will not compile.(d) (4) will not compile.(e) (5) will not
Which statements are true about the following code?Select the four correct answers.(a) (1) will not compile.(b) (2) will not compile.(c) (3) will not compile.(d) (4) will not compile.(e) (5) will not
Which statement is true about the following program?Select the one correct answer.(a) The program will not compile.(b) The program will compile, but will throw an exception when run.(c) The program
Which statement is true about the following code?Select the one correct answer.(a) The program will not compile.(b) The program will throw a ClassCastException.(c) The program will print:
Which statement is true about the Date and Time API?Select the one correct answer.(a) The classes LocalDate and LocalDateTime provide the isLeapYear() method to check for a leap year.(b) The classes
What will the following program print when compiled and run?Select the one correct answer.(a) The program will not compile.(b) The program will throw a runtime exception when run.(c) The program will
Which declarations will correctly create the date 13 August 2009?Select the four correct answers.(a) LocalDate date0 = LocalDate.of(2009, 7, 13);(b) LocalDate date1 = LocalDate.of(2009, 8, 13);(c)
Which declarations will correctly assign an instance of the LocalTime class tothe declared reference?Select the three correct answers.(a) LocalTime time1 = LocalTime.of(12, 60);(b) LocalTime time2 =
What will the following program print when compiled and run?Select the one correct answer.(a) The program will not compile.(b) The program will throw a runtime exception when run.(c) The program will
What will the following program print when compiled and run?Select the one correct answer.(a) The program will not compile.(b) The program will throw a runtime exception when run.(c) The program will
What will the following program print when compiled and run?Select the one correct answer.(a) The program will not compile.(b) The program will throw a runtime exception when run.(c) The program will
Which expressions, when inserted at (1), will result in the following output:date2 is after date1?Select the five correct answers.(a) date2.isAfter(date1)(b) date1.isAfter(date2)(c)
Which statement is true about formatting and parsing of temporal objects?Select the one correct answer.(a) The DateTimeFormatter class provides only factory methods to obtainpredefined formatters.(b)
Which code, when inserted at (1), will make the program compile and executenormally?Select the four correct answers.(a) LocalTime time = LocalTime.parse(inputStr, dtf);(b) LocalDate date =
Which code, when inserted at (1), will make the program compile and executenormally?Select the three correct answers.(a) LocalTime time = LocalTime.parse(inputStr, dtf);(b) LocalDate date =
Which code, when inserted at (1), will result in the following output:Select the one correct answer.(a) String pattern = "m' minutes past 'h";(b) String pattern = "M' minutes past 'h";(c) String
Which code, when inserted at (1), will make the program compile and executenormally?Select the one correct answer.(a)(b)(c)(d) None of the above. import java.time.LocalDate; import
Which statement is true about methods?Select the one correct answer.(a) A method is an implementation of an abstraction.(b) A method is an attribute defining the property of a particular
Which statement is true about objects? Select the one correct answer. (a) An object is what classes are instantiated from. (b) An object is an instance of a class. (c) An object is a blueprint for
Which is the first line of a constructor declaration in the following code?Select the one correct answer.(a) (1)(b) (2)(c) (3)(d) (4)(e) (5)(f) (6) public class Counter { int current, step; public
Given that Thing is a class, how many objects and how many references are created by the following code?Select the two correct answers.(a) One object is created.(b) Two objects are created.(c) Three
Which statement is true about instance members?Select the one correct answer.(a) An instance member is also called a static member.(b) An instance member is always a field.(c) An instance member is
How do objects communicate in Java?Select the one correct answer.(a) They communicate by modifying each other’s fields.(b) They communicate by modifying the static variables of each other’s
Given the following code, which statements are true?Select the two correct answers. (a) Class A extends class B. (b) Class B is the superclass of class A. (c) Class A inherits from class B. (d)
Given the following code, which statements express the most accurate association?Select the three correct answers.(a) A Train object has an array of Carriage objects.(b) A Train object owns an array
Which command from the JDK should be used to compile the following source code contained in a file named SmallProg.java?Select the one correct answer.(a) java SmallProg(b) javac SmallProg(c) java
Which command from the JDK should be used to execute the main() method of a class named SmallProg?Select the one correct answer.(a) java SmallProg(b) javac SmallProg(c) java SmallProg.java(d) java
Which statement is true about Java?Select the one correct answer.(a) A Java program can be executed by any JVM.(b) Java bytecode cannot be translated to machine code.(c) Only Java programs can be
Which of the following is not a legal identifier?Select the one correct answer.(a) a2z(b) ödipus(c) 52pickup(d) _class(e) ca$h(f) _8to5
Which of the following are not legal literals in Java?Select the four correct answers.(a) 0Xbad(b) 0B_101_101(c) 09(d) +_825(e) 1_2e4f(f) '\x'(g) "what\'s your fancy?"
Which statement is true?Select the one correct answer.(a) new and delete are keywords in the Java language.(b) try, catch, and thrown are keywords in the Java language.(c) static, unsigned, and long
Which of the following is not a legal comment in Java?Select the one correct answer.(a) /* // */(b) /* */ //(c) // /* */(d) /* /* */(e) /* /* */ */(f) // //
Which of the following do not denote a primitive data value in Java?Select the two correct answers.(a) "t"(b) 'k'(c) 50.5F(d) "hello"(e) false
Which of the following primitive data types are not integer types?Select the three correct answers.(a) boolean(b) byte(c) float(d) short(e) double
Which integral type in Java has the exact range from -2147483648 (i.e., -231) to 2147483647 (i.e., 231-1), inclusive?Select the one correct answer.(a) byte(b) short(c) int(d) long(e) char
Which of the following declarations are valid?Select the three correct answers.(a) char a = '\u0061';(b) char 'a' = 'a';(c) char \u0061 = 'a';(d) ch\u0061r a = 'a';(e) ch'a'r a = 'a';
Given the following code within a method, which statement is true?int i, j;j = 5;Select the one correct answer.(a) Local variable i is not declared.(b) Local variable j is not declared.(c) Local
In which of these variable declarations will the variable remain uninitialized unless it is explicitly initialized?Select the one correct answer.(a) Declaration of an instance variable of type int(b)
What will be the result of compiling and running the following program?Select the one correct answer.(a) The program will fail to compile.(b) The program will compile, and print
Which one of these declarations is a valid method declaration?Select the one correct answer.(a) void method1 { /* ... */ }(b) void method2() { /* ... */ }(c) void method3(void) { /* ... */ }(d)
Which statements, when inserted at (1), will not result in compile-time errors?Select the three correct answers.(a) i = this.planets;(b) i = this.suns;(c) this = new ThisUsage();(d) this.i = 4;(e)
Given the following pairs of method declarations, which statements are true?Select the two correct answers.(a) The first pair of methods will compile, and overload the method name fly.(b) The second
Given a class named Book, which one of these constructor declarations is valid for the class Book?Select the one correct answer.(a) Book(Bookb) {}(b) Book Book() {}(c) private final Book() {}(d) void
Which statements are true?Select the two correct answers.(a) A class must define a constructor.(b) A constructor can be declared private.(c) A constructor can return a value.(d) A constructor must
What will be the result of compiling the following program?Select the one correct answer.(a) A compile-time error will occur at (1).(b) A compile-time error will occur at (2).(c) A compile-time error
Given the following declaration, which expression returns the size of the array, assuming that the array reference has been properly initialized?int[] array;Select the one correct answer.(a)
Is it possible to create arrays of length zero?Select the one correct answer.(a) Yes, you can create arrays of any type with length zero.(b) Yes, but only for primitive data types.(c) Yes, but only
Which one of the following array declaration statements is not legal?Select the one correct answer.(a) int []a[] = new int [4][4];(b) int a[][] = new int [4][4];(c) int a[][] = new int [][4];(d) int
Which of these array declaration statements are not legal? Select the two correct answers. (a) int[] i[] = { { 1, 2 }, { 1 }, {}, { 1, 2, 3 } }; (b) int i[] = new int[2] {1, 2}; (c) int i[][] = new
What would be the result of compiling and running the following program?Select the one correct answer.(a) The code will not compile, because the array type int[] is incorrect.(b) The program will
What would be the result of compiling and running the following program?Select the one correct answer.(a) The program will fail to compile because of uninitialized variables.(b) The program will
What will the following program print when run?Select the one correct answer.(a) 0 (b) 1 (c) 2 (d) 3 public class ParameterPass { public static void main(String[] args) { int i = 0; addTwo (i++);
What will be the result of compiling and running the following program?Select the one correct answer.(a) The code will fail to compile, since x[0]++; is not a legal statement.(b) The code will
Which statements, when inserted at (1), will result in a compile-time error?Select the two correct answers.(a) a++;(b) b++;(c) b = a;(d) c[0]++;(e) d[0]++;(f) c = d; public class ParameterUse {
Which of the following method declarations are valid declarations?Select the three correct answers.(a) void compute(int… is) { }(b) void compute(int is…) { }(c) void compute(int… is, int i,
Given the following code:Which method call, when inserted at (1), will not result in the following output from the program:Object…: 9 Select the one correct answer.(a) print("9", "1", "1");(b)
Given the source file A.java:Select the two correct answers. (a) Both class A and class B will be placed in the package net.alphabet. (b) Only class A will be placed in the package net.alphabet.
Which import statement, when inserted independently at (1), will make the code compile?Select the one correct answer. (a) import app.*; (b) import app.Window; (c) import java.lang.*; (d) import
Which import statements, when inserted independently at (1), will make the code compile?Select the four correct answers.(a) import mainpkg.*;(b) import mainpkg.subpkg1.*;(c) import
Given the following code:Which import statements, when inserted independently at (1), will make the program print 7, when the program is compiled and run? Select the two correct answers. (a) import
Given the source file A.java:and the following directory hierarchy:Assuming that the current directory is /proj/src, which of the following statements are true? Select the three correct answers.(a)
Given the following directory structure:Assume that the two files A.java and B.java contain the following code, respectively:For which combinations of current directory and command is the compilation
Given the following directory structure:Assume that the current directory is /proj/src. Which class path specifications will find the file A.class of the class top.sub.A declared in the file
Given the following class, which of these alternatives are valid ways of referring to the class from outside of the package net.basemaster?Select the two correct answers.(a) By simply referring to
Which one of the following class declarations is a valid declaration of a class that cannot be instantiated?Select the one correct answer.(a) class Ghost { abstract void haunt(); }(b) abstract class
Which one of the following class declarations is a valid declaration of a class that cannot be extended?Select the one correct answer.(a) class Link { }(b) abstract class Link { }(c) native class
Given the following declaration of a class, which field is accessible from outside the package com.corporation.project?Select the one correct answer.(a) Field i is accessible in all classes in other
How restrictive is the default accessibility compared to public, protected, and private accessibility?Select the one correct answer(a) Less restrictive than public(b) More restrictive than public,
Which statement is true about the accessibility of members?Select the one correct answer.(a) A private member is always accessible within the same package.(b) A private member can be accessed only
Which lines that are marked will compile in the following code?Select the five correct answers.(a) (1)(b) (2)(c) (3)(d) (4)(e) (5)(f) (6)(g) (7)(h) (8)(i) (9)(j) (10)(k) (11)(l) (12) // File name:
Which statements about the use of modifiers are true?Select the two correct answers.(a) If no accessibility modifier (public, protected, or private) is specified for a member declaration, the member
Given the following source code, which comment line can be uncommented without introducing errors?Select the one correct answer.(a) (1)(b) (2)(c) (3)(d) (4) abstract class MyClass { abstract void
Which statement is true?Select the one correct answer.(a) A static method can call other non-static methods in the same class by using the this keyword.(b) A class may contain both static and
Which one of these is not a legal member declaration within a class?Select the one correct answer.(a) static int a;(b) final Object[] fudge = { null };(c) abstract int t;(d) native void sneeze();(e)
Showing 100 - 200
of 332
1
2
3
4