0% found this document useful (0 votes)
27 views5 pages

UNIT 4,5 Ques

This document outlines 14 units covering C programming concepts related to structures and file handling. Some key points include: 1. How to define and access structure members, and write programs to store and print data like names and addresses using structures. 2. The differences between structures and unions, and how to implement structures using arrays. 3. How to open, read, write, and manipulate data in text and binary files using functions like fopen(), fread(), fwrite(), fseek(), feof(), etc. 4. Techniques for file operations like adding, deleting, searching records in an indexed sequential file, reading and writing data to different files, and appending information to the end of an existing

Uploaded by

ripowa6483
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)
27 views5 pages

UNIT 4,5 Ques

This document outlines 14 units covering C programming concepts related to structures and file handling. Some key points include: 1. How to define and access structure members, and write programs to store and print data like names and addresses using structures. 2. The differences between structures and unions, and how to implement structures using arrays. 3. How to open, read, write, and manipulate data in text and binary files using functions like fopen(), fread(), fwrite(), fseek(), feof(), etc. 4. Techniques for file operations like adding, deleting, searching records in an indexed sequential file, reading and writing data to different files, and appending information to the end of an existing

Uploaded by

ripowa6483
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/ 5

UNIT 4

1. Write a program using strictures to display the following


information for each customer name, account number, street,
city, old balance, current payment, new balance, account
status. [16 marks]
2. Define Structure and write the general format for declaring
and accessing members. [16 marks]
3. (a) Write a program to store and print name, address roll
no using structures.
(b) What are the differences between structure and unions.
Explain [8-8 marks]
4. Evaluate complex number using structure and pointer. [16
marks]
5. (a) How structure is implemented using arrays? Give an
example
(b) Compare structure and union. [10-6]
6. (a) Differentiate between a structure and union with
respective allocation of memory by the compiler. Given an
example of each.
(b) Write a program to read n records of students and find
out how many of them have passed. The fields are student's
roll no, name, mark and result. Evaluate the result as
follows [6+10 marks]
if marks> 35 then Result "Pass' else 'Fail'
7.(a) What is the difference between union and structure?
(b) Write a program to declare pointer to structure and
display the contents of the structure. Define a structure
object of book with three fields title. Author and pages.
8. (a) What is 'union' in C? How is data stored using union.
(b) Write a program to pass address of a structure variable to
user defined function and display the contents. Use a
structure object boy with three fields: name, age and height.
(6-10 marks
9. (a) What are Bit fields. What are its advantages. What is its
syntax.
(b) Write a C program to store the information of vehicles.
Use bit fields to store the status information. Assume the
vehicle object consists of type, fuel and model member fields.
Assume appropriate number of bits for each field.[8+8)
10, Write a C program to compute the monthly pay of 100
employees using each employee's name, basic-pay. The DA is
computed as 52% of the basic pay. Gross- salary (Basic
pay+DA). Print the employees name and gross salary. [16
marks)
11. (a) Write a C program to illustrate the comparison of
structure variables.
(b) What is the use of a structure? Given an example for a
structure with initialized values. [8+8 marks]
12. (a) Explain with an example how a structure can be
organized in the 'C' language?
(b) Write a C program to print maximum marks in each
subject along with the name of the student by using
structures. Take 3 subjects and 3 students records, [8+8)
13. (a) Distinguish between an array of structures and an
array within a structure. Give an example each.
(b) Write a C program using structure to create a library
catalogue with the following fields, Access number, author's
name. Title of the book, year of publication, publisher's
name, price. [6+10 marks]
……………………………………………………………
1. Write a program for indexed sequential file for the
employee database for the following operation.
(a) Add Record
(b) Delete Record
(c) Search Record based on the department [16 marks]
2. Write a program to read the following data, to find the
value of each item and display the contents of the file. 16
marks]
Item Code Price Quantity
Pen 101 Rs. 20 5
Pencil 103 Rs. 3 100
3. What is the purpose of library function feof()? How feof()
be utilized within a program that updates an unformatted
data file. Explain [16 marks]
4.Describe types of files with an example. [16 marks)
5. Write a program to read series of digits and store them
into a file, then read the numbers from the file and write all
odd & even numbers into different files.[16]
6. (a) Write the syntax for opening a file with various modes
and closing a file
(b) Explain about file handling functions. [8+8]
7. What do you mean by binary files explain with an
example, [16 marks]
8. (a) Write the syntax for opening a file with various modes
and c closing a file.
(b) Explain about file handling functions. [8+8 marks]
9. Write a C program to read a text file and to count
(a) number of characters,
(b) number of words and
(c) number of sentences and write in an output file. [16
marks]
10. Write a C program to replace every 5th character of the
data file, using fseek() command. [16]
11. Write a program to read a C program file and count the
following in the complete C program.
(a) Total number of statements.
(b) Total number of opening brackets. [8-8 marks]
12. Write a C program to read information about the student
record containing student's name, student's age and
student's total marks. Write the marks of each student in an
output file. [16 marks]
13. (a) How does an append mode differs from a write mode.
(b) Compare between printf and fprint f functions,
(c) Write a program to copy upto 100 characters from a file to
an output array (a) Write a C program to read last 'n'
characters of the file using appropriate file 14. function
(b) Write a C program to read a text file and convert the file
contents in capital (upper-case) and write the contents in a
output file. [16 marks]
(a) Distinguish between text mode and binary mode
operation of a file. (b) Write a program to open a pre-existing
file: and add information at the end of file. Display the
contents of the file before and after appending [4+12 marks]

You might also like