Question
The most important advantage of high-level languages, like Java, over Assembly language is that Compilers are cheaper than assemblers High-level language code usually runs faster
-
The most important advantage of high-level languages, like Java, over Assembly language is that
Compilers are cheaper than assemblers High-level language code usually runs faster than Assembly code for the same algorithms Programmers are more productive using high-level languages than Assembly Code written in high-level languages usually uses less memory than code written in Assembly
-
Which statement regarding lists and/or arrays is true?
The size of a list is always determined at compile time The size of an array is always determined at compile time An array has a fixed size once it is instantiated but the size of a list can be changed A list has a fixed size once it is instantiated but the size of an array can be changed Both lists and arrays have fixed sizes once instantiated
-
Which statement regarding lists is true?
A list of objects of a particular type may contain objects of classes that subclass or implement that type A list of objects of a particular type may contain objects of superclasses of that type A list may not be parameterized by an abstract class A list may not be parameterized by an interface It is possible to create a list of type int
-
Which statement regarding lists is true?
The size of a list must be stated in the list declaration The parameterizing type can be changed after a list is instantiated A list must be declared and instantiated in the same statement A list may not be declared and instantiated in one statement A list may be instantiated with 0 elements
-
Consider the following code from the Java class Demo:
public static void main(String[] args){
Demo d = new Demo(); int firstInt = getAnInt(); int secondInt = d.getAnotherInt();
[more code omitted]
Which of the following statements is true?
Both getAnInt() and getAnotherInt() are static methods Neither getAnInt nor getAnotherInt() are static methods getAnInt() is static and getAnotherInt() is not static getAnotherInt() is static and getAnInt() is not static It cannot be determined from this information whether either or both of these methods are static
-
Consider the following code from the Java class Demo:
private double getDouble(){ return 5; } public static void main(String[] args){ double d = getDouble(); }
This code generates an Eclipse error message that reads "Cannot make a static reference to the non-static method getDouble() from the type Demo." The best solution is probably to:
Remove the static keyword form the signature of main() Instantiate a Demo and call getDouble() on it Make d a static variable make getDouble() a final method rewrite getDouble() to use only static variables
-
In OOP, it is common to write classes with private data and only provide methods that allow external access to the data in the specific ways that the class' programmer wants to provide. This is consistent with a principle of OOP called
Immutability Composition Concurrency Encapsulation Separation of Concerns
-
Which statement about constructors in Java is true
Constructors may be overloaded Constructors must be overloaded Constructors may never be overloaded
-
Which statement is true of implicit constructors?
Calling one is a syntax error The programmer needs to write code for them They take parameters They are supplied by the compiler if the programmer does not code any constructors They are supplied by the compiler if the programmer does code one or more constructors
-
Suppose the class Student contains a variable of type Address. This is an example of
Inheritance Immutability Encapsulation Implementation Composition
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started