Вы находитесь на странице: 1из 3

ICFAI Foundation for Higher Education, Faculty of Science & Technology

COMPUTER PROGRAMMING – II (TA 121)


Second Semester 2014-15
Tutorial V –Lecture No.10-20
List, Linked list & Stacks

1. Generally collection of nodes is called______________________

2. In the Linked list each node contain minimum two fields ,one field is called data stores data
and another field is called _______________________

3. What are the basic operations on stack

4.What is the basic property of stack

5. Give examples of restricted list

6. What is self reference pointer and declare self reference pointer for the following structure
struct node
{
int data;
struct node *p;
}*head=NULL;

7.In the above structure what is head


8.Consider the following linked list representation
struct node
{
int data;
struct node *link;
}*head=NULL:
struct node *new_node;
which of the following statement is used to create new node
a. new_node=(struct node *)malloc(sizeof(struct node));
b. new_node=(struct *)malloc(sizeof(struct node));
c.new_node=(struct node)malloc(sizeof(struct node));
d.new_node=(struct node *)malloc(struct node);

9. struct node
{
int data;
struct node *link;
}*head=NULL:
Consider the above representation and predict what will be printed on screen by the following
statement
head->link->data
a. Access data of 1st node
b. Access data of 2nd node
c. Access data of 3rd node
d. Access data of head node

10. Consider the following linked list and node structure

struct node
{
int data;
struct node *link;
}*head=NULL:
What will be the value of the following statement
head -> link-> link -> link -> data
11.

if start is pointing to first node of linked list then consider the following statement
start=start->next;
current=start->next;
what will be the value of address of current

12. Consider the following Scenario

a. The five items : P,Q,R,S and T are inserted into a stack A one after other starting from from T in
reverse order
b. The stack is popped three times and each item is inserted into another stack B
c. The two elements are deleted from the stack B and pushed back onto to the stack A

what are the top most elements stack A and stack B respectively

13. Stack has three elements in it say X,Y and Z with X is on top

a. Stack B is empty
b. An element popped from stack A can be printed immediately or pushed to stack B
c. An element popped from stack B can only be printed
in the arrangement which of the following permutation of X,Y and Z are not possible ?

a. Z Y X
b. Y X Z
c. Y Z X
d. Z X Y
14. write a C statement allocate memory for one node using calloc() function

15. ………… is very useful in situation when data have to stored and then retrieved in reverse order.
a. Stack
b. Queue
c. List
d. Link list

Вам также может понравиться