You are on page 1of 2

CHANDIGARH UNIVERSITY

Gharuan, Mohali

Institute/Department: University Institute of Computing


Division: BCA
Subject Name: Computer Programming
Subject Code: CAT-108

Assignment No.: 2
Max. Marks: 12

Last date of Submission: 09 Nov, 2019

Set 1 (19BCA1016 - 19BCA1151)


1. Write down the major difference between structure and union.
2. Write a C program to create a text file using file handling functions. Give glimpse of output
also.
3. Expound the following terms:
(a) fprintf() (b) fscanf()
4. Exemplify array of structure with an example.
5. Demonstrate the pointer arithmetic in detail with relevant examples.
6. Design a program to compare two strings using pointer.

Set 2 (19BCA1152 - 19BCA1182)


1. State the purpose of EOF.
2. How to check whether the file has opened successfully? Elucidate with the help of program.
3. Illustrate the concept of dynamic memory allocation in detail with relevant examples.
4. Write a program to add two distances in inch-feet using structure. The values of the distances
is to be taken from the user.
5. Design a program to copy the content of one file to another.
6. Design a program to compare two strings using pointer.
Set 3 (19BCA1183 - 19BCA1207)
1. Write the number of bytes in memory taken by the following structure.
#include <stdio.h>
struct test
{ int k;
char c; };
2. Design a program to illustrate the reading and writing operations on file.
3. Write a program to store the information (name, roll and marks) of 10 students using
structures.
4. Demonstrate the purpose of following functions in allocating memory dynamically:
(a) realloc() (b) free()
5. Design a program to concatenate two strings using pointer.
6. Design a program to copy the content of one file to another.

Set 4 (19BCA1208 - 19BCA1228)


1. Expound the use of File pointer in brief.
2. Describe the various file related in-built functions in detail with relevant examples.
3. Elucidate the differences between static memory allocation and dynamic memory allocation in
detail.
4. Memory allocation is a very important part of software development. Justify this statement in
detail.
5. Design a program to copy the content of one file to another.
6. Elucidate the difference between array and structure in detail. Give suitable examples.

Set 5 (19BCA1229 - 19BCA1242)


1. State the purpose of using files in C programming.
2. Elucidate the difference between array and structure in detail. Give suitable examples.
3. Enter the marks of 5 students in Chemistry, Mathematics and Physics (each out of 100) using
a structure named Marks having elements roll no., name, chem_marks, maths_marks and
phy_marks and then display the percentage of each student.
4. Exemplify the various methods of opening a file in C program.
5. Write a program to show the use of DMA with pointer.
6. Elucidate the differences between static memory allocation and dynamic memory allocation in
detail.

Set 6 (19BCA1243 - 19BCA1392)


1. Exemplify how to access nested structure member with suitable example.
2. State and elucidate various modes of file opening and file closing.
3. Exemplify the following operations:
(a) creating a structure (b) declaring structure variables
4. Using a structure rather than several arrays is much efficient. Justify this statement with suitable
examples.
5. Design a program to find the length of a string using pointer.
6. Design a program to copy the content of one file to another.

You might also like