

MCQOPTIONS
This section includes 721 Mcqs, each offering curated multiple-choice questions to sharpen your Technical Programming knowledge and support exam preparation. Choose a topic below to get started.
551. |
When do you use a sparse array? |
A. | When there are unique elements in the array |
B. | When the array has more occurrence of zero elements |
C. | When the data type of elements differ |
D. | In all of the mentioned cases |
Answer» C. When the data type of elements differ | |
552. |
What is a sparse array? |
A. | Data structure for representing arrays of records |
B. | Data structure that compactly stores bits |
C. | An array in which most of the elements have the same value |
D. | None of the mentioned |
Answer» D. None of the mentioned | |
553. |
What is the worst case time complexity of inserting an element into the sorted array? |
A. | O(nlogn) |
B. | O(logn) |
C. | O(n) |
D. | O(n2) |
Answer» D. O(n2) | |
554. |
What are some of the applications of sorted arrays? |
A. | Commercial computing |
B. | Priority Scheduling |
C. | Discrete Mathematics |
D. | All of the mentioned |
Answer» E. | |
555. |
What is a sorted array? |
A. | Arrays sorted in numerical order |
B. | Arrays sorted in alphabetical order |
C. | Elements of the array are placed at equally spaced addresses in the memory |
D. | All of the mentioned |
Answer» E. | |
556. |
What are some of the disadvantages of parallel arrays? |
A. | Poor locality of reference for non-sequential access |
B. | Very little direct language support |
C. | Expensive to shrink or grow |
D. | All of the mentioned |
Answer» E. | |
557. |
What are the advantages of parallel arrays over the traditional arrays? |
A. | When a language does not support records, parallel arrays can be used |
B. | Increased locality of reference |
C. | Ideal cache behavior |
D. | All of the mentioned |
Answer» E. | |
558. |
What are parallel arrays? |
A. | Arrays of the same size |
B. | Arrays allocated one after the other |
C. | Arrays of the same number of elements |
D. | Arrays allocated dynamically |
Answer» D. Arrays allocated dynamically | |
559. |
What is the time complexity for inserting/deleting at the beginning of the array? |
A. | O(1) |
B. | O(n) |
C. | O(logn) |
D. | O(nlogn) |
Answer» C. O(logn) | |
560. |
What are the advantages of dynamic arrays? |
A. | Locality of reference |
B. | Data cache utilization |
C. | Random access |
D. | All of the mentioned |
Answer» E. | |
561. |
In what type of dynamic array do you divide the array into two parts? |
A. | Hashed Array Tree |
B. | Geometric Array |
C. | Bounded-size dynamic array |
D. | None of the mentioned |
Answer» D. None of the mentioned | |
562. |
Which of the following is the correct syntax to declare an ArrayList in Java? |
A. | ArrayList al = new ArrayList(); |
B. | ArrayList al = new ArrayList[]; |
C. | ArrayList al() = new ArrayList(); |
D. | ArrayList al[] = new ArrayList[]; |
Answer» B. ArrayList al = new ArrayList[]; | |
563. |
How will you implement dynamic arrays in Java? |
A. | Set |
B. | Map |
C. | HashMap |
D. | List |
Answer» E. | |
564. |
The number of items used by the dynamic array contents is its _________ |
A. | Physical size |
B. | Capacity |
C. | Logical size |
D. | Random size |
Answer» D. Random size | |
565. |
What is meant by physical size in a dynamic array? |
A. | The size allocated to elements |
B. | The size extended to add new elements |
C. | The size of the underlying array at the back-end |
D. | The size visible to users |
Answer» D. The size visible to users | |
566. |
What is a dynamic array? |
A. | A variable size data structure |
B. | An array which is created at runtime |
C. | The memory to the array is allocated at runtime |
D. | An array which is reallocated everytime whenever new elements have to be added |
Answer» B. An array which is created at runtime | |
567. |
Which class in Java can be used to represent bit array? |
A. | BitSet |
B. | BitVector |
C. | BitArray |
D. | BitStream |
Answer» B. BitVector | |
568. |
What are some of the applications of bit arrays? |
A. | Used by the Linux kernel |
B. | For the allocation of memory pages |
C. | Bloom filter |
D. | All of the mentioned |
Answer» E. | |
569. |
Identify the disadvantages of bit array |
A. | Without compression, they might become sparse |
B. | Accessing individual bits is expensive |
C. | Compressing bit array to byte/word array, the machine also has to support byte/word addressing |
D. | All of the mentioned |
Answer» E. | |
570. |
Which of the following is an advantage of bit array? |
A. | Exploit bit level parallelism |
B. | Maximal use of data cache |
C. | Can be stored and manipulated in the register set for long periods of time |
D. | All of the mentioned |
Answer» E. | |
571. |
Which of the following bitwise operations will you use to toggle a particular bit? |
A. | OR |
B. | AND |
C. | XOR |
D. | NOT |
Answer» D. NOT | |
572. |
Which of the following bitwise operations will you use to set a particular bit to 0? |
A. | OR |
B. | AND |
C. | XOR |
D. | NAND |
Answer» C. XOR | |
573. |
Which of the following bitwise operations will you use to set a particular bit to 1? |
A. | OR |
B. | AND |
C. | XOR |
D. | NOR |
Answer» B. AND | |
574. |
What is a bit array? |
A. | Data structure for representing arrays of records |
B. | Data structure that compactly stores bits |
C. | An array in which most of the elements have the same value |
D. | None of the mentioned |
Answer» C. An array in which most of the elements have the same value | |
575. |
Which data structure can be used to test a palindrome? |
A. | Tree |
B. | Heap |
C. | Stack |
D. | Priority queue |
Answer» D. Priority queue | |
576. |
Which among the following is not a palindrome? |
A. | Madam |
B. | Dad |
C. | Malayalam |
D. | Maadam |
Answer» E. | |
577. |
Which data structure can be used suitably to solve the Tower of Hanoi problem? |
A. | Tree |
B. | Heap |
C. | Priority queue |
D. | Stack |
Answer» E. | |
578. |
What is the time complexity of the above code? |
A. | O(logn) |
B. | O(n) |
C. | O(1) |
D. | O(nlogn) |
Answer» C. O(1) | |
579. |
What is the time complexity for converting decimal to binary numbers? |
A. | O(1) |
B. | O(n) |
C. | O(logn) |
D. | O(nlogn) |
Answer» D. O(nlogn) | |
580. |
Which is the predefined method available in Java to convert decimal to binary numbers? |
A. | toBinaryInteger(int) |
B. | toBinaryValue(int) |
C. | toBinaryNumber(int) |
D. | toBinaryString(int) |
Answer» E. | |
581. |
Express -15 as a 6-bit signed binary number. |
A. | 001111 |
B. | 101111 |
C. | 101110 |
D. | 001110 |
Answer» C. 101110 | |
582. |
What is the functionality of the following piece of code? public void fun(int x) { q1.offer(x); } |
A. | Perform push() with push as the costlier operation |
B. | Perform push() with pop as the costlier operation |
C. | Perform pop() with push as the costlier operation |
D. | Perform pop() with pop as the costlier operation |
Answer» C. Perform pop() with push as the costlier operation | |
583. |
To implement a stack using queue(with only enqueue and dequeue operations), how many queues will you need? |
A. | 1 |
B. | 2 |
C. | 3 |
D. | 4 |
Answer» C. 3 | |
584. |
After performing these set of operations, what does the final list look contain? InsertFront(10); InsertFront(20); InsertRear(30); DeleteFront(); InsertRear(40); InsertRear(10); DeleteRear(); InsertRear(15); display(); |
A. | 10 30 10 15 |
B. | 20 30 40 15 |
C. | 20 30 40 10 |
D. | 10 30 40 15 |
Answer» E. | |
585. |
What is the time complexity of deleting from the rear end of the dequeue implemented with a singly linked list? |
A. | O(nlogn) |
B. | O(logn) |
C. | O(n) |
D. | O(n2) |
Answer» D. O(n2) | |
586. |
What are the applications of dequeue? |
A. | A-Steal job scheduling algorithm |
B. | Can be used as both stack and queue |
C. | To find the maximum of all sub arrays of size k |
D. | All of the mentioned |
Answer» E. | |
587. |
What is the functionality of the following piece of code? public void function(Object item) { Node temp=new Node(item,trail); if(isEmpty()) { head.setNext(temp); temp.setNext(trail); } else { Node cur=head.getNext(); while(cur.getNext()!=trail) { cur=cur.getNext(); } cur.setNext(temp); } size++; } |
A. | Insert at the front end of the dequeue |
B. | Insert at the rear end of the dequeue |
C. | Fetch the element at the rear end of the dequeue |
D. | Fetch the element at the front end of the dequeue |
Answer» C. Fetch the element at the rear end of the dequeue | |
588. |
What is a dequeue? |
A. | A queue with insert/delete defined for both front and rear ends of the queue |
B. | A queue implemented with a doubly linked list |
C. | A queue implemented with both singly and doubly linked lists |
D. | None of the mentioned |
Answer» B. A queue implemented with a doubly linked list | |
589. |
What is the time complexity to insert a node based on position in a priority queue? |
A. | O(nlogn) |
B. | O(logn) |
C. | O(n) |
D. | O(n2) |
Answer» D. O(n2) | |
590. |
What are the advantages of priority queues? |
A. | Easy to implement |
B. | Processes with different priority can be efficiently handled |
C. | Applications with differing requirements |
D. | All of the mentioned |
Answer» E. | |
591. |
What is not a disadvantage of priority scheduling in operating systems? |
A. | A low priority process might have to wait indefinitely for the CPU |
B. | If the system crashes, the low priority systems may be lost permanently |
C. | Interrupt handling |
D. | None of the mentioned |
Answer» D. None of the mentioned | |
592. |
What is the functionality of the following piece of code? public Object delete_key() { if(count == 0) { System.out.println("Q is empty"); System.exit(0); } else { Node cur = head.getNext(); Node dup = cur.getNext(); Object e = cur.getEle(); head.setNext(dup); count--; return e; } } |
A. | Delete the second element in the list |
B. | Return but not delete the second element in the list |
C. | Delete the first element in the list |
D. | Return but not delete the first element in the list |
Answer» D. Return but not delete the first element in the list | |
593. |
What is the time complexity to insert a node based on key in a priority queue? |
A. | O(nlogn) |
B. | O(logn) |
C. | O(n) |
D. | O(n2) |
Answer» D. O(n2) | |
594. |
Which of the following is not an application of priority queue? |
A. | Huffman codes |
B. | Interrupt handling in operating system |
C. | Undo operation in text editors |
D. | Bayesian spam filter |
Answer» D. Bayesian spam filter | |
595. |
With what data structure can a priority queue be implemented? |
A. | Array |
B. | List |
C. | Heap |
D. | All of the mentioned |
Answer» E. | |
596. |
Which of the following is true about linked list implementation of queue? |
A. | In push operation, if new nodes are inserted at the beginning of linked list, then in pop operation, nodes must be removed from end |
B. | In push operation, if new nodes are inserted at the beginning, then in pop operation, nodes must be removed from the beginning |
C. | In push operation, if new nodes are inserted at the end, then in pop operation, nodes must be removed from end |
D. | None of the mentioned |
Answer» B. In push operation, if new nodes are inserted at the beginning, then in pop operation, nodes must be removed from the beginning | |
597. |
The essential condition which is checked before deletion in a linked queue is? |
A. | Underflow |
B. | Overflow |
C. | Front value |
D. | Rear value |
Answer» B. Overflow | |
598. |
The essential condition which is checked before insertion in a linked queue is? |
A. | Underflow |
B. | Overflow |
C. | Front value |
D. | Rear value |
Answer» C. Front value | |
599. |
In linked list implementation of a queue, the important condition for a queue to be empty is? |
A. | FRONT is null |
B. | REAR is null |
C. | LINK is empty |
D. | None of the mentioned |
Answer» B. REAR is null | |
600. |
In linked list implementation of a queue, from where is the item deleted? |
A. | At the head of link list |
B. | At the centre position in the link list |
C. | At the tail of the link list |
D. | None of the mentioned |
Answer» B. At the centre position in the link list | |