Data Structures and Algorithm Quiz: Arrays and Element Access
16 Questions
1 Views

Choose a study mode

Play Quiz
Study Flashcards
Spaced Repetition
Chat to Lesson

Podcast

Play an AI-generated podcast conversation about this lesson

Questions and Answers

In a stack data structure, which of the following statement(s) is/are NOT correct?

  • Top of the Stack always contain the new node
  • Stack has a fixed size (correct)
  • Null link is present in the last node at the bottom of the stack
  • Stack follows FIFO principle

What is the purpose of GETNODE() and RETURNNODE() in a linked list?

  • Deletion and copying
  • Copying and Insertion
  • Insertion and Deletion (correct)
  • Traversing and Deletion

Which type of queue is based on the First In First Out (FIFO) principle?

  • Stack
  • Tree
  • Queue (correct)
  • Linked List

What does 'underflow' mean in the context of a stack?

<p>Stack is empty (C)</p> Signup and view all the answers

Which operation is used to delete an element from a Stack?

<p>Pop (B)</p> Signup and view all the answers

What data structure is needed to convert infix notation to postfix notation?

<p>Stack (C)</p> Signup and view all the answers

Expand LIFO.

<p>Last In First Out (B)</p> Signup and view all the answers

Which data structure follows the Last In First Out (LIFO) principle?

<p>Stack (B)</p> Signup and view all the answers

In general, what is the index of the first element in an array?

<p>0 (C)</p> Signup and view all the answers

What are the advantages of arrays?

<p>Easier to store elements of same data type (D)</p> Signup and view all the answers

What is a collection of items stored at contiguous memory locations?

<p>An array (B)</p> Signup and view all the answers

How do you access an element in an array?

<p>By using the element's index (D)</p> Signup and view all the answers

How is the memory allocated to store the elements in a one-dimensional array?

<p>Contiguous Block (C)</p> Signup and view all the answers

Which of the following creates a two-dimensional array with dimensions 2×2?

<p>int[][] blue = new int[2, 2]; (D)</p> Signup and view all the answers

Which operation is used to visit every single node in a list from first to last?

<p>Traversing (C)</p> Signup and view all the answers

What is a two-dimensional array having the value of majority elements as null?

<p>Sparse Matrix (D)</p> Signup and view all the answers

More Like This

Use Quizgecko on...
Browser
Browser