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

Practical C Front Page

This document is a lab file for a C Programming course at Inderprastha Engineering College, outlining various programming tasks across six units. The units cover topics such as arrays, pointers, strings, structures, bitwise operators, and file handling, with specific programming exercises for each topic. It serves as a guide for students to complete their practical assignments for the BCA program for the session 2024-25.

Uploaded by

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

Practical C Front Page

This document is a lab file for a C Programming course at Inderprastha Engineering College, outlining various programming tasks across six units. The units cover topics such as arrays, pointers, strings, structures, bitwise operators, and file handling, with specific programming exercises for each topic. It serves as a guide for students to complete their practical assignments for the BCA program for the session 2024-25.

Uploaded by

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

INDERPRASTHA ENGINEERING

COLLEGE, GHAZIABAD
DEPARTMENT OF COMPUTER APPLICATION

Session 2024-25
BCA-202 C Programming Lab File

Submitted By:
Name: ________________________
Roll Number: __________________

Class: BCA (Year _____,


First Semester _____)
2nd

Submitted To:

Faculty Name: __________________


Index

S. Page
Unit Program Description
No. No.

1 Unit-I: Arrays Input and display elements of an array 1


____
2
2 Find the sum of elements in an array ____

Check whether numbers in an array are even 3


3 ____
or odd

Find maximum and minimum elements in an 4


4 ____
array

5 Count odd and even numbers in an array 5


____

Sort an array in ascending and descending 6


6 ____
order

7 Add two matrices using 2D arrays 7


____

8 Search an element in an array 8


____

9 Unit-II: Pointers Print the address and value of a variable 9


____

10 Swap two numbers using pointers 10


____

Find area and perimeter of a circle using a 11


11 ____
function

Demonstrate pointer arithmetic 12


12 ____
(increment/decrement)

13 Demonstrate pointer to pointer 13


____

14 Create an array of pointers with integer values ____


14

Use malloc() to allocate memory for an 15


15 ____
integer array

Pass pointer to a function and modify original 16


16 ____
value

17 Unit-III: Strings Read and print a string 17


____

Find length and copy a string (with and 18


18 ____
without library functions)
S. Page
Unit Program Description
No. No.

Concatenate two strings and compare two 19


19 ____
strings

Convert lowercase to uppercase and vice 20


20 ____
versa

Count lowercase, uppercase, and special 21


21 ____
symbols in a string

22 Reverse a string and check palindrome 22


____

23 Unit-IV: Structures and Unions Define and display a Student structure 23


____

Assign value to a structure field using 24


24 ____
strcpy()

Define and display a nested Employee 25


25 ____
structure

26 Define a union and observe memory behavior 26


____

27 Passing a structure to a function 27


____

28 Array of structures 28
____

29 Pointer to structure 29
____

Unit-V: C Preprocessor and Find area using macro functions (circle, 30


30 ____
Bitwise Operators square, equilateral triangle)

31 Check even/odd using bitwise AND operator 31


____

32 Unit-VI: File Handling Create a file, write content, and close 32


____

33 Read file contents and display 33


____

34 Append content to a file 34


____

35 Copy contents from one file to another 35


____

Count characters, words, and lines in a text 36


36 ____
file

37 Remove a word from a text file 37


____

Copy file contents using command-line 38


38 ____
arguments
BCA-202: C Programming
(Lab File)

UNIT-I: Arrays
1. Write a program in C to input and display elements of an array.
2. Write a program in C to find the sum of elements in an array.
3. Write a program in C to find whether each number in an array is even or odd.
4. Write a program in C to find the maximum and minimum elements in an array.
5. Write a program in C to count the total number of odd and even numbers in an
array.
6. Write a program in C to sort an array in ascending and descending order.
7. Write a program in C to add two matrices using a two-dimensional array.
8. Write a program in C to search for an element in a given array (linear search).

UNIT-II: Pointers
1. Write a program in C to print the address and value of a variable using pointers.
2. Write a program in C to swap two numbers using pointers.
3. Write a program in C to find the area and perimeter of a circle using a single
function.
4. Write a program in C to demonstrate pointer arithmetic by incrementing and
decrementing a pointer.
5. Write a program in C to demonstrate the use of a pointer to a pointer.
6. Write a program in C to create an array of pointers and initialize it with
different integer values.
7. Write a program in C to use malloc() to dynamically allocate memory for an
integer array and take input from the user.
8. Write a program in C to pass a pointer to a function and modify the original
value.

UNIT-III: Strings
1. Write a program in C to read and print a string.
2. Write a program in C to find the following string operations both with and
without using library functions:
a) Find the length of the string.
b) Copy one string into another.
3. Write a program in C to concatenate two strings and compare two strings.
4. Write a program in C to convert all lowercase letters into uppercase and vice
versa in a string.
5. Write a program in C to count the number of lowercase letters, uppercase
letters, and special symbols in a string.
6. Write a program in C to reverse a string and check whether it is a palindrome or
not.

UNIT-IV: Structures and Unions


1. Write a program in C to define a structure Student with members roll number,
name, and marks. Read and display the values.
2. Write a program in C to create a structure Student with a character array for
name and use strcpy() to assign a value to it.
3. Write a program in C to define a nested structure for Employee, containing a
structure Date inside. Read and display the values.
4. Write a program in C to define a union with members int i and char ch.
Assign values and observe the memory behavior.
5. Write a program in C to demonstrate passing a structure to a function.
6. Write a program in C to demonstrate an array of structures.
7. Write a program in C to demonstrate a pointer to a structure.

UNIT-V: C Pre-processor and Bitwise Operators


1. Write a program in C to find the area of the following shapes using macro
functions:
o Circle
o Square
o Equilateral triangle
2. Write a program in C to check whether a number is even or odd without using
the modulus operator %. Use the bitwise AND (&) operator.

UNIT-VI: File Handling


1. Write a program in C to create a file, write contents into it, save and close the
file.
2. Write a program in C to read file contents and display them on the console.
3. Write a program in C to append content to an existing file.
4. Write a program in C to copy contents from one file to another file.
5. Write a program in C to count characters, words, and lines in a text file.
6. Write a program in C to remove a specific word from a text file.
7. Write a program in C to copy contents from one file to another using command-
line arguments.

You might also like