LiveWire Network Peer Answers Peer Support Teen Forums Tech Forums College Forums 213 users online 272457 members 177 active today Advertise Here Sign In
TeenCollegeTechPhotos | Quizzes | LiveSecret | Memberlist | Dictionary | FAQ
Member Spotlight
G Z A
A deep rooted hunger, I wonder, will the seed sprout ...
Mood: Embarrassed
You have 1 new message.
Emergency Help
Until you sign up you can't do much. Yes, it's free.

Sign Up Now
Membername:
Password:
Already have an account?
Invite Friends
Active Members
Groups
Contests
Moderators
7 online / 3 MPM
Fresh Topics
  LiveWire / Technical Forums / Web Design & Application Programming / Viewing Topic

Java Questions
Replies: 2Last Post Sep. 10, 2008 8:37am by paigeypoo2008
Welcome to LiveWire!
We're Stronger Together.
Join the Community
Single page for this topic Email Print Favorite
( Jcash22  )


Dairy Product Addict
Reply
I need some help on a few questions here(multple choice) most i have answered, but if you think its wrong please let me know.
Variables are classified according to their
  A. value  
  B.data type  
  C.names  
  lD.ocation in the program   (D is my answer)

What will be displayed after the following statements have been executed?      

int x = 15, y = 20, z = 32;
x += 12;
y /= 6;
z -= 14;
System.out.println("x = " + x +
                  ", y = " + y +
                  ", z = " +z);

  A. x = 27, y = 3.333, z = 18  
  B.x = 27, y = 2, z = 18  
  C.x = 27, y = 3, z = 18  (C is my answer)
  D.x = 37, y = 14, z = 4  

What will be the displayed when the following code is executed?

final int x = 22, y = 4;
y += x;
System.out.println("x = " + x +
                  ", y = " + y);

  A. x = 22, y = 4  
  B.x = 22, y = 26  
  C.x = 22, y = 88  
  D.Nothing, this is an error  (D is my answer)

What will be displayed after the following statements have been executed?      

final double x;
x = 54.3;
System.out.println("x = " + x );

 A.  x = 54.3  
  B.x  
 C. x = 108.6  
  D.Nothing, this is an error

The ___________ is normally considered the standard output and standard input devices, and usually refer to the monitor and keyboard.
  A. CRT  
  B.CPU  
  C.secondary storage devices  
  D.console  

Which of the following is the correct boolean expression to test for:  int x being a value less than or equal to 500 or greater than  650, and int y not equal to 1000?
  A. ((x >= 500 && x <650) && (y != 1000))  
  B.((x <= 500 OR x > 650) AND !(y.equal(1000)))  
  C.((x >= 500 || x < 650) || (y != 1000))  
 D. ((x <= 500 || x > 650) && !(y == 1000))  

The expression tested by an if statement must evaluate to
   A.0 or 1  
  B.+1 or -1  
 C. true or false  (C is my answer)
 D. t or f  
 
In Java, when a character is stored in memory, it is actually stored as a(n) _____.
  A. Unicode number  
  B.ASCII character code  (B is my answer)
  C.EBCDIC character code  
  D.Morse code
What will be printed when the following code is executed?

double x = 45678.259;
DecimalFormat formatter =
        new DecimalFormat("#,###,##0.00");
System.out.println(formatter.format(x));

  A. 45678.259  
  B.0,045,678.26  
  C.45,678.26  
 D. 45,678.3  

What will be the values of ans, x, and y after the following statements are executed?

int ans = 0, x = 15, y =25;
if ( x >= y)
{
  ans = x + 10;
  x -=y;
}
else
{
  ans = y + 10;
  y += x;
}

   A.ans = 0, x = 15, y = 25  
  B.ans = 25, x = -10, y = 25  (B is my answer)
  C.ans = 35, x = 15, y = 40  
 D. ans = 25, x = 15, y = 40  

How many times will the following for loop be executed?

for (int count = 10; count < 21; count++)
  System.out.println("Java is great!!!");

   A.1  
  B.10  
  C.11  (C is my answer)
 D. 0  

A sentinel value is a value that _________ and signals that there are no more values to be entered.
  A. is a different data type than the values being processed  
  B.is a special value that cannot be mistaken as a member of the list  
  C.indicates the start of a list  
  D.guards the list  

Before entering a loop to compute a running total, the program should first do this.
   A.Read all the values into main memory  
  B.Set the accumulator where the total will be kept to an initial value, usually zero  
  C.Know exactly how many values there are to total  
 D. Set all variables to zero  

This type of loop is ideal in situations where you always want the loop to iterate at least once.
  A. while loop  
  B.do-while loop  (B is my answer)
  C.for loop  
  D.if statement  
This is a sum of numbers that accumulates with each iteration of a loop.
  A. Running total  (A is my answer)
  B.Final total  
  C.Grand finale  
  D.Galloping total  

Which of the following is included in a method call?
   A.return type  
  B.method modifiers  
 C. parentheses  
  D.return variable  
Which of the following is not a benefit derived from using methods in programming?
  A. problems are more easily solved  
  B.simplifies programs  
  C.code reuse  
  D.all of the above are benefits  

What is wrong with the following method call?  

displayValue (double x);

   A.There is nothing wrong with the statement.  
  B.displayValue will not accept a parameter.  
  C.Do not include the data type in the method call.  
  D.x should be a String.

In a @return tag statement the description
  A. cannot be longer than one line  
  B.describes the return value  (B is my answer)
  C.must be longer than one line  
 D. describes the parameter values  


 A value-returning method must specify this as its return type in the method header.
   A.an int  
  B.a double  
  C.a boolean  
  D.any valid data type  

The scope of a private instance field is
   A.the instance methods of the same class  
  B.inside the class, but not inside any method  
 C. inside the parentheses of a method header  
  D.the method in which they are defined  

For the following code, which statement is not true?      

public class Circle      
{      
   private double radius;      
   public double x;      
   private double y;      
}

  A. x is available to code that is written outside the Circle class.  
B.  radius is not available to code written outside the Circle class.  
 C. radius, x, and y are called members of the Circle class.  
  D. y is available to code that is written outside the Circle class.  

Data hiding, which means that critical data stored inside the object is protected from code outside the object is accomplished in Java by
  A. using the public access specifier on the class methods  
 B. using the private access specifier on the class methods  (B is my answer)
 C. using the private access specifier on the class definition  
 D. using the private access specifier on the class fields  
   
 Methods that operate on an object's fields are called
  A. instance variables  
  B.instance methods  (B is my answer)
  C.public methods  
  D. private methods  

You should not define a class field that is dependent upon the values of other class fields...
  A. in order to avoid having stale data  (A is my answer)
  B.because it is redundant  
 C. because it should be defined in another class  







8:56 am on Dec. 19, 2006 | Joined: May 2005 | Days Active: 613
Join to learn more about Jcash22 New York, United States | Posts: 659 | Points: 6,789
LiveWire Humor
Post from this position was omitted due to content violations
paigeypoo2008


Novice
Reply
whats the asnwers

8:37 am on Sep. 10, 2008 | Joined: Sep. 2008 | Days Active: 1
Join to learn more about paigeypoo2008 United States | Posts: 1 | Points: 11
Single page for this topic Email Print Favorite

Quick Reply

You are signed in as our guest.

Looking for something else?
 

  LiveWire / Technical Forums / Web Design & Application Programming / Viewing Topic