0% found this document useful (0 votes)
308 views2 pages

CP Assignment 4,5,6 Questions

The document contains 10 questions related to C programming concepts like pointers, arrays, structures, files and file handling functions. Some key topics covered include pointer to arrays and arrays of pointers, dynamic memory allocation, binary search on arrays, recursion, structures, enumerated data types, file I/O functions like fopen(), fclose(), fseek(), ftell(), and comparing/copying files. The questions aim to test understanding of basic as well as advanced C programming concepts.

Uploaded by

Lavanya_123
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
308 views2 pages

CP Assignment 4,5,6 Questions

The document contains 10 questions related to C programming concepts like pointers, arrays, structures, files and file handling functions. Some key topics covered include pointer to arrays and arrays of pointers, dynamic memory allocation, binary search on arrays, recursion, structures, enumerated data types, file I/O functions like fopen(), fclose(), fseek(), ftell(), and comparing/copying files. The questions aim to test understanding of basic as well as advanced C programming concepts.

Uploaded by

Lavanya_123
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

UNIT-4 Assignment Questions

1) Write a program that calculates sum of array elements where array elements can be
accessed using a pointer to an array?

2) Explain character pointer and pointer to a function with examples?


3 .How is dynamic memory allocation done in C? What library functions are provided in C
for dynamic memory allocation?

4 . What is a pointer?,pointer to a pointer ?& explain the advantages of using pointers ?

5. what is array of pointers & pointers to array? Describe the difference b/w them?

6) Write a C program that performs binary search on sorted array of elements and trace the
program with an example?

7) i) Can main() function be called recursively? If so quote an example.
(ii) What is the difference between *p++ and p++?
iii) Give the implementation of multidimensional arrays using pointers. Let the user specify
the number of rows and columns for the array for allocating memory dynamically.
8 i) Explain the effects of the following statements
(i) int a, *b=&a; (ii) a= (float *) &x;
ii) what is wrong with the following code
int *p ;
*p = 10;

9) Define a structure to store the following information of a student-
Roll Number, Name, Grade.
Demonstrate the named initialization of the structure by writing a program which prints
the name and grade of a student given the roll number as input.

10 (i) Define an integer pointer array of 10 numbers. Initialize them to any integer values from
the key board. Find the sum and average of these 10 integers.



UNIT-5 Assignment Questions

1 How is a structure variable different from an array with respect to its use as a function arameter?

2 What is a enumerated data type? How is the initialization of members to enum data type
Done? & Explain about bit-fields in C

3) (i) Compare recursion with iteration. ?
ii) Write a program using structures and functions to compare two dates?.
iii) .What happens if anyone doesnt close a file?
iv) How the structure is passed to a function and explain?

4 Explain C Header files and Preprocessors?

5) i) Write a program using enumerated types which when we given todays date ,will print out
tomorrows date, in the form 31st January.
(ii) Write a program to read a line, at a time from a file. Use fgets() function.
6 .(a) What is a self referential structure and explain with an example ?What is the advantage
of using a self referential structure ?
(b) Explain various operators in C Programming?

7. Write a C program that defines a structure student with members name, average, address
and displays the category of student according to the following criteria
average>=70------Distinction
60<=average<70-------First Class
50<=average<60-------Second Class
40<=average<50--------Third Class
average<40--------Fail

8 )..Define an array of structure for reading a character,integet,float and print them?





UNIT-6 Assignment Questions


1 a) Write a C program that copies the content of one file into another file?
b) Write a C program that reads n numbers and writes even numbers into one file EVEN.txt
and odd number into another file ODD.txt ?

2.Explain fseek(),ftell(),fclose(),rewind() file functions?

3 (a) Explain fseek(), ftell(), rewind(), fclose() file functions.
b)Describe the following
(a) putc() (b) getc() (c) putw() (d) getw()

4 .Describe different file opening modes used with the fopen() function


5.Write a C program to read a text and count all the occurrences of a particular letter given
by the user

6. .What is a file and what are different type of files and explain?

7.write a c program to compare two files.
Expain about fgets(), fputs() , gets() , puts() functions

You might also like