Ask Question, Ask an Expert

+61-413 786 465

info@mywordsolution.com

Ask Data Structure Expert

QUESTION 1

You are required to provide suitable examples of your own for each part of the question where appropriate

(a)(i) Define a structure?

(ii) What is a structure member?

(iii) How can structure variables be declared?

(iv) How can the members of a structure variable be assigned initial values?

(v) How can the size of a structure be determined?

(b)(i) What is a union?

(ii) How does a union differ from a structure?

(iii) How is a union member accessed?

(iv) How can a member of a union variable be assigned an initial value?

(v) Explain the rules which apply when processing unions

(c) Write down a structure which contains the following four members-

(i) an integer quantity called student_id

(ii) a 40-element character array called student_name

(iii) an integer quantity called phone_number

(iv) a floating-point quantity called marks

Include the user defined data type 'student' within the definition

QUESTION 2

(a)(i) What is the primary advantage when using data files in programs?

(ii) Describe how data files can be categorized in C

(iii) What is the purpose of a buffer area when working with data files?

(iv) Explain how the buffer area is defined?

(b)(i) What is a stream pointer?

(ii) What is the relationship between a stream pointer and a buffer area?

(iii) Explain the process of opening a data file in C

(c) Read the sample C program given below and answer the questions based on it

#include

main( ){

FILE *opt1, *opt2; char student_name[30];

opt1 = fopen("list.old", "r");

opt2 = fopen("list.new", "w")

......................

fclose(opt1);

fclose(opt2);

}

Write down appropriate statements to perform the following tasks-

(i) Read the string represented by student_name from the file list.old

(ii) Display the result on the screen

(iii) Enter an updated string

(iv) Write the new string to the data file list.new

QUESTION 3

(a) Give two advantages of using 'Linked List' instead of 'arrays' in programs

(b) Write down the definition of a 'linked list' to contain the following-

(i) course_id of datatype integer

(ii) character array course_name of size 40

(iii) floating-point variables duration and fees

(iv) pointer variable next of the same structure type

(v) Include the tag course within the definition

(c)(i) Declare two variables of type course

(ii) Write down appropriate statement(s) to allocate memory to the first node

(d) Write down the function to create the linked list with the nodes declared. This function must also allow the user to terminate the input

QUESTION 4

(a) Explain the following sorting techniques using appropriate algorithms-

(i) selection sort

(ii) bubble sort

(b) Explain how 'linear search' differs from 'binary search' using suitable algorithms

Data Structure, Computer Science

  • Category:- Data Structure
  • Reference No.:- M9134062

Have any Question?


Related Questions in Data Structure

Data Communication Delivering Information anywhere

Topic: Data Communication Delivering Information anywhere. Write a 9-12 pages paper in which you: Present an overview of the origin and history of the concept. Describe the current use of and attitude toward the concept. ...

Problem regarding the management program

Problem: Looks like its just adding a save and load feature to the same file you sent me for python 3.5 Until now, you have had to leave your team management program running on your computer indefinitely since you did no ...

  • 4,153,160 Questions Asked
  • 13,132 Experts
  • 2,558,936 Questions Answered

Ask Experts for help!!

Looking for Assignment Help?

Start excelling in your Courses, Get help with Assignment

Write us your full requirement for evaluation and you will receive response within 20 minutes turnaround time.

Ask Now Help with Problems, Get a Best Answer

Why might a bank avoid the use of interest rate swaps even

Why might a bank avoid the use of interest rate swaps, even when the institution is exposed to significant interest rate

Describe the difference between zero coupon bonds and

Describe the difference between zero coupon bonds and coupon bonds. Under what conditions will a coupon bond sell at a p

Compute the present value of an annuity of 880 per year

Compute the present value of an annuity of $ 880 per year for 16 years, given a discount rate of 6 percent per annum. As

Compute the present value of an 1150 payment made in ten

Compute the present value of an $1,150 payment made in ten years when the discount rate is 12 percent. (Do not round int

Compute the present value of an annuity of 699 per year

Compute the present value of an annuity of $ 699 per year for 19 years, given a discount rate of 6 percent per annum. As