Beruflich Dokumente
Kultur Dokumente
Subject: Programming in C
Semester: I
Batch: 2013-15
Q 1) Get a date from user (in the form dd/mm/yyyy) and check whether the date is valid or not. Generate
the next date if the entered date is valid.
Q 2) Generate the following patters using iterative constructs (remember to provide flexibility in terms of
number of rows generated)
1)
A
ABA
ABCBA
ABCDCBA
2)
1
1
1
1
1
1
2
3
4
1
3
1
4
Q 3) Convert a number to a word statement e.g. 1245 should get converted to One thousand two
Practice Exercises
Subject: Programming in C
Semester: I
Batch: 2013-15
Q 8)
Write a menu driven program to perform Create Read Update Delete (CRUD) operations on an
array of structures.
Q 9) Modify the application created in the previous question, so that the data can be saved on
and retrieved from persistent storage.
Q 10)
i)
ii)
iii)
iv)
v)
vi)
Q 13) Write a program to search for a word in a file and replace it with another.
Q 14)
Use formatted I/O to maintain records of students in a text file. The program should provide for
following operations:
i) Insert a record on basis of roll number.
ii) Insert a record on basis of position.
iii) Search for a record.
iv) Modify a record.
v) Remove a record.
vi) Display all records.
vii) Use tab as field separator and new-line as record separator.
Q 15)
i)
ii)
iii)
Practice Exercises
Subject: Programming in C
Q 16)
i)
ii)
iii)
Semester: I
Batch: 2013-15
Q 17) Unions
Define two structures Rectangle and Oval. Use these to define a Union Shape. Write a
function CalculateArea that takes a parameter of type Shape and returns area of appropriate
Shape.
Q 18) Demonstrate the use of callback functions through library function qsort and bsearch to
search for a structure in an array of structures on basis of rollno.
Q 19) Use an integer variable to store the color values RGB (8-bits each) using bit operations.
Write functions to get / set the desired color value.
Q 20) Write a program that uses system calls to read an inode of a file whose name is passed as
command line parameter. The program should display the rights the owner, group members
and others have on the file.
Q 21) Write a program that provides menu options to change the ownership, group ownership
and permissions on the file. The required data can be accepted interactively from the user.
Q 22) Write a program that creates a child process and displays the process id and parent
process ids of both the parent and the child process. The parent process should display its
data after only the child process has terminated.
Q 23) Write a program that displays the contents of the directory (using system) that is passed
as command line parameter. The program should then display a menu providing options to
copy, move or delete the file. The desired operation should be carried through a child
process whose memory area is overlaid with the required shell command.
Q 24) Write a program to demonstrate thread creation. The thread created should simply print a
fixed message as many times as required by the main program (pass data to the thread).
********
Page 3 of 3