Question

I NEED HELP WITH THIS HOMEWORK!!!! What is a characteristic of a bag data type? Elements...

I NEED HELP WITH THIS HOMEWORK!!!!

What is a characteristic of a bag data type?

  • Elements are added and removed in any order
  • Elements are removed in the same order they were added
  • Distinct elements are added in any order but are removed beginning with the last one added
  • Distinct elements are removed in the reverse order they were added

Which scenario illustrates a data stack structure

  • Standing in a line to be serviced
  • Filing documents in alphabetical order
  • Offering services based on the priority of the customer
  • Removing tennis balls from the original canister

3.Which operation maybe performed on an empty stack?

  • Push
  • Append
  • Remove
  • Pop

4.Which data structure provides a means of bundling data and functionality together?

  • List
  • Array
  • Bag
  • Class

5.Which part of the Queue is affected in a deletion operation

  • Top
  • Back
  • Front
  • Middle

6.Which data type stores a collection of items an is unaffected by the order of each inserted item

  • Stack
  • List
  • Bag
  • Queues

7.what is the output of the pseudocode?

Class OPR
{
   Public static viod main(String Args[])
   {
Boolean ans =false;
d(!=ans)
System.out.Print("Done");
      
       else
       System.out.Print("Fail");
          
   }
}

  • Void
  • Args
  • Done
  • Fail

8.what is the output of this java code

Class OPR
{
public static void main(String args[])
   {
   int a=0, j;
       i=10;
  
   a=a +i,
      
       System.out.Print(a)
   }
}

  • 10
  • Syntax error
  • 0
  • Undefined

9.Which value is appropriate for the variable rate given the declaration in the pseudocode

fucntion mystery()
{
String Last;
   String Fist;
   char Middle;
   int Phone;
byte Rate;  

}

  • 10.5
  • -10.25
  • -350
  • 10

10. which assignment represents the initialization of the string value

  • Val = 5
  • Val = “5.5”
  • Val = 5.5
  • Val = 5.0

11. What is the value of the variable num if the value of pi =3.14 in the pseudocode ?

Num = int(pi)

3, 3.4, 3.14, 3.1

12.which data type is used to store the constant data

          “Milk”

  • Int
  • Float
  • String
  • Lang

13.which data type is appropriate to store the data set in an array using Java ?

a = [ -23, 12, -15, 11, -5, 293, 717]

  • Short
  • Byte
  • Boolian
  • Char

14.Which data type in python should be used for this data set?

             RGB = [0.255.0]

  • Enum
  • Tuple
  • Dictionary
  • List

15. Which Data type is appropriate for the innermost contents of the two dimensional array ?

                Maps = [[1,1,1,1,1,1],[1,0,1,0,1,1]]

  • Char
  • Boolean
  • Double
  • Integer

16. what is the correct data type for the variable dt for this code segment ?

dt = what_is_dt ('p', 18, 4.5, false);

return_type what_is_dt (char c, int n, float n2, bool iswhat) {

   if (isWhat) {
   return n * n2;
  
   }
else {
  
return n / n2;      
  
   }
}

  • Bool
  • Float
  • Int
  • Char

17.whats is true about linked allocations ?

  • Insertions and deletions are difficult
  • It circumvents the need for movements of elements during insertions
  • The associated data structure has fixed memory size.
  • Elements of the data structure must be stored in consecutive memory locations

18.what is an advantage of a sequational allocation

  • Memory may be allocated as the need arises
  • Garbage collection is not required
  • Data structure size need not be known at compile time
  • Insertion and deletions are supported

19. How many iterations using a binary search are done until the element is found in an array

arr = {5,6,77,85,99} and key = 85

  • 4
  • 2
  • 1
  • 3

20.what does this function do if the pseudocode takes a queue as an argument and uses a stack S to do the processing

