Site icon EDZUMO Pvt. Ltd.

Top GATE questions on data structures – Arrays

GATE 2021 CSE Data structures questions and answers arrays
How to answer data structures questions for GATE

Are you preparing to appear for GATE CSE exams?

Data Structures is one of the most important topics from which you will be asked to answer a lot of questions.

Understanding the array data structure for GATE CSE

Let’s see the main Array concepts you should cover for answering the GATE questions on data structures.

Arrays

If you have a collection of the same type of elements, and also with the same data type, you could use an array to store them. Then, whenever you want to access the stored elements, you can call them using the same name. The characteristic feature of the memory locations occupied by an array is that they are contiguous in nature. In C-programming language, the index of an array starts at ‘0’ and the final position of the index is mentioned as one minus the total size of the array.

Why do we use an array?

Consider this scenario where you have five numbers of data type – integer. You may want to store it somewhere to facilitate further processing. Here, all the elements belong to the same data type. The size of the collection under consideration is fixed. In such cases, you will use an array to store the values. An array is a data structure provided by all programming languages.

Do you know how an array works?

Arrays are container objects. They store a collection of values belonging to the same data type. The collection should have a fixed size as well. At the time of the creation itself, the length of an array has to be declared. Each item stored in an array will have an index value. The elements stored in an array are referred to to their index values. In your program when there is a line calling an array value has reached, the value stored in the index mentioned in your line of code will be retrieved from a contiguous memory location and the value will be further processed.

While attending the GATE questions on data structures you cannot always expect direct questions. You have to be familiar with why and where a concept is being used.

Let’s see the advantages, disadvantages and the programming applications of the array data structure.

What are the advantages of using an array?

What are the disadvantages of using an array?

What are the programming applications of arrays?

When you have to deal with large data, arrays let us store it under a single name. Arrays also give us the flexibility to address the data elements using the same name with reference to the index values. If we hadn’t had arrays, we should have been using multiple variables to store and work with large data sets. It could have been really difficult for programmers to work with bigger data for bigger applications.

While developing your application, if you ever come across the requirement to implement sorting functionality, Arrays will be handy for you. You can easily implement various types of sorting functionality.

If you are dealing with the database records of two-dimensional nature, Arrays will be useful for executing matrix operations. If the application you develop involves certain systemic functions like CPU rescheduling, Arrays can be used to implement that functionality.

Example of an array

 

Fig. 1 GATE data structures questions and answers. Example of an array. Image Courtesy: https://www.geeksforgeeks.org/

How to get GATE questions on data structures on your mobile?

Exit mobile version