wayground logo

Free Printable Worksheets

NEW

Font size

S
M
L
XL
Worksheets

DATA STRUCTURES

Total questions: 20

Worksheet time: 10mins

Name
Class
Date
1.

Array data can be accessed using _____

a)

A. Operator

b)

B. Variable

c)

C. index

d)

D. Pointer

2.

Which of the following is an incorrect array declaration?

a)

A. int [] arr = new int[5]

b)

B. int arr[] = new int[5]

c)

C. int arr[] = new int[5]

d)

D. int arr[] = int [5] new

3.

Which of the following is used to declare, construct, and initialize an array?

a)

A. int arr [] [] = {1, 2, 3, 4};

b)

B. int [] arr = (1, 2, 3);

c)

C. int [] arr = {};

d)

D. int arr [] = {1, 2, 3};

4.

In java, array elements are stored in ________ memory locations

a)

A. Random

b)

B. Sequential

c)

C. Sequential & Random

d)

D. Binary search

5.

What will be the output of the program?

class Main

{

public static void main(String args[]) {

int arr[] = {10, 20, 30, 40, 50};

for(int i=0; i < arr.length; i++)

{

System.out.print(" " + arr[i]);

}

}

}

a)

A. 10 20 30 40 50

b)

B. Compiler Error

c)

C. 10 20 30 40

d)

D. None of the above

6.

Minimum number of fields in each node of a doubly linked list is ____

a)

A. 2

b)

B. 3

c)

C. 4

d)

D. 5

7.

A vertex of in-degree zero in a directed graph is called _______

a)

A. Root vertex

b)

B. Source vertex

c)

C. Sink vertex

d)

D. Articulation point

8.

The elements of a linked list are stored

a)

A. In a structure

b)

B. In an array

c)

C. Anywhere the computer has space for them

d)

D. In contiguous memory locations

9.

793+4/*

The evaluation of the above postfix expression is

a)

A. 10

b)

B. 41

c)

C. 9

d)

D. 21

10.

The number of edges in a complete graph of n vertices is_______

a)

A. n(n+1)/2

b)

B. n(n-1)/2

c)

C. n2 /2

d)

D. n

11.

The term push and pop is related to

a)

A. Array

b)

B. List

c)

C. Stack

d)

D. Queue

12.

Which of the following is non-liner data structure?

a)

A. Stack

b)

B. List

c)

C. Graph

d)

D.Array

13.

Identify the data structure which allows deletions at both ends of the list but insertion at only one end.

a)

A. Input restricted dequeue

b)

B. Output restricted dequeue

c)

C. Circular queue

d)

D. Priority queue

14.

The operation of visiting each element in the list is known as ……

a)

A. Sorting

b)

B. Traversing

c)

C. Merging

d)

D. Inserting

15.


Which of the following is a linear data structure?

a)

A. List

b)

B. AVL Tree

c)

C. Binary Tree

d)

D. Graph

16.

When a pop() operation is called on an empty queue, what is the condition called?

a)

A. Overflow

b)

B. Underflow

c)

C. Syntax error

d)

D. Garbage value

17.

A graph is a collection of nodes, called ...... And line segments called arcs or ...... that connect pair of nodes.

a)

A. vertices, paths

b)

B. vertices, edges

c)

C. graph node, edges

d)

D. edges, vertices

18.

In ........, search start at the beginning of the list and check every element in the list.

a)

A. Binary search

b)

B. Binary Tree search

c)

C. Linear search

d)

D. Exponential search

19.

In the ....... traversal we process all of a vertex’s descendants before we move to an adjacent vertex.

a)

A. Depth Limited

b)

B. Breadth First

c)

C. Width First

d)

D. Depth First

20.

Three standards ways of traversing a binary tree T with root R .......

a)

A. Prefix, infix, postfix

b)

B. Pre-process, in-process, post-process

c)

C. Pre-traversal, in-traversal, post-traversal

d)

D. Pre-order, in-order, post-order