Question Text: Consider the following line of Java code.'Hello,World' is which of the following? System.out.println(Hello, World!); Select
Question:
Question Text: Consider the following line of Java code. '"Hello,World'" is which of the following?
System.out.println("Hello, World!");
Select one:
a. a class
b. a method
c. an object
d. an operator
e. a parameter
Question 12
Consider the following Java program. Which one of the following is an interface?
import java.awt.event.*;
import javax.swing.*;
public class MouseWhisperer extends JFrame implements MouseListener {
MouseWhisperer() {
super("COME CLOSER");
setSize(300,100);
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
addMouseListener(this);
setVisible(true);
}
public void mouseClicked(MouseEvent e) { setTitle("OUCH"); }
public void mousePressed(MouseEvent e) { setTitle("LET GO"); }
public void mouseReleased(MouseEvent e) { setTitle("WHEW"); }
public void mouseEntered(MouseEvent e) { setTitle("I SEE YOU"); }
public void mouseExited(MouseEvent e) { setTitle("COME CLOSER"); }
public static void main(String[] args) { new MouseWhisperer(); }
}
Select one:
a. java.awt.event
b. JFrame
c. MouseEvent
d. MouseListener
e. super
Question 13
Which of the following is NOT a valid identifier in Java?
Select one:
a. p
b. Public
c. public
d. public1
e. PuBlIc_oNe
Question 14
Which of the following types is NOT a primitive type?
Select one:
a. boolean
b. char
c. double
d. int
e. String
Question 15
Consider the following Java method.
public static void main(String[] args) {
System.out.println("Hello, Final!");
}
Which term best describes "void"?
Select one:
a. actual parameter or argument
b. formal parameter
c. modifier
d. return type
e. superclass
Question 16
A subclass method can ___ a superclass method with the same name and parameter types.
Select one:
a. extend
b. implement
c. inherit
d. overload
e. override
Question 17
Which of the following is NOT an effective strategy when your program does not work?
Select one:
a. Make random changes to code that you do not understand until it accidentally works.
b. Read through your code and figure out what it does step by step.
c. Check each error message generated by the compiler or IDE.
d. Add debugging statements to output information about the state of your program while it runs.
e. Use a debugger to pause your program while it is running so you can check its state.
Question 18
Consider the following Java program. Which one of the following best describes "setFlavor"?
public class Food {
static int count;
private String flavor = "sweet";
Food() { count++; }
void setFlavor(String s) { flavor = s; }
String getFlavor() { return flavor; }
static public void main(String[] args) {
Food pepper = new Food();
System.out.println(pepper.getFlavor());
}
}
Select one:
a. a class method
b. a getter method
c. a setter method
d. a public method
e. a static method
Question 19t
Question Text: Consider the following line of Java code. "println" is which of the following?
System.out.println("Hello, World!");
Select one:
a. a class
b. a method
c. an object
d. an operator
e. a parameter
Question 20
What is the output of the following Java program?
public class Food {
static int count;
private String flavor = "sweet";
Food(String s) { flavor = s; }
void setFlavor(String s) { flavor = s; }
String getFlavor() { return flavor; }
static public void main(String[] args) {
Food pepper = new Food("spicy");
Food chile = pepper;
pepper.setFlavor("smoky");
System.out.println(chile.getFlavor());
}
}
Select one:
a. false
b. smoky
c. spicy
d. sweet
e. true
Accounting Principles
ISBN: 978-1119419617
IFRS global edition
Authors: Paul D Kimmel, Donald E Kieso Jerry J Weygandt