Hello everybody!!
I am new to
java and I would like to find out what the right answers to this quiz are.
If you know the right answers, please, tell them to me so I can look if I got them right.
Thanks!!
Here it starts!!
Question 1: State which of the following statements are true:
a. A class can only contain one single method declaration.
b. The most basic form of a method is one that has a return type
but no arguments.
c. All calling methods can be worker methods and all worker
methods can be calling methods.
d. Overloaded methods have the same number of arguments.
Question 2: The main method accepts which of the following argument types:
a. A
String object
b. An int type
c. An array of references to String objects
d. An array of String objects
Question 3: Which method corresponds to the following method call?
myPerson.printValues (100, 147.7F, "lavender");
a. public void printValues (int pantSize, float
ageInYears)
b. public void printValues (pantSize, float
ageInYears, favoriteColor)
c. public void printValues (int pantSize, float
ageInYears, String favoriteColor)
d. public void printValues (float ageInYears, String
favoriteColor, int pantSize)
Question 4: Which of the following terms refers to the scope of a problem or a
system:
a. The problem context
b. The problem domain
c. The system context
d. The problem area
Question 5: Which of the following terms represents two different characteristics
of an object:
a. Methods and operations
b. The problem domain
c. Attributes and operations
d. Variables and data
Question 6: Which of the following statements is a criteria to test the validity of
an object relative to a problem domain:
a. Relevance to the problem domain
b. Operation order
c. Attribute type
d. If a class has a super class
Question 7: Which of the following statements are true:
a. A class is an instance of an object.
b. An object is a blueprint for a class.
c. An object and a class are exactly the same.
d. An object is an instance of a class.
e. An attribute cannot be a reference to another object.
Question 8: Which of the following statements defines an interface
a. The way a class completes its tasks within a method
b. The operations and attributes of an object
c. The way other objects interact with an object
d. The declaration of private attributes
Question 9: State whether the following statements are true or false:
a. The private members of an object can be accessed through
public methods
b. Constructors cannot be overloaded
Question 10: The scope of a variable refers to:
a. The lifetime of the variable
b. Where a variable can be used within a program, also known as,
the extent of a variable.
c. The way other objects interact with an object
d. Whether the variable is private or public
Question 11: What is the default constructor for the following class?
public class Penny {
String name = "lane";
}
a. Penny()
b. public Penny()
c. class()
d. String()
Question 12: State whether the following statements are true or false:
a. In the Java programming language, a superclass can inherit
from its subclasses.
b. An object is an abstract concept.
Question 13: Which of the following Java programming language keywords
indicates inheritance?
a. The implements keyword
b. The inherits keyword
c. The extends keyword
d. The imports keyword
Question 14: The import keyword fulfills what task?
a. It informs the virtual machine of the classes your program uses.
b. It informs the virtual machine that you are using a graphic file
in your program.
c. It makes your program easier to read by allowing you to use
shortened names when referring to classes in the Java API.
d. It informs the compiler that you are compiling a program using
classes from the Java API.
Question 15: From which Java API package are the String, Math, and Integer
classes implicitly imported?
a. The java.awt package
b. The java.applet package
c. The java.lang package
d. The java.io package