• Post Reply Bookmark Topic Watch Topic
  • New Topic

I need some help with this quiz!  RSS feed

 
Max Alistair
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
fred rosenberger
lowercase baba
Bartender
Posts: 12563
49
Chrome Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Here's a better idea...why don't you tell us what you think the answer is and why, and we'll help guide you to the correct answers if you're wrong!!!
 
Max Alistair
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
fred rosenberger wrote:Here's a better idea...why don't you tell us what you think the answer is and why, and we'll help guide you to the correct answers if you're wrong!!!


My answers were:
1-c
2-d
3-c
4-b
5-d
6-c
7-d
8-b
9.a-true
b-false
10-b
11-a
12 a-false
b-false
13-c
14-a
15-c

are they correct?
 
Campbell Ritchie
Marshal
Posts: 56529
172
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Welcome to the Ranch

Some of those questions, eg the one about worker methods, are by no means easy.
1c looks correct
2d
3c
4 Never heard those terms used.
5c
6 Don't understand the question
7d
8 I don't like any of the suggested answers, but I think you have got this one wrong.
9 true false
10b
11 You have got no 11 wrong
12 false false
13c
14 None of the suggestions, but I don't think you have got the correct answer.
15c

 
Rob Spoor
Sheriff
Posts: 21133
87
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
My corrections:
2: c. Technically arrays do not hold objects but references to objects (or primitives of course).
5: c. Variables are data.
8: I agree with Campbell. The only way attributes can be defined in an interface is through getter methods.
11: a. Default constructors are always public.
14: c. If you do not import you have to write things like java.util.List instead of List, that's the only advantage they provide.
 
Jesper de Jong
Java Cowboy
Sheriff
Posts: 16057
88
Android IntelliJ IDE Java Scala Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Max, welcome to JavaRanch.

Please note that if you copy questions from a book, mock exam or other source, we require you to quote your sources - so please tell us where you got these quiz questions from.
 
Campbell Ritchie
Marshal
Posts: 56529
172
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Did I get no 2 wrong? Sorry. But it is actually (like several of those questions) a confusing question. As Jesper says, please quote your sources so we know not to try that quiz.
 
Rob Spoor
Sheriff
Posts: 21133
87
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It's easy to get number 2 wrong. When you speak of arrays, you speak of arrays of Strings, arrays of Integers, etc. Therefore "an array of String objects" is something people will say, and I doubt that many professors would find answer d wrong if answer c was not present. But yes, technically it is an array of references to String objects.
 
Campbell Ritchie
Marshal
Posts: 56529
172
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes, I see your point, Rob.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!