100% satisfaction guarantee Immediately available after payment Both online and in PDF No strings attached
logo-home
JAVA (EXAM 3) Questions & Answers 100% Verified!! $16.99   Add to cart

Exam (elaborations)

JAVA (EXAM 3) Questions & Answers 100% Verified!!

 10 views  0 purchase
  • Course
  • JAVA
  • Institution
  • JAVA

All classes implement an abstract data type. - ANSWERFalse In a single statement, define and initialize a reference variable for an ArrayList named frameScores that stores items of type Integer. - ANSWERArrayList frameScores = new ArrayList(); Given: ArrayList itemsList = new ArrayList(); Wha...

[Show more]

Preview 3 out of 29  pages

  • August 2, 2024
  • 29
  • 2024/2025
  • Exam (elaborations)
  • Questions & answers
  • java exam 3 stuvia
  • JAVA
  • JAVA
avatar-seller
papersmaster01
JAVA (EXAM 3) Questions & Answers 100%
Verified!!

All classes implement an abstract data type. - ANSWERFalse



In a single statement, define and initialize a reference variable for an ArrayList named frameScores
that stores items of type Integer. - ANSWERArrayList frameScores = new ArrayList();



Given: ArrayList itemsList = new ArrayList(); What is the initial size of the ArrayList? - ANSWER0; Zero



The _________ operator is used to explicitly allocate an object. - ANSWERnew



Given: Employee clerk1 = new Employee() ;. clerk1 refer to an object. - ANSWERTrue



Define a private field named salary of type int for Employee class: - ANSWERprivate int salary;



Which of the following commands is used to run a java program? - ANSWERjava



The constructor has the same name as the class. The constructor method has no return type, not
even void. - ANSWERTrue



Class Dwelling has data members door1, door2, door3. A class House is derived from Dwelling and
has data members wVal, xVal, yVal, zVal. The definition and initialization House h = new House();
creates how many data members? - ANSWER7; seven



Using a JFormattedTextField variable named numItersField, write a statement that creates a
JFormattedTextField that uses a NumberFormat to display integers. - ANSWERnumItersField = new
JFormattedTextField(NumberFormat.getIntegerInstance());



The block tag specification below creates a reference to ElapsedTime's printTime() method. @see
ElapsedTime#printTime() - ANSWERTrue

,Given a JFrame variable named frame and a JTextField variable named nameField, write a statement
that adds nameField to the frame. - ANSWERframe.add(nameField);



Assume an empty JFrame object named appFrame. The program called the setVisible() method
correctly (i.e., appFrame.setVisible(true);), but the frame is not visible on the screen. The frame
should be 500 pixels wide and 300 pixels tall. - ANSWERappFrame.setSize(500, 300);



Which of the following is NOT a characteristics of Object Oriented Programming? -
ANSWERrevolution



Using the GridBagConstraints variable named layoutConstraints, write a statement that would add 5
pixels of padding to the left and right of a GUI component. The top and bottom edges of the
component should not have padding. - ANSWERlayoutConstraints.insets = new Insets(0, 5, 0, 5);



Given the JTextField variable named weeklyHoursField, write a statement that makes
weeklyHoursField editable by users. - ANSWERweeklyHoursField.setEditable(true);



A private helper method may not call another private helper method. - ANSWERFalse



Which access modifier allows a class be used by every class in the program regardless of the package
in which either is defined? - ANSWERpublic



Suppose your program uses an object called Student. Which of the following shall NOT be part of the
Student object? - ANSWERgetPrice()



By default, the equals() method tests the equality of the contents of two Objects , not the equality of
their references. - ANSWERFalse



Suppose that public Student(String name, String id){// code} is the only constructor the Student class
has. Which of the following is correct? - ANSWERStudent s = new Student(â Tomâ , â 1234â );



A derived class may define a member method having the same name as the base class. Such a
member method _______________ the method of the base class. - ANSWERoverrides



Suppose that we have the following code. Student s1 = new Student(); Student s2; Which of the
following is true after the above two line of code are executed? - ANSWERs1 refers to valid object

, Instances of primitive wrapper classes, such as Integer and Double, and the String class are defined
as immutable, meaning that a programmer cannot modify the object's contents after initialization;
new objects must be created instead. - ANSWERTrue



A mutator should not change a class' private data. - ANSWERFalse



The process of creating and running a program that tests a specific item (or "unit"), such as a method
or a class, is known as ________ testing. - ANSWERunit



In Student class, there is a field double gpa; and a method void setGpa(double gpa); In main()
function, given variable definition Student s = new Student(); which of the following code set the sâ
gap to be 3.5? - ANSWERs.setGpa(3.5);



There is exactly one way to decompose a program into classes. - ANSWERFalse



The ____________ data type is a built-in class in Java that augments the int primitive type. -
ANSWERInteger



Write a statement that assigns the double representation of the value held by the Integer objects
numElements to a double variable named calcSize. - ANSWERcalcSize = numElements.doubleValue();



Each item in array is directly accessible - ANSWERTrue



Given array firstList with size 4 and element values, 33, 44, 55, 66, and array secondList with size 4
and elements values 0, 0, 0, 0. Consider loop for (i = 0; i < 4;



++i) { secondList[i] = firstList[i];}. After execution of the above loop, code secondList[2] = 100; will
modify firstList[2] to be 100 too. - ANSWERFalse



What is the index of the last element in an array? - ANSWERThe size of the array minus one.



A continue statement in a loop causes an immediate exit of the loop. - ANSWERFalse

The benefits of buying summaries with Stuvia:

Guaranteed quality through customer reviews

Guaranteed quality through customer reviews

Stuvia customers have reviewed more than 700,000 summaries. This how you know that you are buying the best documents.

Quick and easy check-out

Quick and easy check-out

You can quickly pay through credit card or Stuvia-credit for the summaries. There is no membership needed.

Focus on what matters

Focus on what matters

Your fellow students write the study notes themselves, which is why the documents are always reliable and up-to-date. This ensures you quickly get to the core!

Frequently asked questions

What do I get when I buy this document?

You get a PDF, available immediately after your purchase. The purchased document is accessible anytime, anywhere and indefinitely through your profile.

Satisfaction guarantee: how does it work?

Our satisfaction guarantee ensures that you always find a study document that suits you well. You fill out a form, and our customer service team takes care of the rest.

Who am I buying these notes from?

Stuvia is a marketplace, so you are not buying this document from us, but from seller papersmaster01. Stuvia facilitates payment to the seller.

Will I be stuck with a subscription?

No, you only buy these notes for $16.99. You're not tied to anything after your purchase.

Can Stuvia be trusted?

4.6 stars on Google & Trustpilot (+1000 reviews)

73243 documents were sold in the last 30 days

Founded in 2010, the go-to place to buy study notes for 14 years now

Start selling
$16.99
  • (0)
  Add to cart