viod fun(Queue *Q)
{
stack S; // it creates an empty stack S
//Run while Q is not empty
while (!is empty(Q))
{ // deQueue an item from Q and push the dequeued item to S
push (69, deQueue(Q));
  
}
// run while Stack S is not Empty

while (! isEmpty(69)) {
//Pop and item from S and enqueue the popped item to Queue

enQueue(Q, pop(69));

}

}

  • Removed the last from Q
  • Makes Q empty
  • Reverses Q
  • Keep Q the same

21. given the c/c++ code: Which identifier is used to access the newly allocated memory when allocation is successful ?


char * buffer = NULL;

/* attemp to allocate Buffer_SIZE characters.*/

buffer = (char *)alloc(BUFFER_SIZE * sizeof(char));

if (buffer ++ NULL) {

/* memory allocation failed */

} else {

/* memory allocation succeeded

}

Char, null, buffer, Buffer_size

22. What is a feature of dictionary data type ?

  • Ordered Values
  • Immutable Keys
  • Ordered Keys
  • Immutable values

23. which operation removed a key-value pair from a dictionary?

Rem, len, Cmp, del

24. what is characteristic of a dictionary?

  • Its an array of ordered pairs
  • It’s a set of single values
  • It’s a set of ordered pairs
  • Its an array of single values

25. what is the output to the terminal given the dictionary defined in this pseudocode?

D = () Multiple choice: (‘first 1’,’second 2, ‘third 3)

D[‘first’] = 1 (1, 2, 3)

D[‘second’] = 2 (‘first’,’second’,’third’)

D[‘third’] = 3 [first: 1, second: 2, third: 3]

Print(d)    

26. A tree has these characteristics

Each node has a unique comparable key and an associated value

Each key in any node is larger then the keys in all nodes in that node’s left subtree.

Each key in any node is smaller than the keys in all nodes in that node’s right subtree.

Which type of tree is this ?

Huffman, Simple Binary Tree, Binary search tree, Ordered Rooted Tree.

27. which method in Java could be used by it self to assign the value 123 to each and every location of an array?

.fill() .append() .put() .push()

28.which type of object may contain a parent-child relationship

Stack, array, tree, list

29. which build in PYTHON function will insert an item into a heap while maintaining the HEAP invariant?

Heap[0] heapci     Heapify(x)   Heappush

30.which data structure is used for FIFO

Dictionary stact tree queue

31. which queue type is absent in Python

Poly Queue, FIFO Queue, Priority Queue, LifoQueue

32. what is the proper parameter list for the heap method heappush?

Heap Index, Heap Item , Item Index, Heap, item, index

33. items were added sequentially onto this stack starting with ‘dog’

Bird, Rabbit, cat, dog

What is the return value of the peek operation ?

34. what is the result of performing the keys operation given dictionary?

[“one”1, “two” 2, “three” 3]

0 0
Add a comment Improve this question Transcribed image text
Answer #1
1)  Elements are added and removed in any order
2)  Removing tennis balls from the original canister
3)  Push
4)  Class
5)  Front

Add a comment
Know the answer?
Add Answer to:
I NEED HELP WITH THIS HOMEWORK!!!! What is a characteristic of a bag data type? Elements...
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
  • I need this ASAP please Choose the data structure from the list at right that best...

    I need this ASAP please Choose the data structure from the list at right that best represents the description at left. Last item added is the first to be removed java.util collections calls this a Map [Choose ] Priority Queue Bag SortedArrayList ArrayList Stack Expression Tree Queue Iterator Binary Search Tree Heap Hash Table Dictionary First item added is the first to be removed Your computer operating system uses one manage processes and job requests when resources are tight. Combines...

  • 5. A three-heap with n elements can be stored in an array A, where A[O] contains...

    5. A three-heap with n elements can be stored in an array A, where A[O] contains the root of the tree. a) Draw the three-heap that results from inserting 5, 2, 8, 3, 6, 4, 9, 7, 1 in that order into an initially empty three-heap. You do not need to show the array representation of the heap. You are only required to show the final tree, although if you draw intermediate trees. b) Assuming that elements are placed in...

  • I was told I need three seperate files for these classes is there anyway to tie...

    I was told I need three seperate files for these classes is there anyway to tie all these programs together into one program after doing that. I'm using netbeans btw. import java.util.ArrayList; import java.util.Scanner; /** * * */ public class MySorts {       public static void main(String[] args) {             Scanner input = new Scanner(System.in);             String sentence;             String again;             do {                   System.out                               .println("Enter a sentence, I will tell you if it is a palindrome: ");...

  • This assignment is comprised of 3 parts: ​All files needed are located at the end of...

    This assignment is comprised of 3 parts: ​All files needed are located at the end of the directions. Part 1: Implementation of Dynamic Array, Stack, and Bag First, complete the Worksheets 14 (Dynamic Array), 15 (Dynamic Array Amortized Execution Time Analysis), 16 (Dynamic Array Stack), and 21 (Dynamic Array Bag). These worksheets will get you started on the implementations, but you will NOT turn them in. ​Do Not Worry about these, they are completed. Next, complete the dynamic array and...

  • In Java. What would the methods of this class look like? StackADT.java public interface StackADT<T> {...

    In Java. What would the methods of this class look like? StackADT.java public interface StackADT<T> { /** Adds one element to the top of this stack. * @param element element to be pushed onto stack */ public void push (T element);    /** Removes and returns the top element from this stack. * @return T element removed from the top of the stack */ public T pop(); /** Returns without removing the top element of this stack. * @return T...

  • Lab 3 – Array-Based Stack and Queue Overview In this assignment, you will be implementing your...

    Lab 3 – Array-Based Stack and Queue Overview In this assignment, you will be implementing your own Array-Based Stack (ABS) and Array-Based Queue (ABQ). A stack is a linear data structure which follows the Last-In, First-Out (LIFO) property. LIFO means that the data most recently added is the first data to be removed. (Imagine a stack of books, or a stack of papers on a desk—the first one to be removed is the last one placed on top.) A queue...

  • I need assistance with this code. Is there any way I can create this stack class (dealing with infix to postfix then postfix evaluation) without utilizing <stdio.h> and <math.h>? ________...

    I need assistance with this code. Is there any way I can create this stack class (dealing with infix to postfix then postfix evaluation) without utilizing <stdio.h> and <math.h>? ____________________________________________________________________________________________ C++ Program: #include <iostream> #include <string> #include <stdio.h> #include <math.h> using namespace std; //Stack class class STACK { private: char *str; int N; public: //Constructor STACK(int maxN) { str = new char[maxN]; N = -1; } //Function that checks for empty int empty() { return (N == -1); } //Push...

  • I need help fixing my code.   My output should be the following. Hello, world! : false...

    I need help fixing my code.   My output should be the following. Hello, world! : false A dog, a panic in a pagoda : true A dog, a plan, a canal, pagoda : true Aman, a plan, a canal--Panama! : true civic : true If I had a hi-fi : true Do geese see God? : true Madam, I’m Adam. : true Madam, in Eden, I’m Adam. : true Neil, a trap! Sid is part alien! : true Never odd...

  • You are given an array of N unsigned chars (symbols) where each symbol is represented by...

    You are given an array of N unsigned chars (symbols) where each symbol is represented by 8-bits Design a Huffman Coder in C++ that returns the length of the codeword for each of the possible 256 symbols and the total number of bits required to encode this data Requirements: After computing the frequency of occurrence of each symbol, you must implement a min-heap (priority queue) to implement the Huffman coder. The function to fill in C++: int HuffmanCoder(vector<unsigned char> &data,...

  • // =================== Support Code ================= // Queue // // // // - Implement each of the functions to create a working circular queue. // - Do not change any of the function declarations // ...

    // =================== Support Code ================= // Queue // // // // - Implement each of the functions to create a working circular queue. // - Do not change any of the function declarations //   - (i.e. queue_t* create_queue(unsigned int _capacity) should not have additional arguments) // - You should not have any 'printf' statements in your queue functions. //   - (You may consider using these printf statements to debug, but they should be removed from your final version) // ==================================================...

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