0% found this document useful (0 votes)
7 views

Data Structure module 1 (3) (1)

Uploaded by

jivobol408
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
7 views

Data Structure module 1 (3) (1)

Uploaded by

jivobol408
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 4

HKBK COLLEGE OF ENGINEERING

(Affiliated to VTU, Belgaum and Approved by AICTE)


BANGALORE -560045
DEPARTMENT OF ARTIFICIAL INTELLIGENCE AND MACHINE
LEARNING
Data Structure and Application

Question Bank – Module 1

1. What is data structure? How are they classified? what are the various operations on data structures.

2. How do we allocate memory dynamically? Give code snippets for each of the dynamic memory

allocation functions.

3. With example explain the various memory allocation techniques?

4. What is pointer variable? How to declare and initialize a pointer variable. Write a program to swap two

numbers using pointers

5. Write a program to dynamically allocate memory for a one dimensional integer array

6. Briefly explain the representation of multi dimensional array.

7. Explain with an example: Insertion and Deletion in an array.

8. Define structure. Develop a structure to represent the countries in the world. Each country has fields for

the country’s name, its population, and the number of official languages spoken. Place items in each of

the fields for the countries: India and Canada. Write a program to read and print the details of the

countries

9. Write functions for the following

a. Inserting an element in to an array at a specified position

b. Deleting an element at a specified position from the array

10. Write a program to dynamically allocate memory for a one dimensional (1D) integer array, and display

the sum and average of array elements


11. Suppose each student in a class of 25 students is given 4 tests, assume that the students are numbered

from 1 to 25, and the test scores are assigned in the 25X4 matrix called SCORE. Suppose Base

(SCORE) =200 w=4 and the programming language uses row-major order to store this 2D array, then

find the address of 3rd test of 12th student i.e. SCORE (12,3).

12. Write a C Program to Create 1D and 2D Arrays using dynamic memory Allocations. & also freeing the

memory. (OR) What is dynamically allocated arrays? Explain with suitable examples.

13. Explain about the representation of 2 D arrays in memory

14. What is pointer variable? How to declare and initialize a pointer variable. Write a program to swap two

numbers using pointers

15. int a=8; int b=9; int *p=&a; int *q=&b; What is the value of each of the following expression? ++a, ++

(*p), --(*q), --b

16. Define structure. with example show to declare and initialize a structure

17. Write a structure definition to store the usn and name of students. Write a program to read and print the

details of n students

18. Give nested structure definition to store the following data of the employee (emp-name, emp_id, date of

joining (dd,mm yy), salary(basic,DA, HRA)

19. Define Structures .Illustrate different ways of declaring structures with Example

20. Explain self-referential structure with example

21. Write appropriate structure definition and variable declarations to store following information about 50

students: Name, USN, GENDER, DOB and Marks in 3 subjects S1, S2, S3. Date of birth should be a

structure containing fields day, month and year.

22. Develop a structure to represent the planets in the solar system. Each planet has fields for the planet’s

name, its distance from the sun (in miles), and the number of moons it has. Place items in each the fields

for the planets: Earth and Venus


23. Modify the human-being structure so that we can include different information based on marital status.

Marital status should be an enumerated type with fields: single, married, widowed, divorced. Use a

union to include different information based on marital status as follows:

•Single. No information needed.

•Married. Include a marriage date field.

•Widowed. Include marriage date and death of spouse date fields.

•Divorced. Include divorce date and number of divorces fields.

Assign values to the fields for some person of type human-being.

24. Define Union. with example show to declare and initialize a union

25. Difference between structure and union.

26. Explain in detail about the polynomial?

27. With a neat diagram show how the two polynomials, A(x)= 3x3 +5 and B(X)= 5x3 + 2x2 +4x+7 can be

stored in an array.

28. What is Sparse Matrix? Show with a suitable example sparse matrix representation storing as triples.

Give a sample transpose function to transpose sparse matrix.

29. Write a function to find the fast transpose of a sparse matrix.

30. Give the triplet representation and the transpose for the sparse matrix given below. Write a function to

find the transpose of a matrix

31. Explain in detail about representation of Multidimensional Arrays with Example.

32. Explain in detail about String and pattern Matching

33. Implement the stack for an array of integers.

34. Explain how stack can be implemented using dynamic arrays

35. Define Stacks. Write the stack implementations for push and pop functions using arrays (using dynamic

arrays Jan 19) with StackFull & StackEmpty conditions.


36. Write an algorithm to implement a stack using dynamic array whose initial capacity is 1and array

doubling is used to increase the stack’s capacity (i.e. dynamically reallocate twice the memory)

whenever an element is added to full stack. Implement the operations push, pop and display.

37. Write a menu driven program in C for the following operations on STACK of integers,

a)Push an element on to stack.

b)Pop an element from stack.

c)Demonstrate Overflow and Underflow situations on stack.

d)Display the Stack.

38. Convert the following infix expressions to postfix manually and using a stack.

A+B*C

A+B C

(A+B)*(C D)

A$B*C D+E/F/(G+H)

((A+B)*C --(D E))$(F+G)

A B/(C*D$E)

(a+b) * d - e / (f + a * d) +c

A/b–c+d*e–a*c

a+(b+c)+(b/d)*a+z*u

You might also like