Question

QUESTION 13 A constructor is the same as any other method definition EXCEPT for what? A...

QUESTION 13

  1. A constructor is the same as any other method definition EXCEPT for what?

    A constructor includes an optional argument list.

    A constructor includes an optional access modifier, usually public.

    A constructor includes a return type.

    A constructor places arguments within parentheses ().

2 points   

QUESTION 14

  1. Using the asterisk wildcard (e.g. import com.packageName.*) will include all of the classes within packageName, even if they aren’t used.

    True

    False

2 points   

QUESTION 15

  1. The Random class gives access to a floating-point number between 1 and 100.

    True

    False

2 points   

QUESTION 16

  1. Which line in the following code does NOT include an error?

    0 public int foo() {
    1 super.onDraw(canvas);
    2 Paint dotPaint = new Paint();
    3 dotPaint.setColor(Color.RED);
    4 doble i = 1;
    5 j = 2;
    6 i = j * i;
    7 j = Math.pow(i, j);
    8 canvas.drawText(“i: “ + i + “|j: “ + j);
    9 }

    Line 4

    Line 5

    Line 7

    Line 8

2 points   

QUESTION 17

  1. How do you tag objects for garbage collection?

    Pass the object reference to a built-in garbage collection method.

    Set the object references to null.

    Both A and B

    Neither A nor B

2 points   

QUESTION 18

  1. The schedule method of the Timer class can take any function as its first parameter.

    True

    False

2 points   

QUESTION 19

  1. What interface is included in the following code?

    public class DotSmasherCanvas extends View implements OnTouchListener {
       int dotX, dotY, score;
       //Other code here
    }

    class DotSmasherCanvas

    class View

    class OnTouchListener

    class int

2 points   

QUESTION 20

  1. How are the properties of each component stored?

    Class instance variables and their values in Java

    Comma separated values in a plain text file.

    Key/value pairs called attributes in JSON

    Key/value pairs called attributes in XML

0 0
Add a comment Improve this question Transcribed image text
Answer #1

Question 13.

A constructor is the same as any other method definition except - A constructor includes an optional access modifier, usually public.

Question 14. TRUE

Question 15. FALSE

Question 16. Line 8: j = Math.pow(i, j);

Question 17. Both A and B

Question 18. FALSE

Explanation: Syntax for schedule method is: public void schedule(TimerTask timerTask, int initialDelay, int periodicDelay);

The 1st parameter is an object of a TimerTask class that needs to be repeated at regular interval. So, the 1st parameter should always be an object of the TimerTask class, and not just any function!

Question 19. class onTouchListener is the interface used in the code.

Question 20. Can be either through class instance variables and their values in Java OR Key/value pairs called attributes in XML

Add a comment
Know the answer?
Add Answer to:
QUESTION 13 A constructor is the same as any other method definition EXCEPT for what? A...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • QUESTION 11 Which of the following could never be found in the file NewClass.java? public NewClass()...

    QUESTION 11 Which of the following could never be found in the file NewClass.java? public NewClass() { message = “Hello World!”; } public String title = “New Class”; public void doSomething() { doSomethingElse(); } public OtherClass() { message = “Hello, World! Good to see you again!”; } 2 points    QUESTION 12 Match the terms to the corresponding definition below.       -       A.       B.       C.       D.       E.      ...

  • Mobile Application Development questions Match the component type to the example of that component type.   ...

    Mobile Application Development questions Match the component type to the example of that component type.       -       A.       B.       C.       D.       E.       F.       G.    A Tip Calculator       -       A.       B.       C.       D.       E.       F.       G.    Where’s My App, which waits for a text message to be received...

  • Question 16 You must put your data in classes if you use C++. True False 2...

    Question 16 You must put your data in classes if you use C++. True False 2 points Question 17 Constructors are automatically invoked during class instantiation. True False 2 points Question 18 To make your data accessible to entities outside of your class, declare the members of that class as private. True False 2 points Question 19 You can make arrays of built-in types like int and double, but not of user-defined types. True False 2 points Question 20 One...

  • QUESTION 21 In the following onOptionsItemSelected() method, which id is most likely associated with accessing the...

    QUESTION 21 In the following onOptionsItemSelected() method, which id is most likely associated with accessing the application’s help page? public boolean onOptionsItemSelected(MenuItem item) {    switch (item.getItemId()) {       case R.id.item1:         new();         return true;       case R.id.item2:         open();         return true;       case R.id.item3:         close();         return true;       case R.id.item4:         info();         return true;       default:         return super.onOptionsItemSelected(item);    } } item1 item2 item4 none, it will be handled by the default case 2 points    QUESTION 22 In the following onOptionsItemSelected()...

  • Can you help with the merge method? This method should create and return an ArrayBagcontaining one...

    Can you help with the merge method? This method should create and return an ArrayBagcontaining one occurrence of any item that is found in either the called object or the parameter other. For full credit, the resulting bag should not include any duplicates. Give the new ArrayBag a maximum size that is the sum of the two bag’s maximum sizes. import java.util.*; /** * An implementation of a bag data structure using an array. */ public class ArrayBag { /**...

  • 1. Assume you have a Car class that declares two private instance variables, make and model....

    1. Assume you have a Car class that declares two private instance variables, make and model. Write Java code that implements a two-parameter constructor that instantiates a Car object and initializes both of its instance variables. 2. Logically, the make and model attributes of each Car object should not change in the life of that object. a. Write Java code that declares constant make and model attributes that cannot be changed after they are initialized by a constructor. Configure your...

  • In Java Which of the following statements declares Salaried as a subclass of payType? Public class...

    In Java Which of the following statements declares Salaried as a subclass of payType? Public class Salaried implements PayType Public class Salaried derivedFrom(payType) Public class PayType derives Salaried Public class Salaried extends PayType If a method in a subclass has the same signature as a method in the superclass, the subclass method overrides the superclass method. False True When a subclass overloads a superclass method………. Only the subclass method may be called with a subclass object Only the superclass method...

  • Restrictions: You may not change any of the fields, nor the constructor, nor the insertAtFront method....

    Restrictions: You may not change any of the fields, nor the constructor, nor the insertAtFront method. As usual, you may not modify the method headers given to you in any way nor may you change the name of the class or the package. You must use recursion to solve the problems. Your code may not contain any loops. Functions that have loops will receive 0 points package hw8; import java.util.NoSuchElementException; public class MyList<Item> { private class MyListNode { public Item...

  • Question 11 (3 points) What does the following recursive method determine? public boolean question 16(int[]a, int[]...

    Question 11 (3 points) What does the following recursive method determine? public boolean question 16(int[]a, int[] b. intj) { if (j == 2.length) return false; else if ( == b.length) return true; else return question 16(2, b.j+1): 3 returns true if b contains less elements than a, false otherwise returns true if b contains more elements than a, false otherwise returns true if a and bare equal in size, false otherwise returns true if a's element value is larger than...

  • How do I separate the method into different class? I try separate the testing and method...

    How do I separate the method into different class? I try separate the testing and method class into 2 different class. And when I test it, it said that the method is undefined. And it ask me to create the method in the main class. I don't know what is the problem. This is the access to the code https://repl.it/@Teptaikorn/test Thank you very much MazeSolver.java MazeTerster.... TwoDim AutoA... testfile.txt Main.java x > 0 N Binary TreeN... X LinkedBinary... Maze.java 1...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT