0% found this document useful (0 votes)
5 views37 pages

Xii CS Practice File

This document is a practical file for a Computer Science course at GUARD Public College, detailing various programming exercises and algorithms. It includes a certificate of completion, an index of practical tasks, and source code examples for each task, such as calculating total marks, generating multiplication tables, and checking for prime numbers. The practical tasks are designed to help students apply their programming skills in C and database creation using MS-Access.

Uploaded by

zeeshanamjad7945
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)
5 views37 pages

Xii CS Practice File

This document is a practical file for a Computer Science course at GUARD Public College, detailing various programming exercises and algorithms. It includes a certificate of completion, an index of practical tasks, and source code examples for each task, such as calculating total marks, generating multiplication tables, and checking for prime numbers. The practical tasks are designed to help students apply their programming skills in C and database creation using MS-Access.

Uploaded by

zeeshanamjad7945
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/ 37

GUARD PUBLIC COLLEGE

PRACTICAL FILE

NAME: _________________________________

FATHER NAME: ___________________________________

CLASS: ____________________________________

SUBJECT: ____________________________________

ROLL NO: ____________________________________

CERTIFICATE
Certified that Mr./Ms.__________________________________
S/O D/O_____________________________________________
Of class _____________________ subject Computer Science

Has carried out the necessary practical work as prescribe by the


Board of Intermediate Education Karachi for the year 2025.

___________________ ________
Head of the department In charge

INDEX
S-NO PRACTICAL DATE SIGN
C-PROGRAMMING
01 Write a program to read the 001marks of 5 subjects calculate the total
marks, percentage and state whether he is pass or fail and then print it
02 Write a program to generate the multiplication table of N
03 Find the factorial of a number n, read value of n using scanf and print the
factorial of n
04 Write a program to input three numbers and print the greater one
05 Write a program that input a number and then check it whether it is
prime or not
06 Write a program that input a year and then check whether it is a leap
year or not
07 Write a program using for loop to print usual printing characters
corresponding to 32 to 127 ASCII Code
08 Write a program which uses a switch and break statement
09 Write a program using nested for loop to print the following output
*
**
***
****
*****
10 Write a program that reads and prints the data using escape sequence (
asking the name, age, height and gender of student using scanf and
printf statement)
11 Write a program which uses airthematic operators to calculate the area
of triangle and volume of sphere
12 Write a program that input any two number and then pass these
numbers as arguments a function sum1 and then print their sum
13 Write a program which print a text of four line consisting of character,
integer value and floating-point value using printf() statement and
escape sequence.
14 Write a program to compute roots of quadratic equation ax2+b+c=0
using quadratic formula
15 Write a program that calculates power of base without using power
function by taking input both
DATA BASE
01 Create a database in MS-Access of Bank Account
02 Create a database in MS-Access of library
03 Create a database in MS-Access of student information
04 Create a database in MS-Access of student result
05 Create a database in MS-Access of student attendance
06 Create a database in MS-Access of hospital
PRACTICAL 01:
Object:01 Write a program to read the marks of five subjects calculate
the total marks, percentage and state whether he/she is pass or fail then
print it.

Algorithm:01

1. Set n = 5 and count =1


2. Repeat W\HILE count <= n
a. Read marks and total marks of n subjects
b. Repeat WHILE marks and total marks are <0 or >100
i. Write invalid marks ii. Read marks again

c. Sum = sum + marks


d. Grand_total = grand_total + max_marks
e. Count = count+1
3. Total = sum
4. Percentage = total / grand_total *100
5. Write total
6. Write percentage
7. Write pass or fail message
8. exit

Source Code:

#include<stdio.h>

int main(void)
{
int n=5, count=1;
float total, percentage, grand_total=0, max_marks, marks, sum=0;
while(count<=n)
{
printf("marks obtained in subject %d\t=",count);
scanf("%f",&marks);
while(marks<0 || marks>100)
{
printf("invalid marks, try again:");
scanf("%f",&marks);
}
printf("total marks in subject %d\t=",count);
scanf("%f",&max_marks); if(max_marks<0 ||
max_marks>100)
{
printf("invalid total marks, try again:");
scanf("%f",&max_marks);
}
sum+=marks;
grand_total+=max_marks;
++count;
}
total=sum;
percentage = total/grand_total*100;
printf("\nYour total marks are = \t% of out of = \t%of", total, grand_total);
printf("\nyour percentage is = \t%2f%",percentage); if(percentage<33)
{
printf("\n\t you have failed");
}
else
{
printf("\n\t congratulations you are passed");
}
getch();
}

OUTPUT:
marks obtained in subject 1 =30 total
marks in subject 1 =100 marks
obtained in subject 2 =40 total
marks in subject 2 =100 marks
obtained in subject 3 =30 total
marks in subject 3 =100 marks
obtained in subject 4 =70 total
marks in subject 4 =100 marks
obtained in subject 5 =90
total marks in subject 5 =100

Your total marks are = 0f out of = 0f


your percentage is = 52.000000
congratulations you are passed PRACTICAL NO: 02

Object:
Write a program to generate the multiplication table of N.
Algorithm no: 02 FLOW CHART
1. set the variables

2. read num
3. write message

4. repeat for i = 1 to 10 Start


staS
a. set power = num x I
b. write table
5. Exit
i = 1, num = 0
Source Code no: 02 power = 0
#include <stdio.h> #include <conio.h>
int main(void)

{ Read n

int num, num1,pow,power,i;

printf("\nEnter The Number of Table: ");


If i<=10
scanf("%d", &num);

printf("\n\n The Table of %d Till 10 Times is as Follow:",num);


Power = num * i
for (i=1;i<=10;i++)

{ power=num*i;

Write num,i,power
printf("\n %d\tx\t%d\t=\t%d",num,i,power);

getch(); i=i+1
}

Stop

OUTPUT:
Enter The Number of Table: 6

The Table of 6 Till 10 Times is as Follow:


6 x 1 = 6
6 x 2 = 12
6 x 3 = 18
6 x 4 = 24
6 x 5 = 30
6 x 6 = 36
6 x 7 = 42
6 x 8 = 48
6 x 9 = 54
6 x 10 = 60
i

PRACTICAL NO : 03
Object:03 Find the factorial of a number n, read value of n using scanf, and print the factorial of n
Algorithm:03
1. Set factorial = 1 FLOW CHART
2. Read num
3. IF n>= 0 then goto Step 4
4. ELSE S Start
5. Write Factorial cannot be done
6. Repeat FOR i <= num
a. factorial = factorial x i Factorial = 1
7. End of FOR loop i = 1, j = 0,
8. Write factorial k = 0, num = 0
9. Exit
Source Code:
#include <stdio.h>
Read num

int main(void) { float num, factorial; factorial = 1;

printf("\nEnter The Number To Get The Factorial: "); no


scanf("%f", &num); If num >=0?

if (num >= 0) {
Yes
for (int i = 1; i <= num; i++) {
factorial = factorial * i;
} If i<=num?
printf("\nThe Factorial of %.0f is %.0f", num, factorial);
} else {
Yes
printf("\nThe Factorial Cannot be done for This no: %.0f", num);
}
Factorial = factorial * i
return 0;
}
i=i+1

Write
factorial

Write
error

Stop
Output:
Enter The Number To Get The Factorial: 9

The Factorial of 9 is 362880


PRACTICAL NO : 04
Object:04
Write a program to input three numbers and print the greater one.
Algorithm:04
1.Declare a function int larg(int) which accepts an integer as an argument and returns an integer value
The Function main
FLOW CHART
2.Write the greater number
3. Exit
4. Defining the Function int larg(int)
5.Read first no
6.Read second no
7.Read third no
8.Start Compare all three Nos and return the Largest
Number Start
To the function Source Code:
#include <stdio.h> #include <string.h> int larg(int);
int first_no,second_no,third_no; int main(void) Write greatest no
{
int largest_no;
printf("\n\n The Largest No is: %d", larg(largest_no));
Call larg ( largest_no )
}
int larg (int)
Stop
{
printf("Enter the First No: \n"); scanf("%d", &first_no);
printf("Enter the Second No: \n"); scanf("%d",
&second_no); printf("Enter the Third No: \n"); scanf("%d", Larg(int n)
&third_no);
if (first_no>second_no && first_no>third_no)
return(first_no);
Read the first , second and
else if (second_no>first_no && second_no>third_no) third no
return(second_no);
else
return(third_no);
}
If 1st no is greater
than 2nd and 3rdno?
yes

no
Return 1st no

If 1st no is greater
than 1st and 3rd no?
yes

no Return 2nd no

If 3rd no is greater
than1st and 2nd no?
yes

no Return 3rd no

Output: stop
Enter the First No:
30
Enter the Second No:
60
Enter the Third No:
1

The Largest No is: 60 PRACTICAL NO : 05


Object:05
Write a program that input a number and then check it Start
whether it is prime or not
Algorithm:05

1 Start FLOW CHART Read num?

2 Read number
3. IF num <= 1 then Write message
Yes
4. Else check if num > 5 then 5. Set i= num%2 j=
num%3 k = num%5 If num <= 1?
6. if I,j and k are not equal to 0 then
7. Write Message
No
8. Else check if num is not equal to 4 then Write Message
9. Else write Error Message
10. Exit
No
Source Code: If num > 5
#include <stdio.h> #include<stdlib.h>
int main(void)
yes
{
int num,i,j,k;
printf("Enter A Natural Number\n");
i = num %2 No
scanf("%d",&num); If i is not equals
j = num %3 to 4
if(num<=1) k = num % 5
{
printf("\n This Number %d is not a Prime Number", num);
Yes
exit(0); }else{ if(num>5)
{ No
If i , j, and k are
i=num%2; j=num%3; k=num%5;
not equal to 0
if(i!=0 && j!=0 && k!=0)
{
printf("\nThis Number %d is a Prime Number", num);
yes
}
else printf("\n This Number %d is not a Prime Number", Write it’s a
num); prime number
}
else if(num!=4) Write its not
{ A prime no

printf("\nThis Number %d is a Prime Number",num);


} Stop
else printf("in This Number %d is not a Prime Number",
num);
}
getch();
}

Output:
Enter A Natural Number
88
This Number 88 is not a Prime Number
PRACTICAL NO : 06
Object:06
Write a program that input a year an then check whether it is a leap
year or not.
Start
Algorithm:06
1. Set i , year , and leap year
FLOW CHART
2. Read year i=0
3. Take the remainder of year from 4 and assign to year = 0
leap leap = 0
4. If leap is equal to 0
5. Write it’s a leap year
6. Else write is not a leap year
7. exit Source Code: #include <stdio.h> Read year
int main(void)
{
int i,year,leap; printf("\nEnter the year: "); scanf("%d",&year);
leap=year%4; Leap = year % 4
if(leap==0)
{
printf("\n The year %d you entered is a leap year", year);
}
else If leap == 0 Write its not
{ a leap year
printf("\n The year %d you entered is not a leap year", year);
}
}
Output:
Write it’s a leap
Enter A Natural Number
year
88

This Number 88 is not a Prime Number

Stop
Output:
Enter A Natural Number
88

This Number 88 is not a Prime Number


PRACTICAL NO : 07
Object:07
Write a program using a for loop to print usual printing characters corresponding to 32 to 127 ASCII code
Algorithm:07
1.Set i = 0 FLOW CHART
2.Write new line
3.Repeat FOR i = 32 and < = 127
Start
4.Write the numeric values of Characters
5.[End of FOR loop]
6.Exit
Source Code: #include <stdio.h> i = 32
int main(void)
{ int i=0; printf("\n");
for(i=32;i<=127;i++)
{
No
printf("%3d=%c\t",i,i); If I <= 127
}
}

Write i and character

Stop
Output:
32= 33=! 34=" 35=# 36=$ 37=% 38=& 39=' 40=( 41=)
42=* 43=+ 44=, 45=- 46=. 47=/ 48=0 49=1 50=2
51=3 52=4 53=5 54=6 55=7 56=8 57=9 58=: 59=;
60=< 61== 62=> 63=? 64=@ 65=A 66=B 67=C 68=D
69=E 70=F 71=G 72=H 73=I 74=J 75=K 76=L 77=M
78=N 79=O 80=P 81=Q 82=R 83=S 84=T 85=U 86=V
87=W 88=X 89=Y 90=Z 91=[ 92=\ 93=] 94=^ 95=_
96=` 97=a 98=b 99=c 100=d 101=e 102=f 103=g 104=h
105=i 106=j 107=k 108=l 109=m 110=n 111=o 112=p
113=q 114=r 115=s 116=t 117=u 118=v 119=w 120=x
121=y 122=z 123={ 124=| 125=} 126=~ 127=⌂
PRACTICAL NO : 08
Object:08
Write a program which uses a witch statement and break statement
Algorithm:08
1. Read the ticket no
FLOW CHART
2. Read the switch variable Start
3. IF switch variable = 122
Write you have won the first prize
IF switch variable = 456 Read ticket
Write you have won the second prize no
IF switch variable = 122
Write you have won the third prize
4. ELSE Write Sorry! Better try next time
5. Exit Write you have
Case 122 won 1st prize
Source Code: #include <stdio.h>
int main(void)
{
int ticket_no;
printf("\n Enter The Ticket Number: ");
Write you have
scanf("%d", &ticket_no);
Case 456 won 2nd prize
switch(ticket_no)
{
case 122: printf("\n You Have Won The First
Prize."); break; case 456: printf("\n You
Have Won The Second Prize."); break; case
16: printf("\n You Have Won The Third Write you have
Prize."); break; default: Case 16 won 3rd prize
printf("\n Sorry!! Better Try Next Time.");
}
}

Write sorry! Try


next time

stop
Output:
Enter The Ticket Number: 456

You Have Won The Second Prize.


PRACTICAL NO : 09
Object:09
Write a program using nested for loop to print the
following output
Start
*
FLOW CHART
**
*** i=1
**** j=1
*****
Algorithm:09
1. Set i and j as variables No
N
2. Outer for loop to be repeated 5 times
If i < = 5
3.Nested inner loop to control specific pattern
4.Write that specific pattern
5.Exit
Yes

Source Code: #include <stdio.h> int No


main(void) If j < = i
{ int i,j;
for(i=1;i<=5;i++) yes
{ for(j=1;j<=i;j++) { printf("*");
} printf("\n");
} Write asterisk *
}

j += 1

Write new line

i += 1

Stop
Output:
*

**

***

****

***** PRACTICAL NO : 10
Object10:
Write a program that reads and prints the data using escape sequence (asking the name, age, height and gender of student
using scanf and print statement) Algorithm:10
1. Read gender FLOW CHART
2. Read name

3. Read age Start


4. Read height
5. Write name
6. Write age Read name, age,
7. Write Height height and gender
8. Write gender
9. exit
Source Code: #include <stdio.h>
int main(void)
{ Write name , age
char gender, name [25]; height and gender
int age; float height;
printf("\nEnter Your Gender (M\\F):; "); scanf ("%c", &gender);
printf("\nEnter Your Name: "); scanf("%s", &name);
printf("\nEnter Your Age (in Years): "); scanf ("%d", &age);
printf("\nEnter Your Height (in ft.): "); scanf ("%f", &height);
printf("\n\tName:\t%s", name); printf("\n\tAge:\t%d",age); Stop
printf("\n\tHeight:\t%0.2f",height);
printf("\n\tGender:\t%c",gender);
}
Enter Your Gender (M\F):; M

Enter Your Name: AHMED

Enter Your Age (in Years): 27

Enter Your Height (in ft.): 5.6

Name: AHMED
Age: 27
Height: 5.60
Gender: M
PRACTICAL NO
: 11
Object:11
Write a program which uses airthematic operators to calculate the area of the triangle and volume of sphere.
Algorithm:11
FLOW CHART
1. Start
2. Set global variable pi
3. Set local variables Start
4. Read height and base of a triangle
5. Read radius of a Sphere
6. Calculate area by means of formula ½ bh Set pi = 3.1415927
7. Calculate volume by using formula = 4/3 πr³
8. Write Area of Triangle and Volume of Sphere
9. Exit Read height and base of a
Source Code: triangle and radius of sphere
#include <stdio.h>
#include <math.h>

#define pi 3.1415927 Set area = ½ (base x height)

int main(void) {
float area, volume, height, base, radius;

printf("\n\n\tEnter the Height of a Triangle: "); Set volume = 4/3 𝜋𝑟^3


scanf("%f", &height);

printf("\n\tEnter the value for Base of a Triangle: ");


scanf("%f", &base);
Write area of a triangle and
printf("\n\tEnter the value for Radius of a Sphere: "); volume of a sphere
scanf("%f", &radius);

area = (1.0 / 2.0) * (base * height);

volume = (4.0 / 3.0) * pi * pow(radius, 3); Stop

printf("\n\n\tArea of a Triangle = %.2f", area);


printf("\n\n\tVolume of Sphere = %.2f", volume);
Output:

return 0;
}

Enter the Height of a Triangle: 2.2

Enter the value for Base of a Triangle: 1.1

Enter the value for Radius of a Sphere: 3

Area of a Triangle = 1.21

Volume of Sphere = 113.10


PRACTICAL NO : 12
Object:12
Write a program that input any two numbers and then pass these numbers as arguments a function sum1 and then print their
sum.
Algorithm:12 FLOW CHART
1.Declare a function int sum1(int x, int y) which accepts two integers as argument and returns sum in integer value
The Function main
2. Read the two numbers
3. Call the function to send the numbers as argument and write the sum value.
4. exit
Defining the Function int sum1(int x, int y)
5 set variable sum Add the two values and Return to calling function Source Code:
#include <stdio.h>

int sum1(int x, int y);

int main(void) { int num1, num2;


printf("\nEnter the two numbers:\n"); scanf("%d %d", &num1, &num2);
printf("\nThe Sum of the TWO Numbers %d and %d is %d", num1, num2,
sum1(num1, num2)); Start
}

int sum1(int x, int y) { int sum = 0; sum = x + y; return sum; Read two
} numbers

Call sum1 (int x , int y)

Write sum of two


numbers

Stop

Sum = x + y

Sum = x + y

Return Sum

Enter the two numbers:


4
5

The Sum of the TWO Numbers 4 and 5 is 9 PRACTICAL NO : 13


Object:13
Output:
Write a program which print a text of four line consisting of character, integer value and floating-point value using printf()
statement and escape sequences.

Algorithm:13 FLOW CHART


1. Start
Start
2. Set variables character, string, integer and floating-
point
3. Read all one by one Read character , string,
4. Write all integer and floating_point
5. exit Source Code: #include <stdio.h> int main(void) {
char character, string[25];
int integer; float floating point; printf("\nEnter a character: ");
character = getchar(); while (getchar() != '\n');
printf("\nEnter a string (up to 25 characters): "); Write character ,
fgets(string, sizeof(string), stdin); printf("\nEnter an integer: "); string, integer and
scanf("%d", &integer); floating_point
printf("\nEnter a floating point number (up to 2 decimal places): ");
scanf("%f", &floating point); printf("\n\tCharacter:\t%c", character);
printf("\n\tString:\t%s", string); printf("\n\tInteger:\t%d", integer);
printf("\n\tFloating No:\t%.2f", floating_point);
return 0; Stop
}

Enter a character: a

Enter a string (up to 25 characters): GUARD PUBLIC COLLEGE

Enter an integer: 12

Enter a floating point number (up to 2 decimal places): 12.222

Character: a
String: GUARD PUBLIC COLLEGE

Integer: 12
Floating No: 12.22
PRACTICAL NO : 14
Object:14
Write a program to compute roots of quadratic equations a x 2 + b + c = 0 using quadratic formula.
Algorithm:14
1. Set root1 = 0 root2 = 0
2. Read a FLOW CHART
3. Read b
Start
4. Read c
5. Call Built-in function square root
a. d = sqrt (b xb-4xaxc)
Root 1 = 0
b. root1 = (-b-d) / (2 x a)
c. root2 = (-b + d) / (2 x a) Root 2 = 0
6. Write two roots
7. Exit
Source Code:
#include <stdio.h> Read a, b, c
#include <math.h>

int main(void) {
float a, b, c, d, root1 = 0, root2 = 0;

d = sqrt (bxb – 4xaxc)


printf("Enter the value of a: "); scanf("%f", &a);

printf("Enter the value of b: "); scanf("%f", &b);

printf("Enter the value of c: "); scanf("%f", &c); Root1 = (-bx-d) / (2xa)

Root2 = (-b x+d) / (2xa)


d = b * b - 4 * a * c;

if (d >= 0) {
Write first root and second
root1 = (-b - sqrt(d)) / (2 * a); root
root2 = (-b + sqrt(d)) / (2 * a);

printf("The two roots are {%.2f, %.2f}\n", root1, root2);


} else {
printf("The discriminant is negative. Roots are imaginary.\n");
Stop
}

Enter the value of a: 1


Enter the value of b: -5
Enter the value of c: 2
The two roots are {0.44, 4.56} PRACTICAL NO : 15
Object:15
Write a program that calculates power of base without using power function by taking input both
Algorithm:15
Output:
1.Read num FLOW CHART
2.Read pow
3.Set power = 1
Start
4.Repeat FOR i < = pow
a. power = power x num
5.Write power
6.Exit Read num
Source Code:
#include <stdio.h>

int main(void) {
float num, pow, power, i; Read pow

printf("\nEnter The Number: "); scanf("%f", &num);

printf("\nEnter The Power: "); scanf("%f", &pow); Power = 1

power = 1;

for (i = 1; i <= pow; i++) {


power *= num; No
} If i <= pow

printf("\nThe Power of %.2f raised to %.2f is %.2f\n", num, pow,


power);
yes
return 0;
}
Power = pow x num

Write the no &


value

Stop

Enter The Number: 8

Enter The Power: 9

The Power of 8.00 raised to 9.00 is 134217728.00 Database practical no : 01


Object:
procedure for creating database of bank accounts

Steps:
1. firstly, go to the search bar and write Access , click on it and it will be open for you.
2. Then click on blank database, write your file name namely BANK ACCOUNTS, save it on your desktop and click on
create.
3. You can see that there is a column on the left side namely, “ All Access objects” there is a drop-down button click on it,
select table object.
4. Now, there is a header above the page, on that header you can see a option namely “View” with a drop down button,
click on that drop down button and select design view.
5. Now in design view there are two columns one is “ fields” and second one is “ data type” 6. Write the fields and data
types which are given below:

Field Name Data type


Acct_ID Number
Acct_Name Text
Acct_Address Text
Acct_phone Text
Acct_Email Text
7. Save that table by clicking right button on the table header and name that table “ Account_Information”
8. Now make another table by clicking “create” in the header file, you’ll see an option namely table, click on it and table
will be created.
9. Now go to the “view” option in the header, click on its drop-down button and go to the design view.
10. Write the fields and data types which are given below.
Field Name Data type
Acct_ID Number
Acct_status Yes/No
11. Save that table by name “ Account_Status”
12. Set Acct_id field as a primary key ( if its not already done)
13. Go to the database tools option, you’ll see an option namely “Relationship” clicks on it and it will create.
14. Now in relationship tab, you can see a column in the right side namely “ Add tables”, and below you can see your both
table which are “Account_Information” and “Account_Status” select both by clicking on the “Add selected table”
button.
15. Now go to the relationship design option which is in the header, in that option you’ll see the option namely “Edit
Relationships” click on it.
16. When you click on it, a prompt will be appeared, click on create new, choose “Table1” in left table name and “Table2”
in right table name. choose “ID” in left and right column name, and then click on create button in the prompt and your
relationship will be established.
17. After making the tables and the relationships, go to the create option, you’ll see a option namely “Query design” click
on it, and your query will be made.
18. Now, you can see a column on the right side namely “add tables” add your both tables by clicking on the “add selected
table” button.
19. After selecting tables, button click on every field in both tables which are required. Save it and name it “ Qry_search”
20. Than created the second query just like the first one, but in that query select only one table namely “Acct_status”,
select every field and than select update from query type and update “Acct_status” of an Acct_Id. Close it and name it
“Qry_Update”.
21. Create the third query just like the 1st and 2nd one but selected delete query from Query type. Set the criteria and
named it “Qry_delete”
22. Now select the option “RUN” on every query and see the results.
OUTPUT:
Database practical no: 02

Object: procedure for creating database of library.

1. firstly, go to the search bar and write Access , click on it and it will be open for you.
2. Then click on blank database, write your file name namely LIBRARY , save it on your desktop and click on create.
3. You can see that there is a column on the left side namely, “ All Access objects” there is a drop-down button click on it,
select table object.
4. Now, there is a header above the page, on that header you can see a option namely “View” with a drop down button, click
on that drop down button and select design view.
5. Now in design view there are two columns one is “ fields” and second one is “ data type” 6. Write the fields and data types
which are given below: Table: library
Field Name Data type
book_ID Number
book_Name Text
book_status Text
7. Save that table by clicking right button on the table header and name that table “ library ” Set book_ID field as a primary
key ( if its not already done)
8. After making the table, go to the create option, you’ll see a option namely “Query design” click on it, and your query will
be made.
9. Now, you can see a column on the right side namely “add tables” add your table by clicking on the “add selected table”
button.
10. After selecting table, click on every field in the table which is required. Save it and name it “ Qry_Books_available_list”
11. Create the second query in the same fashion as the first one but set true as a criteria on status field close it and named it
“Qry_Issued_List”.
12. Now select the option “RUN” on every query and see the results.
Output:

Database Practical No: 3

Object: Procedure for creating Database of student Information

1. firstly, go to the search bar and write Access , click on it and it will be open for you.
2. Then click on blank database, write your file name namely STUDENT INFORMATION , save it on your desktop and click on
create.
3. You can see that there is a column on the left side namely, “ All Access objects” there is a drop-down button click on it,
select table object.
4. Now, there is a header above the page, on that header you can see a option namely “View” with a drop down button,
click on that drop down button and select design view.
5. Now in design view there are two columns one is “ fields” and second one is “ data type” 6. Write the fields and data
types which are given below: Table: Student_Information
Field Name Data type
Stud_ID Number
Stud_Name Text
Stud_Class Text
Stud_Group Text
Stud_gender Text
7. Save that table by clicking right button on the table header and name that table “ Student_Information ” Set book_ID field
as a primary key ( if its not already done)
8. After making the table, go to the create option, you’ll see a option namely “Query design” click on it, and your query will
be made.
9. Now, you can see a column on the right side namely “add tables” add your table by clicking on the “add selected table”
button.
10. After selecting table, click on every field in the table which is required and set “pre_medical” as a criteria on group field
and female on gender field, Save it and name it “ Qry_PE_Female_list”
11. Create the second query in the same fashion as the first one but set “pre_Engineering” as a criteria on group field and
male on gender field, close it and named it “Qry_PE_Male_List”.
12. Now select the option “RUN” on every query and see the results.

OUTPUT:

Database practical no: 04

Object: Procedure for creating Database of students result.

1. firstly, go to the search bar and write Access , click on it and it will be open for you.
2. Then click on blank database, write your file name namely STUDENT RESULT , save it on your desktop and click on create.
3. You can see that there is a column on the left side namely, “ All Access objects” there is a drop-down button click on it,
select table object.
4. Now, there is a header above the page, on that header you can see a option namely “View” with a drop down button,
click on that drop down button and select design view.
5. Now in design view there are two columns one is “ fields” and second one is “ data type” 6. Write the fields and data
types which are given below: Table: Result
Field Name Data type
Stud_ID Number
Stud_Name Text
Stud_Marks Number

7. Save that table by clicking right button on the table header and name that table “ Result ” Set book_ID field as a primary
key ( if its not already done)
8. After making the table, go to the create option, you’ll see a option namely “Query design” click on it, and your query will
be made.
9. Now, you can see a column on the right side namely “add tables” add your table by clicking on the “add selected table”
button.
10. After selecting table, click on every field in the table which is required ,Save it and name it “ Qry_All”
11. Create the second query in the same fashion as the first one but set “Stud_Marks ” field as a Descending Order Close it
and named it “Qry_Marks_Des”.
12. Now select the option “RUN” on every query and see the results.
OUTPUT:
Database Practical no: 05
Object: procedure for creating database of student attendance.

Steps:
1. firstly, go to the search bar and write Access , click on it and it will be open for you.
2. Then click on blank database, write your file name namely STUDENT ATTENDANCE, save it on your desktop and click on
create.
3. You can see that there is a column on the left side namely, “ All Access objects” there is a drop-down button click on it,
select table object.
4. Now, there is a header above the page, on that header you can see a option namely “View” with a drop down button, click
on that drop down button and select design view.
5. Now in design view there are two columns one is “ fields” and second one is “ data type” 6. Write the fields and data types
which are given below: Table: student_info
Field Name Data type
Stud_ID Number
Stud_Name Text
Stud_Address Text
Stud_phone Number
Stud_Email Text
7. Save that table by clicking right button on the table header and name that table “ Student_Info”
8. Now make another table by clicking “create” in the header file, you’ll see an option namely table, click on it and table will be
created.
9. Now go to the “view” option in the header, click on its drop-down button and go to the design view.
10. Write the fields and data types which are given below. Table: Student_Attendance
Field Name Data type
Stud_ID Number
Stud_Attendance Text
11. Save that table by name “ Student_Attendance”
12. Set Acct_id field as a primary key ( if its not already done)
13. Go to the database tools option, you’ll see an option namely “Relationship” clicks on it and it will create.
14. Now in relationship tab, you can see a column in the right side namely “ Add tables”, and below you can see your both table
which are “Student_info” and “Student_Attendance” select both by clicking on the “Add selected table” button.
15. Now go to the relationship design option which is in the header, in that option you’ll see the option namely “Edit
Relationships” click on it.
16. When you click on it, a prompt will be appeared, click on create new, choose “Table1” in left table name and “Table2” in
right table name. choose “ID” in left and right column name, and then click on create button in the prompt and your
relationship will be established.
17. After making the tables and the relationships, go to the create option, you’ll see a option namely “Query design” click on it,
and your query will be made.
18. Now, you can see a column on the right side namely “add tables” add your both tables by clicking on the “add selected
table” button.
19. After selecting tables, button click on every field in both tables which are required. Save it and name it “ Qry_Std_Search”
20. Than created the second query just like the first one, but in that query select only one table namely “Student_info”, select
every field and than select update from query type and update “Stud_ID” of an Acct_Id. Close it and name it
“Qry_Update_StdId”.
21. Create the third query just like the 1st and 2nd one but selected delete query from Query type. Set the criteria and named it
“Qry_delete_Std”
22. Now select the option “RUN” on every query and see the results.

OUTPUT:
Qry_Std_Search

Qry_Update_StdId After
delete:

Qry_Delete_Std
After delete and update:
Database Practical no: 06

Object: Procedure for creating database of hospital

Steps:
1. firstly, go to the search bar and write Access , click on it and it will be open for you.
2. Then click on blank database, write your file name namely HOSPITAL , save it on your desktop and click on create.
3. You can see that there is a column on the left side namely, “ All Access objects” there is a drop-down button click on it,
select table object.
4. Now, there is a header above the page, on that header you can see a option namely “View” with a drop down button, click
on that drop down button and select design view.
5. Now in design view there are two columns one is “ fields” and second one is “ data type” 6. Write the fields and data types
which are given below:
Table: patient
Field Name Data type___
patient_ID Number
patient _Name Text patient _Address
Text
patient _doctor Number
admit_card Text
Discharge_status Yes/No
Discharge_Date Text
Charges Number
7. Save that table by clicking right button on the table header and name that table “ patient”
8. Now make another table by clicking “create” in the header file, you’ll see an option namely table, click on it and table will be
created.
9. Now go to the “view” option in the header, click on its drop-down button and go to the design view.
10. Write the fields and data types which are given below.
Table: Status
Field Name Data type___
patient _ID Number
Date Text
Doctor Text
Test_Report Text
Prescription Text
Disease Text
11. Save that table by name “ Status”
12. Set patient_ID field as a primary key ( if its not already done)
13. Go to the database tools option, you’ll see an option namely “Relationship” clicks on it and it will create.
14. Now in relationship tab, you can see a column in the right side namely “ Add tables”, and below you can see your both table
which are “Student_info” and “Student_Attendance” select both by clicking on the “Add selected table” button.
15. Now go to the relationship design option which is in the header, in that option you’ll see the option namely “Edit
Relationships” click on it.
16. When you click on it, a prompt will be appeared, click on create new, choose “patient” in left table name and “status” in
right table name. choose “ID” in left and right column name, and then click on create button in the prompt and your
relationship will be established.
17. After making the tables and the relationships, go to the create option, you’ll see a option namely “Query design” click on it,
and your query will be made.
18. Now, you can see a column on the right side namely “add tables” add your patient table by clicking on the “add selected
table” button.
19. After selecting tables, button click on every field in the table which are required and set Muhammad Faizan as a doctor.
Save it and name it “ Qry_DrMF”
20. Than created the second query just like the first one, but in that query select only one table namely “Status”, select every
field and than select update from query type and update prescription and set “patient_ID” to K100. Close it and name it
“Qry_Update_Prescription”.
21. Create the third query just like the 1st and 2nd one but selected delete query from Query type. Set the criteria and named it
“Qry_delete_Std”
22. Now select the option “RUN” on every query and see the results. OUTPUT:

Simple view:

After update doctor:

After update prescription:

You might also like