Question 1a i what is a pointer illustrate with an

Assignment Help Data Structure & Algorithms
Reference no: EM13349703

QUESTION 1

(a) (i) What is a pointer? Illustrate with an example

(ii) Give two advantages of the use of pointers over arrays

(b) (i) Declare an array called vowel which contains the elements ‘a', ‘e', ‘i', ‘o', and ‘u'. (ii) Declare a pointer ptr of type char which points to the array vowel

(iii) Write down a loop to display the actual address and content of pointer ptr when it points to the different elements of array vowel

(c) (i) Declare an integer array of size ten

(ii) Write down appropriate statements to request the user to enter ten integer numbers into the array created in c (i) above

(iii) Write down appropriate statements which will search the number zero inside the array using linear search algorithm. Include an output statement to print out the number of elements in the array before the zero if it is found

QUESTION 2

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

(ii) How can the size of a structure be determined? In what units is the size reported?

(iii) How is a structure-type pointer variable declared? To what does this type of variable point?

(b) What is a self-referential structure? Illustrate with a suitable example

(c) (i) Define a structure that contains the following members: 1) dvd_name, 2) quantity and 3) cost Include a user-defined data-type movie within the definition

(ii) Now define another structure that contains the following members: 1) batch_id and 2) film of type movie defined above Include the user-defined data type dvd within the definition

(iii) Declare a variable v1 to be a structure variable of type dvd. Write an expression for each member and submember of v1

(iv) Declare a variable v2 to be a structure variable of type dvd and initialize v2 with the following values: dvd_name: Red Dragon quantity: 4 cost: 100 batch_id: 2101

(d) (i) What is the primary advantage to using a data file?

(ii) Describe the different ways in which a data file can be categorized

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

(iv) How is the buffer area defined?

(v) What is meant by opening a data file?

QUESTION 3

(a) Using an appropriate example, explain what is a recursive function?

(b) Write a small program using a function called cumulative that accepts as parameter n and returns the sum of integers between 1 and n inclusive

(c) A student was asked to write a program in C to swap two numbers using a function and pointers. However the student failed to solve the work and the program was left incomplete as shown below. Use the code extract below to complete the program using function and pointers

#include<stdio.h>

void swap(int *, int *);

void main { int a = 23, b = 32; ... ... }

void swap(int *x, int *y) { int temp; .... ..... }

QUESTION 4

(a) Write down the sample code to create a 'Linked List' and allocate storage space for a node

(b) Write down the algorithm to insert an item

(i) At the beginning of a linked list

(ii) In the middle of a linked list

(iii) At the end of a linked list

(c) Write down the sample code to declare a stack

(d) Explain how the binary tree below can be traversed in each of the following ways-

(i) preorder

(ii) inorder

(iii) postorder

361_binary tree.png

Reference no: EM13349703

Questions Cloud

Question1a offer an instance of one alternative renewable : question1a offer an instance of one alternative renewable energy source.b write down an energy transformation equation
Question 1tourism projected onto its anticipated growth : question 1tourism projected onto its anticipated growth requires an urgent integration of preventive approaches in all
Questionthink the sun to be at the origin of a : questionthink the sun to be at the origin of a xy-coordinate system. a telescope spots an asteroid in the xy-plane at a
Questionnbsp 1 soundview centre uses a periodic inventory : questionnbsp 1 soundview centre uses a periodic inventory system. at the end of 2010 the accounting records include the
Question 1a i what is a pointer illustrate with an : question 1a i what is a pointer? illustrate with an exampleii give two advantages of the use of pointers over arraysb i
Question one of sun appliances merchandises is a dishwasher : question one of sun appliances merchandises is a dishwasher. two processing departments are added in the dishwashers
Question1a puck of mass m1 760 g and radius r1 440 cm : question1a puck of mass m1 76.0 g and radius r1 4.40 cm glides across an air table at a speed of 1.50 ms. it makes a
Question the diamond freight company has been provided a : question the diamond freight company has been provided a seven-year contract to haul munitions for the government.
Questionsome of properties of a diatomic molecule no can be : questionsome of properties of a diatomic molecule no can be described in terms of a effortless model in which two atoms

Reviews

Write a Review

Data Structure & Algorithms Questions & Answers

  Implement an open hash table

In this programming assignment you will implement an open hash table and compare the performance of four hash functions using various prime table sizes.

  Use a search tree to find the solution

Explain how will use a search tree to find the solution.

  How to access virtualised applications through unicore

How to access virtualised applications through UNICORE

  Recursive tree algorithms

Write a recursive function to determine if a binary tree is a binary search tree.

  Determine the mean salary as well as the number of salaries

Determine the mean salary as well as the number of salaries.

  Currency conversion development

Currency Conversion Development

  Cloud computing assignment

WSDL service that receives a request for a stock market quote and returns the quote

  Design a gui and implement tic tac toe game in java

Design a GUI and implement Tic Tac Toe game in java

  Recursive implementation of euclids algorithm

Write a recursive implementation of Euclid's algorithm for finding the greatest common divisor (GCD) of two integers

  Data structures for a single algorithm

Data structures for a single algorithm

  Write the selection sort algorithm

Write the selection sort algorithm

  Design of sample and hold amplifiers for 100 msps by using n

The report is divided into four main parts. The introduction about sample, hold amplifier and design, bootstrap switch design followed by simulation results.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd