0% found this document useful (0 votes)
10 views1 page

Class 12 Computer Science Practical Guide

The document contains practical exercises for Class 12 Computer Science, including a Python program to calculate the factorial of a number and an SQL query to display students with marks greater than 80. The Python code demonstrates input handling, looping, and outputting results, while the SQL query filters and retrieves specific student data. Sample outputs for both exercises are provided for clarity.

Uploaded by

riteshshastri27
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)
10 views1 page

Class 12 Computer Science Practical Guide

The document contains practical exercises for Class 12 Computer Science, including a Python program to calculate the factorial of a number and an SQL query to display students with marks greater than 80. The Python code demonstrates input handling, looping, and outputting results, while the SQL query filters and retrieves specific student data. Sample outputs for both exercises are provided for clarity.

Uploaded by

riteshshastri27
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

Class 12 Computer Science Practical File

Q1. Write a program to find the factorial of a number.

Code:
n = int(input("Enter a number: "))
fact = 1
for i in range(1, n+1):
fact *= i
print("Factorial:", fact)

Process:
1. Input a number from the user (e.g., 5).
2. Initialize fact = 1.
3. Loop from 1 to n and multiply each value with fact.
4. Print the final value.

Output:
Enter a number: 5
Factorial: 120

Q2. SQL – Write a query to display students with marks > 80.

Query:
SELECT Name, Marks FROM Student WHERE Marks > 80;

Process:
1. Student table has columns (RollNo, Name, Marks, Stream).
2. Apply WHERE Marks > 80 to filter students.
3. Display Name and Marks of qualifying students.

Output:
Name Marks
Ravi 85
Priya 92

You might also like