## Alpingi.com

#### Freshers Jobs | AMCAT | Fresherworld | JEE | NEET | GATE & CAT

AMCAT coupon code --> ALP100 | Freshersworld Discount Code --> AFF1451AGI

# AMCAT Data Structure Questions (Arrays, Linked Lists, Trees, Graphs)

AMCAT Questions on Computer Programming: Though Computer programming module is not mandatory in AMCAT exam, but it surely gives special weightage to the resume of a candidate. So, its recommended to take up the computer section also.
In Computer science module, one important topic is arrays,linked lists, trees and graphs. Below we will find out more on Data Structure Questions

## AMCAT Data Structure Questions (Arrays, Linked Lists, Trees, Graphs)

Most of all, 3 to 4 questions come in AMCAT from arrays, linked lists, trees and graphs. The level of difficulty is usually easy to average. It can take probably 1-2 minutes to solve the questions. Furthermore, we will see in detail about  array, linked list, trees and graphs.

### Overview of Arrays, Linked Lists, Trees, Graphs

Arrays: Array is a collection of data of same data types. It can be possibly declared in multiple dimensions. Yet, the most commonly used is one dimensional also called as List and two dimensional array which is also referred as matrices.
Syntax:

```int intArray[ 10 ],
float floatArray[ 1000 ];
int tableArray[ 3 ][ 5 ];```

Linked Lists: A linked list is a data structure which contains a sequence of nodes. Each of the node has two fields. First is data field and second one is reference field which is also called as a pointer to point the next node in the sequence.

The node structure has two members:

• ‘data’ stores the information
• ‘next’ pointer holds the address of the next node

Trees: Arrays and linked lists are linear data structures. Trees form hierarchical data structure.

```  tree
----
j    <-- root
/   \
f      k
/   \      \
a     h      z    <-- leaves```

Syntax:

 `struct` `node ` `{` `  ``int` `data;` `  ``struct` `node *left;` `  ``struct` `node *right;` `};`

A Tree node basically contains following three parts.
1. Data
2. Pointer to left child
3. Pointer to right child

Graphs: Graph is also a kind of data structure. It majorly consists of the following two components:

• A limited set of vertices which are also called nodes.
• A finite set of ordered pair in the form of (u,v) is called edge. The pair of form (u, v) indicates that there is an edge from vertex u to vertex v.
• Check out the below figure of a graph

AMCAT Questions on Arrays, Linked Lists, Trees, Graphs

### Practice AMCAT Data Structure Questions

Question 1
He again gets a book with x number of non-leaf nodes. How many total number of nodes will be there for hum color
A. 2x
B. x + 1
C. Log x
D. 2x + 1
Option  D

Question 2
What does the following declaration mean?
int (*ptr)[10];
A. ptr is array of pointers to 10 integers
B. ptr is a pointer to an array of 10 integers
C. ptr is an array of 10 integers
D. ptr is an pointer to array
Option B

Question 3
In C, if you pass an array as an argument to a function, what actually gets passed?
A. Value of elements in array
B. First element of the array
C. Base address of the array
D. Address of the last element of array
Option C
Explanation:
The statement ‘C’ is correct. When we pass an array as a funtion argument, the base address of the array will be passed.

Question 4
What is Dynamic Allocation in Array?
A. Allocation that takes place at compile time
B. Allocation that take place as bipartite graph
C. Memory allocation that takes place during run time rendering the resizing of an Array
D. All of these
Option C

Question 5
Raman is 7 years old and he wants to color a book. The book happens to be about DSA and contains a Complete binary tree with 7 levels, he wants to use different color for every tree nodes. How many colors will he need?
A. 28
B. 31
C.63
D. 127