Deck 15: The Java Collections Framework

ملء الشاشة (f)
exit full mode
سؤال
A linear search only requires ____ access.
A.sorted
B.arbitrary
C.sequential
D.random
استخدم زر المسافة أو
up arrow
down arrow
لقلب البطاقة.
سؤال
A queue is a collection that ____.
A.remembers the order of elements, and allows elements to be added and removed only at one end.
B.remembers the order of elements and allows elements to be inserted only at one end and removed only at the other end.
C.does not remember the order of elements but allows elements to be added in any position.
D.remembers the order of elements and allows elements to be inserted in any position.
سؤال
What is included in a linked list node?
I a reference to its neighboring nodes
II an array reference
III a data element
A.II only
B.I and III only
C.I only
D.II and III only
سؤال
Which of the following algorithms would be efficiently executed using a LinkedList?
A.Remove first n/ 2 elements from a list of n elements.
B.Read n / 2 elements in random order from a list of n elements.
C.Tracking paths in a maze.
D.Binary search.
سؤال
A collection that allows speedy insertion and removal of already-located elements in the middle of it is called a ____.
A.linked list
B.stack
C.set
D.queue
سؤال
The ArrayList class implements the ____ interface.
A.Stack
B.Queue
C.List
D.Set
سؤال
A stack is a collection that ____.
A.does not remember the order of elements but allows elements to be added in any position.
B.remembers the order of elements, and allows elements to be added and removed only at one end.
C.remembers the order of elements and allows elements to be inserted only at one end and removed only at the other end.
D.remembers the order of elements and allows elements to be inserted in any position.
سؤال
Which of the following statements about linked lists is correct?
A.When a node is removed, all nodes after the removed node must be moved down.
B.Visiting the elements of a linked list in random order is efficient.
C.Linked lists should be used when you know the correct position and need to insert and remove elements efficiently.
D.Even if you have located the correct position, adding elements in the middle of a linked list is inefficient.
سؤال
Which nodes need to be updated when we insert a new node to become the fourth node from the beginning of a doubly-linked list?
A.The current third and fourth nodes.
B.The current fourth and fifth nodes.
C.The current first node.
D.The current third node.
سؤال
Which data structure would best be used for keeping track of groceries to be purchased at the food market?
A.stack
B.queue
C.list
D.array
سؤال
We might choose to use a linked list over an array list when we will not require frequent ____.
I random access
II inserting new elements
III removing of elements
A.III only
B.II only
C.II and III only
D.I only
سؤال
Rather than storing values in an array, a linked list uses a sequence of ____.
A.accessors
B.nodes
C.elements
D.indexes
سؤال
A list is a collection that ____.
A.does not allow elements to be inserted in any position.
B.only allows items to be added at one end and removed at the other end.
C.manages associations between keys and values.
D.should be used when you need to remember the order of elements in the collection.
سؤال
A collection without an intrinsic order is called a ____.
A.queue
B.stack
C.set
D.list
سؤال
Select an appropriate expression to complete the following code segment, which is designed to print a message if the string stored in name is part of the players collection. Select an appropriate expression to complete the following code segment, which is designed to print a message if the string stored in name is part of the players collection.   A.(players.contains(name)) B.(players.indexOf(name)) C.(players.search(name)) D.(players.equals(name))<div style=padding-top: 35px>
A.(players.contains(name))
B.(players.indexOf(name))
C.(players.search(name))
D.(players.equals(name))
سؤال
Consider the following code snippet: Consider the following code snippet:   What will this code print when it is executed? A.abcdefghi B.defghiabc C.ghiabcdef D.abcghidef<div style=padding-top: 35px> What will this code print when it is executed?
A.abcdefghi
B.defghiabc
C.ghiabcdef
D.abcghidef
سؤال
A binary search requires ____ access.
A.sorted
B.random
C.arbitrary
D.sequential
سؤال
A collection that allows items to be added only at one end and removed only at the other end is called a ____.
A.set
B.stack
C.queue
D.list
سؤال
What type of access does a LinkedList provide for its elements?
A.sorted
B.sequential
C.random
D.semi-random
سؤال
A collection that remembers the order of items, and allows items to be added and removed only at one end is called a ____.
A.queue
B.stack
C.list
D.set
سؤال
Which Java package contains the LinkedList class?
A.java.lang
B.java.io
C.java.collections
D.java.util
سؤال
Which method is NOT part of the ListIterator interface?
A.hasPrevious
B.hasMore
C.add
D.hasNext
سؤال
Select an appropriate expression to complete the following method, which is designed to visit the elements in theList and replace each occurrence of the string "hello" with the string "goodbye". Select an appropriate expression to complete the following method, which is designed to visit the elements in theList and replace each occurrence of the string hello with the string goodbye.   A.iterator.next() = goodbye; B.iterator.previous(goodbye); C.iterator.replace(hello, goodbye); D.iterator.set(goodbye);<div style=padding-top: 35px>
A.iterator.next() = "goodbye";
B.iterator.previous("goodbye");
C.iterator.replace("hello", "goodbye");
D.iterator.set("goodbye");
سؤال
When using a list iterator, on which condition will the IllegalStateException be thrown?
A.Calling next after calling previous.
B.Calling remove after calling previous.
C.Calling remove after calling remove.
D.Calling remove after calling next.
سؤال
Assume you are using a doubly-linked list data structure with many nodes.What is the minimum number of node references that are required to be modified to remove a node from the middle of the list? Consider the neighboring nodes.
A.3
B.2
C.4
D.1
سؤال
Assume you have created a linked list named myList that currently holds some number of String objects.Which of the following statements correctly removes an element from the end of myList?
A.myList.remove();
B.myList.getLast();
C.myList.pop();
D.myList.removeLast();
سؤال
Consider the code snippet shown below.Assume that employeeNames is an instance of type LinkedList. Consider the code snippet shown below.Assume that employeeNames is an instance of type LinkedList<String>.   Which element(s) of employeeNames does this loop process? A.elements meeting a condition B.the most recently added elements C.no elements D.all elements<div style=padding-top: 35px> Which element(s) of employeeNames does this loop process?
A.elements meeting a condition
B.the most recently added elements
C.no elements
D.all elements
سؤال
A ____ is a data structure used for collecting a sequence of objects that allows efficient addition and removal of already-located elements in the middle of the sequence.
A.queue
B.priority queue
C.stack
D.linked list
سؤال
The nodes of a(n) ____ linked list class store two links: one to the next element and one to the previous one.
A.array
B.singly
C.randomly
D.doubly
سؤال
Assume you have created a linked list named myList that currently holds some number of String objects.Which of the following statements correctly adds a new element to the beginning of myList?
A.myList.insert("Harry");
B.myList.addFirst("Harry");
C.myList.add("Harry");
D.myList.put("Harry");
سؤال
You use a(n) ____ to access elements inside a linked list.
A.queue
B.accessor
C.list iterator
D.index
سؤال
When using the add method of the ListIterator to add an element to a linked list, which of the following statements is correct?
A.The new element is inserted before the iterator position, and a subsequent call to next would be unaffected.
B.The new element is inserted after the iterator position, and a subsequent call to next would return the new element.
C.The new element is inserted after the iterator position, and a subsequent call to previous would be unaffected.
D.The new element is inserted before the iterator position, and a subsequent call to next would return the new element.
سؤال
Consider the following code snippet: Consider the following code snippet:   What will this code print when it is executed? A.ghiabcdef B.defghiabc C.abcdefghi D.abcghidef<div style=padding-top: 35px> What will this code print when it is executed?
A.ghiabcdef
B.defghiabc
C.abcdefghi
D.abcghidef
سؤال
The term ____ is used in computer science to describe an access pattern in which the elements are accessed in arbitrary order.
A.sequential access
B.sorted access
C.arbitrary access
D.random access
سؤال
What can a generic class be parameterized for?
A.methods
B.iterators
C.type
D.properties
سؤال
When using a list iterator, on which condition will the IllegalStateException be thrown?
A.Calling remove after calling next.
B.Calling remove after calling add.
C.Calling add after calling previous.
D.Calling previous after calling previous.
سؤال
Which method is NOT part of the ListIterator interface?
A.next
B.delete
C.add
D.previous
سؤال
When using a list iterator, on which condition will the NoSuchElementException be thrown?
A.Calling next when you are past the end of the list.
B.Calling remove after calling add.
C.Calling remove after calling previous.
D.Calling next when the iterator points to the last element.
سؤال
Select an appropriate expression to complete the method below.The method should return the number of times that the string stored in name appears in theList. Select an appropriate expression to complete the method below.The method should return the number of times that the string stored in name appears in theList.   A.theList.next() != null B.iter.hasNext() C.theList.hasNext() D.iter.next() != null<div style=padding-top: 35px>
A.theList.next() != null
B.iter.hasNext()
C.theList.hasNext()
D.iter.next() != null
سؤال
Select an appropriate expression to complete the following code segment, which is designed to print a message if the string stored in name is the first element of the players linked list. Select an appropriate expression to complete the following code segment, which is designed to print a message if the string stored in name is the first element of the players linked list.   A.(players.getFirst().equals(name)) B.(players[0].equals(name)) C.(players.contains(name)) D.(players.indexOf(name) == 1)<div style=padding-top: 35px>
A.(players.getFirst().equals(name))
B.(players[0].equals(name))
C.(players.contains(name))
D.(players.indexOf(name) == 1)
سؤال
Which of the following statements about manipulating objects in a map is NOT correct?
A.Use the remove method to remove a value from the map.
B.Use the get method to retrieve a value from the map.
C.Use the keyset method to get the set of keys for the map.
D.Use the add method to add a new element to the map.
سؤال
Assume that you have declared a set named mySet to hold String elements.Which of the following statements will correctly delete an element from mySet?
A.mySet.delete("apple");
B.mySet.remove("apple");
C.mySet.get("apple");
D.mySet.pop("apple");
سؤال
Select an appropriate declaration to complete the following code segment, which is designed to read strings from standard input and display them in increasing alphabetical order, excluding any duplicates. Select an appropriate declaration to complete the following code segment, which is designed to read strings from standard input and display them in increasing alphabetical order, excluding any duplicates.   A.LinkedList<String> words = new LinkedList<>(); B.Set<String> words = new TreeSet<>(); C.Set<String> words = new Set<>(); D.Set<String> words = new HashSet<>();<div style=padding-top: 35px>
A.LinkedList words = new LinkedList<>();
B.Set words = new TreeSet<>();
C.Set words = new Set<>();
D.Set words = new HashSet<>();
سؤال
Which of the following statements about hash tables is NOT correct?
A.Elements are grouped into smaller collections that share the same characteristic.
B.You can form hash tables holding objects of type String.
C.The value used to locate an element in a hash table is called a hash code.
D.You can add an element to a specific position within a hash table.
سؤال
Complete the following code, which is intended to print out all key/value pairs in a map named myMap that contains String data for student IDs and names: Complete the following code, which is intended to print out all key/value pairs in a map named myMap that contains String data for student IDs and names:   A.String name = myMap.next(aKey); B.String name = MapKeySet.get(aKey); C.String name = myMap.get(aKey); D.String name = MapKeySet.next(aKey);<div style=padding-top: 35px>
A.String name = myMap.next(aKey);
B.String name = MapKeySet.get(aKey);
C.String name = myMap.get(aKey);
D.String name = MapKeySet.next(aKey);
سؤال
Consider the following code snippet: Consider the following code snippet:   What will be printed when this code is executed? A.[Mary, John, Robert, Sue] B.[John, Robert, Sue] C.[Mary, Robert, Sue] D.[Mary, John, Sue]<div style=padding-top: 35px> What will be printed when this code is executed?
A.[Mary, John, Robert, Sue]
B.[John, Robert, Sue]
C.[Mary, Robert, Sue]
D.[Mary, John, Sue]
سؤال
Assume that you have declared a map named myMap to hold String values with Integer keys.Which of the following statements will correctly delete an association from myMap?
A.myMap.remove(3);
B.myMap.remove("apple");
C.myMap.delete(3);
D.myMap.pop(3);
سؤال
In a linked list data structure, when does the reference to the first node need to be updated?
I inserting into an empty list
II deleting from a list with one node
III deleting an inner node
A.I and II only
B.I only
C.II only
D.III only
سؤال
Which of the following statements about the TreeSet class is NOT correct?
A.Elements are stored in nodes.
B.Elements are arranged in linear fashion.
C.To use a TreeSet, it must be possible to compare the elements.
D.Elements are stored in sorted order.
سؤال
To create a TreeSet for a class of objects, the object class must ____.
A.implement the Set interface.
B.implement the Comparable interface.
C.create an iterator.
D.create a Comparator object.
سؤال
Which of the following statements about manipulating objects in a set is correct?
A.If you try to remove an element that does not exist, an exception will occur.
B.If you try to add an element that already exists, an exception will occur.
C.A set iterator visits elements in the order in which the set implementation keeps them.
D.You can add an element at the position indicated by an iterator.
سؤال
Which of the following statements about manipulating objects in a map is NOT correct?
A.Use the put method to add an element to the map.
B.If you attempt to retrieve a value with a key that is not associated with any value, you will receive a null result.
C.Use the get method to retrieve a value associated with a key in the map.
D.You cannot change the value of an existing association in the map; you must delete it and re-add it with the new values.
سؤال
Select an appropriate expression to complete the following method, which is designed to return the number of elements in the parameter array numbers.If a value appears more than once, it should be counted exactly once. Select an appropriate expression to complete the following method, which is designed to return the number of elements in the parameter array numbers.If a value appears more than once, it should be counted exactly once.   A.return numbers.length - values.size(); B.return values.size(); C.return numbers.length; D.return values.length();<div style=padding-top: 35px>
A.return numbers.length - values.size();
B.return values.size();
C.return numbers.length;
D.return values.length();
سؤال
Your program uses a Map structure to store a number of user ids and corresponding email addresses.Although each user must have a unique id, two or more users can share the same email address.Assuming that all entries in the map have valid email addresses, select an appropriate expression to complete the method below, which adds a new id and email address to the map only if the id is not already in use.If the id is already in use, an error message is printed. Your program uses a Map structure to store a number of user ids and corresponding email addresses.Although each user must have a unique id, two or more users can share the same email address.Assuming that all entries in the map have valid email addresses, select an appropriate expression to complete the method below, which adds a new id and email address to the map only if the id is not already in use.If the id is already in use, an error message is printed.   A.!currentEmail.equals(email) B.currentEmail.equals(email) C.currentEmail != null D.currentEmail == null<div style=padding-top: 35px>
A.!currentEmail.equals(email)
B.currentEmail.equals(email)
C.currentEmail != null
D.currentEmail == null
سؤال
Assume that you have declared a map named myMap to hold String values with Integer keys.Which of the following statements will correctly retrieve the value associated with a key from myMap?
A.myMap.peek(3);
B.myMap.get("apple");
C.myMap.peek("apple");
D.myMap.get(3);
سؤال
Which of the following statements about sets is correct?
A.Attempting to remove an element that is not in the set generates an exception.
B.You can add an element to a specific position within a set.
C.A set is a collection of unique elements organized for efficiency.
D.A set allows duplicate values.
سؤال
Assume that you have declared a set named mySet to hold String elements.Which of the following statements will correctly insert an element into mySet?
A.mySet.put(apple");
B.mySet.insert("apple");
C.mySet.add("apple");
D.mySet.push("apple");
سؤال
Which of the following statements about manipulating objects in a set is correct?
A.A set iterator visits elements in the order in which they were added to the set.
B.You can remove an element at the position indicated by an iterator.
C.If you try to add an element that already exists, an exception will occur.
D.You can add an element at the position indicated by an iterator.
سؤال
Assume that you have declared a map named myMap to hold String values with Integer keys.Which of the following statements will correctly add an association into myMap?
A.myMap.insert(3, "apple");
B.myMap.add(3, "apple");
C.myMap.put(3, "apple");
D.myMap.push(3, "apple");
سؤال
Complete the following code, which is intended to print out all key/value pairs in a map named myMap that contains String data for student IDs and names: Complete the following code, which is intended to print out all key/value pairs in a map named myMap that contains String data for student IDs and names:   A.Map<String, String> mapKeySet = myMap.keySet(); B.Set<String, String> mapKeySet = myMap.keySet(); C.Set<String> mapKeySet = myMap.keySet(); D.Set<String> mapKeySet = myMap.getKeySet();<div style=padding-top: 35px>
A.Map mapKeySet = myMap.keySet();
B.Set mapKeySet = myMap.keySet();
C.Set mapKeySet = myMap.keySet();
D.Set mapKeySet = myMap.getKeySet();
سؤال
Consider the following code snippet:
Map scores;
You expect to retrieve elements randomly by key, and want fastest retrieval times.Which of the following statements will create a structure to support this?
A.scores = new HashMap<>;
B.scores = new Map<>;
C.scores = new TreeMap<>;
D.scores = new TreeSet<>;
سؤال
What operation is least efficient in a LinkedList?
A.Linear traversal step.
B.Random access of an element.
C.Adding an element in a position that has already been located.
D.Removing an element when the element's position has already been located.
سؤال
You need to write a program to simulate the effect of adding an additional cashier in a supermarket to reduce the length of time customers must wait to check out.Which data structure would be most appropriate to simulate the waiting customers?
A.map
B.stack
C.linked list
D.queue
سؤال
You need to access values in objects by a key that is not part of the object.Which collection type should you use?
A.Hashtable
B.ArrayList
C.Map
D.Queue
سؤال
You want to enumerate all of the keys in a map named myMap whose keys are type String.Which of the following statements will allow you to do this?
A.Set keySet = myMap.getKeySet(); for (String key : keySet) {...}
B.Set keySet = myMap.keySet(); for (String key : keySet) {...}
C.Set keySet = myMap.keys(); for (String key : keySet) {...}
D.Set keySet = myMap.getKeys(); for (String key : keySet) {...}
سؤال
You need to access values by an integer position.Which collection type should you use?
A.Queue
B.Map
C.Hashtable
D.ArrayList
سؤال
You need to access values using a key, and the keys must be sorted.Which collection type should you use?
A.Queue
B.TreeMap
C.HashMap
D.ArrayList
سؤال
Which of the following algorithms would be efficiently executed on an ArrayList?
A.remove first n / 2 elements from a list of n elements
B.add 1 element to the middle of a list with n elements
C.add n / 2 elements to a list with n / 2 elements
D.read n / 2 elements in random order from a list of n elements
سؤال
Which of the following statements about hash functions is NOT correct?
A.Using a prime number as a hash multiplier will produce better hash codes.
B.If you supply your own hashCode method for a class, it must be compatible with that class's equals method.
C.A good hash function will minimize the number of objects that are assigned the same hash code.
D.A hash function produces a unique integer-valued hash code value for each distinct object.
سؤال
An Undo feature in a word processor program that allows you to reverse a previously completed command is probably implemented using which structure type?
A.stack
B.queue
C.hash table
D.linked list
سؤال
Assume that you have declared a stack named myStack to hold String elements.Which of the following statements will correctly add an element to myStack?
A.myStack.addItem("apple");
B.myStack.put("apple");
C.myStack.insert("apple");
D.myStack.push("apple");
سؤال
Which data structure would best be used for storing a set of numbers and sorting them in ascending order?
A.queue
B.array
C.stack
D.list
سؤال
You intend to use a hash set with your own object class.Which of the following statements is correct?
A.You cannot override the hashCode method in the Object class.
B.You can use the hash method of the Objects class to create your own hashCode method by combining the hash codes for the instance variables.
C.You can override the hash method for your class provided that it is compatible with its equals method.
D.Your class's hashCode method does not need to be compatible with its equals method.
سؤال
You need to access values in the opposite order in which they were added (last in, first out), and not randomly.Which collection type should you use?
A.Hashtable
B.Map
C.Queue
D.Stack
سؤال
Using the merge method of the Map interface, which statement correctly updates the wordCount map of type Map to count all of the occurrences of a word in a file?
A.wordCount.merge(word, 1, (k,v) -> v + 1);
B.word.merge(wordCount,(k,v) -> v + 1);
C.word.merge(wordCount, 1, (k,v) -> v + 1);
D.wordCount.merge(word,(k,v) -> v + 1);
سؤال
You need to access values in the order in which they were added (first in, first out), and not randomly.Which collection type should you use?
A.Queue
B.Map
C.Stack
D.Hashtable
سؤال
Consider the following code snippet:
Map scores;
If you need to visit the keys in sorted order, which of the following statements will create a structure to support this?
A.scores = new HashTable<>;
B.scores = new HashMap<>;
C.scores = new TreeMap<>;
D.scores = new Map<>;
سؤال
Using the merge method of the Map interface, which statement correctly updates the salesTotalByDept map of type Map to update the sales total for a dept by an integer sales value?
A.salesTotalByDept.merge(dept, sales,(d,s) -> s + 1);
B.sales.merge(salesTotalByDept, dept, (d,s) -> s + sales);
C.dept.merge(salesTotalByDept, sales, (d,s) -> s + sales);
D.salesTotalByDept.merge(dept, sales, (d,s) -> s + sales);
سؤال
Which of the following statements about stacks is correct?
A.A stack implements random retrieval.
B.A stack implements last-in, first-out retrieval.
C.A stack stores elements in sorted order.
D.A stack implements first-in, first-out retrieval.
سؤال
Which of the following correctly declares a stack that will hold String elements?
A.Stack s = new Stack<>();
B.Stack s = new Stack<>();
C.String s = new Stack();
D.String s = new Stack<>();
فتح الحزمة
قم بالتسجيل لفتح البطاقات في هذه المجموعة!
Unlock Deck
Unlock Deck
1/102
auto play flashcards
العب
simple tutorial
ملء الشاشة (f)
exit full mode
Deck 15: The Java Collections Framework
1
A linear search only requires ____ access.
A.sorted
B.arbitrary
C.sequential
D.random
sequential
2
A queue is a collection that ____.
A.remembers the order of elements, and allows elements to be added and removed only at one end.
B.remembers the order of elements and allows elements to be inserted only at one end and removed only at the other end.
C.does not remember the order of elements but allows elements to be added in any position.
D.remembers the order of elements and allows elements to be inserted in any position.
remembers the order of elements and allows elements to be inserted only at one end and removed only at the other end.
3
What is included in a linked list node?
I a reference to its neighboring nodes
II an array reference
III a data element
A.II only
B.I and III only
C.I only
D.II and III only
I and III only
4
Which of the following algorithms would be efficiently executed using a LinkedList?
A.Remove first n/ 2 elements from a list of n elements.
B.Read n / 2 elements in random order from a list of n elements.
C.Tracking paths in a maze.
D.Binary search.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 102 في هذه المجموعة.
فتح الحزمة
k this deck
5
A collection that allows speedy insertion and removal of already-located elements in the middle of it is called a ____.
A.linked list
B.stack
C.set
D.queue
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 102 في هذه المجموعة.
فتح الحزمة
k this deck
6
The ArrayList class implements the ____ interface.
A.Stack
B.Queue
C.List
D.Set
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 102 في هذه المجموعة.
فتح الحزمة
k this deck
7
A stack is a collection that ____.
A.does not remember the order of elements but allows elements to be added in any position.
B.remembers the order of elements, and allows elements to be added and removed only at one end.
C.remembers the order of elements and allows elements to be inserted only at one end and removed only at the other end.
D.remembers the order of elements and allows elements to be inserted in any position.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 102 في هذه المجموعة.
فتح الحزمة
k this deck
8
Which of the following statements about linked lists is correct?
A.When a node is removed, all nodes after the removed node must be moved down.
B.Visiting the elements of a linked list in random order is efficient.
C.Linked lists should be used when you know the correct position and need to insert and remove elements efficiently.
D.Even if you have located the correct position, adding elements in the middle of a linked list is inefficient.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 102 في هذه المجموعة.
فتح الحزمة
k this deck
9
Which nodes need to be updated when we insert a new node to become the fourth node from the beginning of a doubly-linked list?
A.The current third and fourth nodes.
B.The current fourth and fifth nodes.
C.The current first node.
D.The current third node.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 102 في هذه المجموعة.
فتح الحزمة
k this deck
10
Which data structure would best be used for keeping track of groceries to be purchased at the food market?
A.stack
B.queue
C.list
D.array
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 102 في هذه المجموعة.
فتح الحزمة
k this deck
11
We might choose to use a linked list over an array list when we will not require frequent ____.
I random access
II inserting new elements
III removing of elements
A.III only
B.II only
C.II and III only
D.I only
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 102 في هذه المجموعة.
فتح الحزمة
k this deck
12
Rather than storing values in an array, a linked list uses a sequence of ____.
A.accessors
B.nodes
C.elements
D.indexes
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 102 في هذه المجموعة.
فتح الحزمة
k this deck
13
A list is a collection that ____.
A.does not allow elements to be inserted in any position.
B.only allows items to be added at one end and removed at the other end.
C.manages associations between keys and values.
D.should be used when you need to remember the order of elements in the collection.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 102 في هذه المجموعة.
فتح الحزمة
k this deck
14
A collection without an intrinsic order is called a ____.
A.queue
B.stack
C.set
D.list
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 102 في هذه المجموعة.
فتح الحزمة
k this deck
15
Select an appropriate expression to complete the following code segment, which is designed to print a message if the string stored in name is part of the players collection. Select an appropriate expression to complete the following code segment, which is designed to print a message if the string stored in name is part of the players collection.   A.(players.contains(name)) B.(players.indexOf(name)) C.(players.search(name)) D.(players.equals(name))
A.(players.contains(name))
B.(players.indexOf(name))
C.(players.search(name))
D.(players.equals(name))
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 102 في هذه المجموعة.
فتح الحزمة
k this deck
16
Consider the following code snippet: Consider the following code snippet:   What will this code print when it is executed? A.abcdefghi B.defghiabc C.ghiabcdef D.abcghidef What will this code print when it is executed?
A.abcdefghi
B.defghiabc
C.ghiabcdef
D.abcghidef
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 102 في هذه المجموعة.
فتح الحزمة
k this deck
17
A binary search requires ____ access.
A.sorted
B.random
C.arbitrary
D.sequential
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 102 في هذه المجموعة.
فتح الحزمة
k this deck
18
A collection that allows items to be added only at one end and removed only at the other end is called a ____.
A.set
B.stack
C.queue
D.list
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 102 في هذه المجموعة.
فتح الحزمة
k this deck
19
What type of access does a LinkedList provide for its elements?
A.sorted
B.sequential
C.random
D.semi-random
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 102 في هذه المجموعة.
فتح الحزمة
k this deck
20
A collection that remembers the order of items, and allows items to be added and removed only at one end is called a ____.
A.queue
B.stack
C.list
D.set
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 102 في هذه المجموعة.
فتح الحزمة
k this deck
21
Which Java package contains the LinkedList class?
A.java.lang
B.java.io
C.java.collections
D.java.util
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 102 في هذه المجموعة.
فتح الحزمة
k this deck
22
Which method is NOT part of the ListIterator interface?
A.hasPrevious
B.hasMore
C.add
D.hasNext
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 102 في هذه المجموعة.
فتح الحزمة
k this deck
23
Select an appropriate expression to complete the following method, which is designed to visit the elements in theList and replace each occurrence of the string "hello" with the string "goodbye". Select an appropriate expression to complete the following method, which is designed to visit the elements in theList and replace each occurrence of the string hello with the string goodbye.   A.iterator.next() = goodbye; B.iterator.previous(goodbye); C.iterator.replace(hello, goodbye); D.iterator.set(goodbye);
A.iterator.next() = "goodbye";
B.iterator.previous("goodbye");
C.iterator.replace("hello", "goodbye");
D.iterator.set("goodbye");
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 102 في هذه المجموعة.
فتح الحزمة
k this deck
24
When using a list iterator, on which condition will the IllegalStateException be thrown?
A.Calling next after calling previous.
B.Calling remove after calling previous.
C.Calling remove after calling remove.
D.Calling remove after calling next.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 102 في هذه المجموعة.
فتح الحزمة
k this deck
25
Assume you are using a doubly-linked list data structure with many nodes.What is the minimum number of node references that are required to be modified to remove a node from the middle of the list? Consider the neighboring nodes.
A.3
B.2
C.4
D.1
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 102 في هذه المجموعة.
فتح الحزمة
k this deck
26
Assume you have created a linked list named myList that currently holds some number of String objects.Which of the following statements correctly removes an element from the end of myList?
A.myList.remove();
B.myList.getLast();
C.myList.pop();
D.myList.removeLast();
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 102 في هذه المجموعة.
فتح الحزمة
k this deck
27
Consider the code snippet shown below.Assume that employeeNames is an instance of type LinkedList. Consider the code snippet shown below.Assume that employeeNames is an instance of type LinkedList<String>.   Which element(s) of employeeNames does this loop process? A.elements meeting a condition B.the most recently added elements C.no elements D.all elements Which element(s) of employeeNames does this loop process?
A.elements meeting a condition
B.the most recently added elements
C.no elements
D.all elements
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 102 في هذه المجموعة.
فتح الحزمة
k this deck
28
A ____ is a data structure used for collecting a sequence of objects that allows efficient addition and removal of already-located elements in the middle of the sequence.
A.queue
B.priority queue
C.stack
D.linked list
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 102 في هذه المجموعة.
فتح الحزمة
k this deck
29
The nodes of a(n) ____ linked list class store two links: one to the next element and one to the previous one.
A.array
B.singly
C.randomly
D.doubly
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 102 في هذه المجموعة.
فتح الحزمة
k this deck
30
Assume you have created a linked list named myList that currently holds some number of String objects.Which of the following statements correctly adds a new element to the beginning of myList?
A.myList.insert("Harry");
B.myList.addFirst("Harry");
C.myList.add("Harry");
D.myList.put("Harry");
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 102 في هذه المجموعة.
فتح الحزمة
k this deck
31
You use a(n) ____ to access elements inside a linked list.
A.queue
B.accessor
C.list iterator
D.index
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 102 في هذه المجموعة.
فتح الحزمة
k this deck
32
When using the add method of the ListIterator to add an element to a linked list, which of the following statements is correct?
A.The new element is inserted before the iterator position, and a subsequent call to next would be unaffected.
B.The new element is inserted after the iterator position, and a subsequent call to next would return the new element.
C.The new element is inserted after the iterator position, and a subsequent call to previous would be unaffected.
D.The new element is inserted before the iterator position, and a subsequent call to next would return the new element.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 102 في هذه المجموعة.
فتح الحزمة
k this deck
33
Consider the following code snippet: Consider the following code snippet:   What will this code print when it is executed? A.ghiabcdef B.defghiabc C.abcdefghi D.abcghidef What will this code print when it is executed?
A.ghiabcdef
B.defghiabc
C.abcdefghi
D.abcghidef
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 102 في هذه المجموعة.
فتح الحزمة
k this deck
34
The term ____ is used in computer science to describe an access pattern in which the elements are accessed in arbitrary order.
A.sequential access
B.sorted access
C.arbitrary access
D.random access
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 102 في هذه المجموعة.
فتح الحزمة
k this deck
35
What can a generic class be parameterized for?
A.methods
B.iterators
C.type
D.properties
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 102 في هذه المجموعة.
فتح الحزمة
k this deck
36
When using a list iterator, on which condition will the IllegalStateException be thrown?
A.Calling remove after calling next.
B.Calling remove after calling add.
C.Calling add after calling previous.
D.Calling previous after calling previous.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 102 في هذه المجموعة.
فتح الحزمة
k this deck
37
Which method is NOT part of the ListIterator interface?
A.next
B.delete
C.add
D.previous
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 102 في هذه المجموعة.
فتح الحزمة
k this deck
38
When using a list iterator, on which condition will the NoSuchElementException be thrown?
A.Calling next when you are past the end of the list.
B.Calling remove after calling add.
C.Calling remove after calling previous.
D.Calling next when the iterator points to the last element.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 102 في هذه المجموعة.
فتح الحزمة
k this deck
39
Select an appropriate expression to complete the method below.The method should return the number of times that the string stored in name appears in theList. Select an appropriate expression to complete the method below.The method should return the number of times that the string stored in name appears in theList.   A.theList.next() != null B.iter.hasNext() C.theList.hasNext() D.iter.next() != null
A.theList.next() != null
B.iter.hasNext()
C.theList.hasNext()
D.iter.next() != null
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 102 في هذه المجموعة.
فتح الحزمة
k this deck
40
Select an appropriate expression to complete the following code segment, which is designed to print a message if the string stored in name is the first element of the players linked list. Select an appropriate expression to complete the following code segment, which is designed to print a message if the string stored in name is the first element of the players linked list.   A.(players.getFirst().equals(name)) B.(players[0].equals(name)) C.(players.contains(name)) D.(players.indexOf(name) == 1)
A.(players.getFirst().equals(name))
B.(players[0].equals(name))
C.(players.contains(name))
D.(players.indexOf(name) == 1)
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 102 في هذه المجموعة.
فتح الحزمة
k this deck
41
Which of the following statements about manipulating objects in a map is NOT correct?
A.Use the remove method to remove a value from the map.
B.Use the get method to retrieve a value from the map.
C.Use the keyset method to get the set of keys for the map.
D.Use the add method to add a new element to the map.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 102 في هذه المجموعة.
فتح الحزمة
k this deck
42
Assume that you have declared a set named mySet to hold String elements.Which of the following statements will correctly delete an element from mySet?
A.mySet.delete("apple");
B.mySet.remove("apple");
C.mySet.get("apple");
D.mySet.pop("apple");
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 102 في هذه المجموعة.
فتح الحزمة
k this deck
43
Select an appropriate declaration to complete the following code segment, which is designed to read strings from standard input and display them in increasing alphabetical order, excluding any duplicates. Select an appropriate declaration to complete the following code segment, which is designed to read strings from standard input and display them in increasing alphabetical order, excluding any duplicates.   A.LinkedList<String> words = new LinkedList<>(); B.Set<String> words = new TreeSet<>(); C.Set<String> words = new Set<>(); D.Set<String> words = new HashSet<>();
A.LinkedList words = new LinkedList<>();
B.Set words = new TreeSet<>();
C.Set words = new Set<>();
D.Set words = new HashSet<>();
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 102 في هذه المجموعة.
فتح الحزمة
k this deck
44
Which of the following statements about hash tables is NOT correct?
A.Elements are grouped into smaller collections that share the same characteristic.
B.You can form hash tables holding objects of type String.
C.The value used to locate an element in a hash table is called a hash code.
D.You can add an element to a specific position within a hash table.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 102 في هذه المجموعة.
فتح الحزمة
k this deck
45
Complete the following code, which is intended to print out all key/value pairs in a map named myMap that contains String data for student IDs and names: Complete the following code, which is intended to print out all key/value pairs in a map named myMap that contains String data for student IDs and names:   A.String name = myMap.next(aKey); B.String name = MapKeySet.get(aKey); C.String name = myMap.get(aKey); D.String name = MapKeySet.next(aKey);
A.String name = myMap.next(aKey);
B.String name = MapKeySet.get(aKey);
C.String name = myMap.get(aKey);
D.String name = MapKeySet.next(aKey);
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 102 في هذه المجموعة.
فتح الحزمة
k this deck
46
Consider the following code snippet: Consider the following code snippet:   What will be printed when this code is executed? A.[Mary, John, Robert, Sue] B.[John, Robert, Sue] C.[Mary, Robert, Sue] D.[Mary, John, Sue] What will be printed when this code is executed?
A.[Mary, John, Robert, Sue]
B.[John, Robert, Sue]
C.[Mary, Robert, Sue]
D.[Mary, John, Sue]
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 102 في هذه المجموعة.
فتح الحزمة
k this deck
47
Assume that you have declared a map named myMap to hold String values with Integer keys.Which of the following statements will correctly delete an association from myMap?
A.myMap.remove(3);
B.myMap.remove("apple");
C.myMap.delete(3);
D.myMap.pop(3);
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 102 في هذه المجموعة.
فتح الحزمة
k this deck
48
In a linked list data structure, when does the reference to the first node need to be updated?
I inserting into an empty list
II deleting from a list with one node
III deleting an inner node
A.I and II only
B.I only
C.II only
D.III only
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 102 في هذه المجموعة.
فتح الحزمة
k this deck
49
Which of the following statements about the TreeSet class is NOT correct?
A.Elements are stored in nodes.
B.Elements are arranged in linear fashion.
C.To use a TreeSet, it must be possible to compare the elements.
D.Elements are stored in sorted order.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 102 في هذه المجموعة.
فتح الحزمة
k this deck
50
To create a TreeSet for a class of objects, the object class must ____.
A.implement the Set interface.
B.implement the Comparable interface.
C.create an iterator.
D.create a Comparator object.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 102 في هذه المجموعة.
فتح الحزمة
k this deck
51
Which of the following statements about manipulating objects in a set is correct?
A.If you try to remove an element that does not exist, an exception will occur.
B.If you try to add an element that already exists, an exception will occur.
C.A set iterator visits elements in the order in which the set implementation keeps them.
D.You can add an element at the position indicated by an iterator.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 102 في هذه المجموعة.
فتح الحزمة
k this deck
52
Which of the following statements about manipulating objects in a map is NOT correct?
A.Use the put method to add an element to the map.
B.If you attempt to retrieve a value with a key that is not associated with any value, you will receive a null result.
C.Use the get method to retrieve a value associated with a key in the map.
D.You cannot change the value of an existing association in the map; you must delete it and re-add it with the new values.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 102 في هذه المجموعة.
فتح الحزمة
k this deck
53
Select an appropriate expression to complete the following method, which is designed to return the number of elements in the parameter array numbers.If a value appears more than once, it should be counted exactly once. Select an appropriate expression to complete the following method, which is designed to return the number of elements in the parameter array numbers.If a value appears more than once, it should be counted exactly once.   A.return numbers.length - values.size(); B.return values.size(); C.return numbers.length; D.return values.length();
A.return numbers.length - values.size();
B.return values.size();
C.return numbers.length;
D.return values.length();
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 102 في هذه المجموعة.
فتح الحزمة
k this deck
54
Your program uses a Map structure to store a number of user ids and corresponding email addresses.Although each user must have a unique id, two or more users can share the same email address.Assuming that all entries in the map have valid email addresses, select an appropriate expression to complete the method below, which adds a new id and email address to the map only if the id is not already in use.If the id is already in use, an error message is printed. Your program uses a Map structure to store a number of user ids and corresponding email addresses.Although each user must have a unique id, two or more users can share the same email address.Assuming that all entries in the map have valid email addresses, select an appropriate expression to complete the method below, which adds a new id and email address to the map only if the id is not already in use.If the id is already in use, an error message is printed.   A.!currentEmail.equals(email) B.currentEmail.equals(email) C.currentEmail != null D.currentEmail == null
A.!currentEmail.equals(email)
B.currentEmail.equals(email)
C.currentEmail != null
D.currentEmail == null
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 102 في هذه المجموعة.
فتح الحزمة
k this deck
55
Assume that you have declared a map named myMap to hold String values with Integer keys.Which of the following statements will correctly retrieve the value associated with a key from myMap?
A.myMap.peek(3);
B.myMap.get("apple");
C.myMap.peek("apple");
D.myMap.get(3);
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 102 في هذه المجموعة.
فتح الحزمة
k this deck
56
Which of the following statements about sets is correct?
A.Attempting to remove an element that is not in the set generates an exception.
B.You can add an element to a specific position within a set.
C.A set is a collection of unique elements organized for efficiency.
D.A set allows duplicate values.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 102 في هذه المجموعة.
فتح الحزمة
k this deck
57
Assume that you have declared a set named mySet to hold String elements.Which of the following statements will correctly insert an element into mySet?
A.mySet.put(apple");
B.mySet.insert("apple");
C.mySet.add("apple");
D.mySet.push("apple");
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 102 في هذه المجموعة.
فتح الحزمة
k this deck
58
Which of the following statements about manipulating objects in a set is correct?
A.A set iterator visits elements in the order in which they were added to the set.
B.You can remove an element at the position indicated by an iterator.
C.If you try to add an element that already exists, an exception will occur.
D.You can add an element at the position indicated by an iterator.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 102 في هذه المجموعة.
فتح الحزمة
k this deck
59
Assume that you have declared a map named myMap to hold String values with Integer keys.Which of the following statements will correctly add an association into myMap?
A.myMap.insert(3, "apple");
B.myMap.add(3, "apple");
C.myMap.put(3, "apple");
D.myMap.push(3, "apple");
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 102 في هذه المجموعة.
فتح الحزمة
k this deck
60
Complete the following code, which is intended to print out all key/value pairs in a map named myMap that contains String data for student IDs and names: Complete the following code, which is intended to print out all key/value pairs in a map named myMap that contains String data for student IDs and names:   A.Map<String, String> mapKeySet = myMap.keySet(); B.Set<String, String> mapKeySet = myMap.keySet(); C.Set<String> mapKeySet = myMap.keySet(); D.Set<String> mapKeySet = myMap.getKeySet();
A.Map mapKeySet = myMap.keySet();
B.Set mapKeySet = myMap.keySet();
C.Set mapKeySet = myMap.keySet();
D.Set mapKeySet = myMap.getKeySet();
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 102 في هذه المجموعة.
فتح الحزمة
k this deck
61
Consider the following code snippet:
Map scores;
You expect to retrieve elements randomly by key, and want fastest retrieval times.Which of the following statements will create a structure to support this?
A.scores = new HashMap<>;
B.scores = new Map<>;
C.scores = new TreeMap<>;
D.scores = new TreeSet<>;
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 102 في هذه المجموعة.
فتح الحزمة
k this deck
62
What operation is least efficient in a LinkedList?
A.Linear traversal step.
B.Random access of an element.
C.Adding an element in a position that has already been located.
D.Removing an element when the element's position has already been located.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 102 في هذه المجموعة.
فتح الحزمة
k this deck
63
You need to write a program to simulate the effect of adding an additional cashier in a supermarket to reduce the length of time customers must wait to check out.Which data structure would be most appropriate to simulate the waiting customers?
A.map
B.stack
C.linked list
D.queue
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 102 في هذه المجموعة.
فتح الحزمة
k this deck
64
You need to access values in objects by a key that is not part of the object.Which collection type should you use?
A.Hashtable
B.ArrayList
C.Map
D.Queue
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 102 في هذه المجموعة.
فتح الحزمة
k this deck
65
You want to enumerate all of the keys in a map named myMap whose keys are type String.Which of the following statements will allow you to do this?
A.Set keySet = myMap.getKeySet(); for (String key : keySet) {...}
B.Set keySet = myMap.keySet(); for (String key : keySet) {...}
C.Set keySet = myMap.keys(); for (String key : keySet) {...}
D.Set keySet = myMap.getKeys(); for (String key : keySet) {...}
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 102 في هذه المجموعة.
فتح الحزمة
k this deck
66
You need to access values by an integer position.Which collection type should you use?
A.Queue
B.Map
C.Hashtable
D.ArrayList
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 102 في هذه المجموعة.
فتح الحزمة
k this deck
67
You need to access values using a key, and the keys must be sorted.Which collection type should you use?
A.Queue
B.TreeMap
C.HashMap
D.ArrayList
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 102 في هذه المجموعة.
فتح الحزمة
k this deck
68
Which of the following algorithms would be efficiently executed on an ArrayList?
A.remove first n / 2 elements from a list of n elements
B.add 1 element to the middle of a list with n elements
C.add n / 2 elements to a list with n / 2 elements
D.read n / 2 elements in random order from a list of n elements
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 102 في هذه المجموعة.
فتح الحزمة
k this deck
69
Which of the following statements about hash functions is NOT correct?
A.Using a prime number as a hash multiplier will produce better hash codes.
B.If you supply your own hashCode method for a class, it must be compatible with that class's equals method.
C.A good hash function will minimize the number of objects that are assigned the same hash code.
D.A hash function produces a unique integer-valued hash code value for each distinct object.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 102 في هذه المجموعة.
فتح الحزمة
k this deck
70
An Undo feature in a word processor program that allows you to reverse a previously completed command is probably implemented using which structure type?
A.stack
B.queue
C.hash table
D.linked list
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 102 في هذه المجموعة.
فتح الحزمة
k this deck
71
Assume that you have declared a stack named myStack to hold String elements.Which of the following statements will correctly add an element to myStack?
A.myStack.addItem("apple");
B.myStack.put("apple");
C.myStack.insert("apple");
D.myStack.push("apple");
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 102 في هذه المجموعة.
فتح الحزمة
k this deck
72
Which data structure would best be used for storing a set of numbers and sorting them in ascending order?
A.queue
B.array
C.stack
D.list
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 102 في هذه المجموعة.
فتح الحزمة
k this deck
73
You intend to use a hash set with your own object class.Which of the following statements is correct?
A.You cannot override the hashCode method in the Object class.
B.You can use the hash method of the Objects class to create your own hashCode method by combining the hash codes for the instance variables.
C.You can override the hash method for your class provided that it is compatible with its equals method.
D.Your class's hashCode method does not need to be compatible with its equals method.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 102 في هذه المجموعة.
فتح الحزمة
k this deck
74
You need to access values in the opposite order in which they were added (last in, first out), and not randomly.Which collection type should you use?
A.Hashtable
B.Map
C.Queue
D.Stack
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 102 في هذه المجموعة.
فتح الحزمة
k this deck
75
Using the merge method of the Map interface, which statement correctly updates the wordCount map of type Map to count all of the occurrences of a word in a file?
A.wordCount.merge(word, 1, (k,v) -> v + 1);
B.word.merge(wordCount,(k,v) -> v + 1);
C.word.merge(wordCount, 1, (k,v) -> v + 1);
D.wordCount.merge(word,(k,v) -> v + 1);
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 102 في هذه المجموعة.
فتح الحزمة
k this deck
76
You need to access values in the order in which they were added (first in, first out), and not randomly.Which collection type should you use?
A.Queue
B.Map
C.Stack
D.Hashtable
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 102 في هذه المجموعة.
فتح الحزمة
k this deck
77
Consider the following code snippet:
Map scores;
If you need to visit the keys in sorted order, which of the following statements will create a structure to support this?
A.scores = new HashTable<>;
B.scores = new HashMap<>;
C.scores = new TreeMap<>;
D.scores = new Map<>;
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 102 في هذه المجموعة.
فتح الحزمة
k this deck
78
Using the merge method of the Map interface, which statement correctly updates the salesTotalByDept map of type Map to update the sales total for a dept by an integer sales value?
A.salesTotalByDept.merge(dept, sales,(d,s) -> s + 1);
B.sales.merge(salesTotalByDept, dept, (d,s) -> s + sales);
C.dept.merge(salesTotalByDept, sales, (d,s) -> s + sales);
D.salesTotalByDept.merge(dept, sales, (d,s) -> s + sales);
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 102 في هذه المجموعة.
فتح الحزمة
k this deck
79
Which of the following statements about stacks is correct?
A.A stack implements random retrieval.
B.A stack implements last-in, first-out retrieval.
C.A stack stores elements in sorted order.
D.A stack implements first-in, first-out retrieval.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 102 في هذه المجموعة.
فتح الحزمة
k this deck
80
Which of the following correctly declares a stack that will hold String elements?
A.Stack s = new Stack<>();
B.Stack s = new Stack<>();
C.String s = new Stack();
D.String s = new Stack<>();
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 102 في هذه المجموعة.
فتح الحزمة
k this deck
locked card icon
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 102 في هذه المجموعة.