Question

5. What will be the output of the following program? . A NullPointer Exception will be...

5. What will be the output of the following program?

. A NullPointer Exception will be thrown.

b. value1
  value2

c. value1

d. value1
  null

13. What data structure is a prime number used with?
   a. Stack  
   b. Queue  
   c. Array  
   d. Hash table

14.  For the starting permutation [3, 57, 64, 54, 1, 35, 98], what are the steps to bubble sort into a sorted arrangement of [1, 3, 35, 54, 57, 64, 98]?
   a. [1, 3, 35, 54, 57, 64, 98] -> [3, 54, 1, 35, 57, 64, 98] -> [3, 57, 64, 54, 1, 35, 98] -> [3, 1, 35, 54, 57, 64, 98] -> [1, 3, 35, 54, 57, 64, 98] -> [3, 57, 54, 1, 35, 64, 98] -> [1, 3, 35, 54, 57, 64, 98]  
   b. [3, 57, 64, 54, 1, 35, 98] -> [3, 57, 54, 1, 35, 64, 98] -> [3, 54, 1, 35, 57, 64, 98] -> [3, 1, 35, 54, 57, 64, 98] -> [1, 3, 35, 54, 57, 64, 98] -> [1, 3, 35, 54, 57, 64, 98]  
   c. [1, 3, 35, 54, 57, 64, 98] -> [3, 57, 64, 54, 1, 35, 98] -> [3, 1, 35, 54, 57, 64, 98] -> [1, 3, 35, 54, 57, 64, 98] -> [3, 57, 54, 1, 35, 64, 98] -> [3, 54, 1, 35, 57, 64, 98]  
   d. [3, 1, 35, 54, 57, 64, 98] -> [1, 3, 35, 54, 57, 64, 98] -> [1, 3, 35, 54, 57, 64, 98] -> [3, 57, 64, 54, 1, 35, 98] -> [3, 57, 54, 1, 35, 64, 98] -> [3, 54, 1, 35, 57, 64, 98]

15. How is prime factorization a hard problem?
   a. Multiplying prime numbers is difficult  
   b. Finding the prime factors multiplied for a number is hard  
   c. Prime factorization uses division  
   d. Prime factorization is NP-complete  

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

13)hash table

14)b

15)b

Finding the prime factors multiplied for a number is hard  

Add a comment
Know the answer?
Add Answer to:
5. What will be the output of the following program? . A NullPointer Exception will be...
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
  • Given a singly linked list contains 5 nodes, which simply shows as 5->4->3->2->1, what is the...

    Given a singly linked list contains 5 nodes, which simply shows as 5->4->3->2->1, what is the value that you can find in the second node of the remaining list if the following statements are applied? Assume head reference refers the first node of the list. Node prev = head; Node curr = head. next; while(curr.next!=null) { if(prev.element > 3) { prev = curr; curr = curr.next; } else break; } head = prev.next; Question 3 options: 3 2 4 1...

  • == Programming Assignment == For this assignment you will write a program that controls a set...

    == Programming Assignment == For this assignment you will write a program that controls a set of rovers and sends them commands to navigate on the Martian surface where they take samples. Each rover performs several missions and each mission follows the same sequence: deploy, perform one or more moves and scans, then return to base and report the results. While on a mission each rover needs to remember the scan results, in the same order as they were taken,...

  • 1. What is output by the following code: ArrayList< Integer > a = new ArrayList< Integer...

    1. What is output by the following code: ArrayList< Integer > a = new ArrayList< Integer >(); ArrayList b = a; a.add(new Integer(4)); b.add(new Integer(5)); a.add(new Integer(6)); a.add(new Integer(7)); System.out.println(b.size()); A)1 B)2 C)3 D)4 E)5 2. Assume the Student and Employee classes each extend the Person class. The Student class overrides the getMoney method in the Person class. Consider the following code:     Person p1, p2, p3;     int m1, m2, m3;     p1 = new Person();     m1 = p1.getMoney();     // assignment 1...

  • Written in Java Your job is to produce a program that sorts a list of numbers...

    Written in Java Your job is to produce a program that sorts a list of numbers in ascending order. Your program will need to read-in, from a file, a list of integers – at which point you should allow the user an option to choose to sort the numbers in ascending order via one of the three Sorting algorithms that we have explored. Your program should use the concept of Polymorphism to provide this sorting feature. As output, you will...

  • For determining half-lives of radioactive isotopes, it is important to know what the background radiation is...

    For determining half-lives of radioactive isotopes, it is important to know what the background radiation is in a given detector over a specific period. The following data were taken in a y -ray detection experiment over 98 ten-second intervals: 58 50 57 58 64 63 54 64 59 41 43 56 60 50 46 59 54 60 59 60 67 52 65 63 55 61 68 58 63 36 42 54 58 54 40 60 64 56 61 51 48...

  • C++ Sorting and Searching 1. Mark the following statements as true or false. a. A sequential...

    C++ Sorting and Searching 1. Mark the following statements as true or false. a. A sequential search of a list assumes that the list elements are sorted in ascending order. b. A binary search of a list assumes that the list is sorted. 2. Consider the following list: 63 45 32 98 46 57 28 100 Using a sequential search, how many comparisons are required to determine whether the following items are in the list or not? (Recall that comparisons...

  • The task involves writing a C++ program that determines the prime numbers between 1 and 100....

    The task involves writing a C++ program that determines the prime numbers between 1 and 100. The steps you should follow to identify the prime numbers are the following. 1. The number 1 is not a prime number, so it should be scratched. 2. Starting from the first prime number, which is 2, you scratch all the numbers that are the multiple of 2. You should not scratch out 2 itself. 3. The next number in the sequence after the...

  • 1) (10 pts) What are the worst case run times of each of the following operations?...

    1) (10 pts) What are the worst case run times of each of the following operations? Make sure to list your answer in terms of the appropriate variables in the prompt. Note that on occasion, some of the run times won't be dependent on some of the variables listed in the prompt. (a) Inserting an item to the front of a linked list of n elements. (b) Sorting n integers using Quick Sort. (c) Merging a sorted list of a...

  • JAVA LANG PLEASE: I have follwed these below guidelines but when i run my queue test...

    JAVA LANG PLEASE: I have follwed these below guidelines but when i run my queue test it is not executing but my stack is working fine, can you fix it please! MyQueue.java Implement a queue using the MyStack.java implementation as your data structure.  In other words, your instance variable to hold the queue items will be a MyStack class. enqueue(String item): inserts item into the queue dequeue(): returns and deletes the first element in the queue isEmpty(): returns true or false...

  • 6. For each of the following situations, which of these ADTS (1) Queue ADT (2) Stack...

    6. For each of the following situations, which of these ADTS (1) Queue ADT (2) Stack ADT (3) Ranked (on Positional) Sequence ADT (4) None of these would be most appropriate: a. The customers at the deli counter who take numbers to mark their turn b. An alphabetic list of names c. Integers that need to be sorted d. Execution environments of a recursive function e. A grocery list ordered by the occurrence of the items in the store f....

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