Question 11 pts
Which of the following is true about a Map?
| A Map stores <key,value> pairs |
| Duplicate keys are not allowed in a Map. |
| A Map can be thought of as a "lookup table" or "dictionary" |
| All of the above |
Flag this Question
Question 21 pts
Assume that the following code executes:
HashMap<String, Point> places = new HashMap<String, Point>(); places.put( "origin", new Point() ); places.put( "east", new Point( 100, 0 ) ); places.put( "south", new Point( 0, -100 ) ); places.put( "northwest", new Point( -100, 100 ) ); places.put( "east", new Point( 200, 0 ) );
What value is returned by the following method call?
places.size()
| 0 |
| 1 |
| 4 |
| 5 |
Flag this Question
Question 31 pts
Assume that the following code executes:
HashMap<String, Point> places = new HashMap<String, Point>(); places.put( "origin", new Point() ); places.put( "east", new Point( 100, 0 ) ); places.put( "south", new Point( 0, -100 ) ); places.put( "northwest", new Point( -100, 100 ) ); places.put( "east", new Point( 200, 0 ) );
What value is returned by the following call?
places.get( "south" )
| a Point object located at (0.0, -100.0) |
| a Point object located at (0.0, 0.0) |
| a Point object located at (100.0, 0.0) |
| null |
Flag this Question
Question 41 pts
Assume that the following code executes:
HashMap<String, Point> places = new HashMap<String, Point>(); places.put( "origin", new Point() ); places.put( "east", new Point( 100, 0 ) ); places.put( "south", new Point( 0, -100 ) ); places.put( "northwest", new Point( -100, 100 ) ); places.put( "east", new Point( 200, 0 ) );
What value is returned by the following method call?
places.get( "east" )
| a Point object located at (0.0, 0.0) |
| a Point object located at (100.0, 0.0) |
| a Point object located at (200.0, 0.0) |
| null |
Flag this Question
Question 51 pts
Assume that the following code executes:
HashMap<String, Point> places = new HashMap<String, Point>(); places.put( "origin", new Point() ); places.put( "east", new Point( 100, 0 ) ); places.put( "south", new Point( 0, -100 ) ); places.put( "northwest", new Point( -100, 100 ) ); places.put( "east", new Point( 200, 0 ) );
What value is returned by the following method call?
places.get( "north" )
| a Point object located at (0.0, 0.0) |
| a Point object located at (100.0, 0.0) |
| a Point object located at (0.0, 100.0) |
| a Point object located at (-100.0, 100.0) |
| null |
Flag this Question
Question 61 pts
What is an activation record?
| The place keeps track of what objects the program has instantiated. |
| The place that keeps track of what methods each class contains. |
| The place where local variables and parameters are stored as a method is executing. |
| The place that keeps track of new class definitions. |
Answer 11:
A Map stores <key,value> pairs
Answer 21:
5 as we have added 5 pairs
Answer 31:
a Point object located at (0.0, -100.0)
as south key has the value with 0, -100
Answer 41:
a Point object located at (200.0, 0.0)
as east has the value as 200,0.0.
east it is inserted twice so it will have the recently added
value
Answer 51:null
As we dont have any key as north
Answer 61:
The place where local variables and parameters are stored as a
method is executing.
Note : If you like my answer please rate and help me it is very Imp for me
Question 11 pts Which of the following is true about a Map? A Map stores <key,value>...
Eclipse Java Oxygen Question 11 pts A compile-time error occurs when Group of answer choices c. there’s a syntax error in a Java statement a. the Java compiler can’t be located b. bytecodes can’t be interpreted properly c. there’s a syntax error in a Java statement Flag this Question Question 21 pts An error that lets the application run but produces the wrong results is known as a Group of answer choices d. syntax error c. logic error a. runtime...
Those questions are about Java. Question 2 Which of the following is NOT a wrapper class? Integer Double String Character Flag this Question Question 3 Which of the following kinds of things may be stored directly in an ArrayList? None of the above primitive values Either of these two kinds of data object references Flag this Question Question 4 In this declaration: ArrayList<Point> polygon; what do we call 'Point'? a type argument a wrapper class a collection a variable Flag...
Question 60.1 pts Which of the following is true about a concrete class? A concrete class may be extended. A concrete class may be instantiated. A concrete may NOT contain abstract methods. All of the above. None of the above. Flag this Question Question 70.1 pts Which of the following is true? A class extends exactly one other class and may implement any number of interfaces. A class may extend at most one concrete class, may extend any number of...
Question 1 1 pts Which of the following is not a valid class name in Java? O MyClass MyClass1 My_Class MyClass# Question 2 1 pts Which of the following statements is False about instance variables and methods? Instance variables are usually defined with private access modifier. Instance variables are defined inside instance methods. Instance methods are invoked on an object of the class that contains the methods. A class can have more than one instance variables and methods. Question 3...
Question 11 pts Which of the following describes inflation? It increases the real value of anything expressed in dollars. It means that the price of every good and service is rising. It is an increase in the cost of a given basket of goods. It can occur only when many goods are falling in price. Flag this Question Question 21 pts David’s pay last year was $100,000. His pay this year increased to $115,000. The consumer price index increased from...
Question 1 2 pts The preprocessor executes after the compiler. False True Question 2 2 pts What code is human-readable and follows the standards of a programming language? Secret code Source code Key code None of these Machine code Question 3 2 pts What is the symbol that marks the beginning of a one line comment? Question 1 2 pts The preprocessor executes after the compiler. True False Question 5 2 pts A statement that may be used to stop...
Question 216 pts (TCO 2) In order to guarantee that only one JRadioButton is selected at any time, _____. add each JRadioButton object to a different panel create a ButtonGroup object and add the JRadioBttons to it have a JCheckBox object manage the three JRadioButtons This cannot be done in Java. Flag this Question Question 226 pts (TCO 2) Which Java interface would you need to implement in order to handle events such as key-pressed or key-released events? KeyListener interface...
Represent the control-flow graph as a set of nodes and a map between nodes and their neighbors. The following code snippet declares two classes—ControlFlowGraph and its static inner class Node—to enable the desired representation: a. Implement the addNode method and the two addEdge methods. b. Implement the reachable method. Note: "..." is where code is to be inserted below the post condition import java.util.*; public class ControlFlowGraph { // invariant : set " nodes " contains all nodes in the...
Question 11 1 pts Which of the following organic bases CANNOT use resonance to delocalize the negative charge? NH :0: 0.0: 0: 00: :0:
Writing 3 Java Classes for Student registration /** * A class which maintains basic information about an academic course. */ public class Course { /** * Attributes. */ private String code; private String title; private String dept; // name of department offering the course private int credits; /** * Constructor. */ public Course(String code, String title, int credits) { // TODO : initialize instance variables, use the static method defined in // Registrar to initialize the dept name variable...