0% found this document useful (0 votes)
74 views4 pages

CITS CSA Solutions

Uploaded by

kanpurnsti21
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)
74 views4 pages

CITS CSA Solutions

Uploaded by

kanpurnsti21
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/ 4

CITS CSA Practical Paper - Step-by-Step Solutions

Q1. Advanced Excel

Q1. Advanced Excel (50 Marks)


Task: Create an employee salary sheet using Excel.

Step-by-step:
1. Create Columns:
A: Employee ID
B: Name
C: Basic Salary
D: HRA (20% of Basic) -> =C2*0.2
E: DA (10% of Basic) -> =C2*0.1
F: Gross Salary -> =C2+D2+E2
G: PF (12% of Basic) -> =C2*0.12
H: Net Salary -> =F2-G2

2. Enter 10 employee records.

3. Apply Table Formatting.

4. Use Conditional Formatting to highlight Net Salary < 20000.

5. Insert Bar Chart for Name vs Net Salary.

Q2. Java - Inheritance Concept

Q2. Java - Inheritance Concept (50 Marks)


Java Program:

class Person {
String name;
int age;
Person(String name, int age) {
this.name = name;
this.age = age;
}
void display() {
System.out.println("Name: " + name);
System.out.println("Age: " + age);
}
}

class Employee extends Person {


String employeeId;
double salary;
Employee(String name, int age, String employeeId, double salary) {
super(name, age);
CITS CSA Practical Paper - Step-by-Step Solutions

this.employeeId = employeeId;
this.salary = salary;
}
void display() {
super.display();
System.out.println("Employee ID: " + employeeId);
System.out.println("Salary: " + salary);
}
}

public class Main {


public static void main(String[] args) {
Employee e = new Employee("Rahul", 30, "E101", 45000.0);
e.display();
}
}

Q3. JavaScript - Cookies

Q3. JavaScript - Cookies (50 Marks)


HTML + JavaScript Code:

<!DOCTYPE html>
<html>
<head><title>Login with Cookies</title></head>
<body>
<div id="welcomeMsg"></div>
<input type="text" id="username" placeholder="Enter username">
<button onclick="login()">Login</button>
<button onclick="logout()">Logout</button>

<script>
function setCookie(cname, cvalue, exdays) {
const d = new Date();
d.setTime(d.getTime() + (exdays*24*60*60*1000));
document.cookie = cname + "=" + cvalue + ";expires=" + d.toUTCString() +
";path=/";
}
function getCookie(cname) {
const name = cname + "=";
const ca = document.cookie.split(';');
for(let i = 0; i < ca.length; i++) {
let c = ca[i].trim();
if (c.indexOf(name) == 0) return c.substring(name.length, c.length);
}
return "";
}
function checkCookie() {
CITS CSA Practical Paper - Step-by-Step Solutions

const user = getCookie("username");


if (user != "") document.getElementById("welcomeMsg").innerText = "Welcome, " +
user;
}
function login() {
const user = document.getElementById("username").value;
if (user) {
setCookie("username", user, 1);
location.reload();
}
}
function logout() {
document.cookie = "username=; expires=Thu, 01 Jan 1970 00:00:00 UTC; path=/;";
location.reload();
}
checkCookie();
</script>
</body>
</html>

Q4. PHP - Form with MySQL

Q4. PHP - Form with MySQL (50 Marks)

HTML Form:
<form action="register.php" method="POST">
Name: <input type="text" name="name"><br>
Email: <input type="email" name="email"><br>
Password: <input type="password" name="password"><br>
Gender: <select name="gender">
<option>Male</option><option>Female</option>
</select><br>
<input type="submit" value="Register">
</form>

register.php:
<?php
$servername = "localhost";
$username = "root";
$password = "";
$dbname = "csa_students";

if (empty($_POST['name']) || empty($_POST['email']) || empty($_POST['password']) ||


empty($_POST['gender'])) {
die("All fields are required.");
}
$conn = new mysqli($servername, $username, $password);
$conn->query("CREATE DATABASE IF NOT EXISTS $dbname");
CITS CSA Practical Paper - Step-by-Step Solutions

$conn->select_db($dbname);
$conn->query("CREATE TABLE IF NOT EXISTS registrations (
id INT AUTO_INCREMENT PRIMARY KEY,
name VARCHAR(100),
email VARCHAR(100),
password VARCHAR(100),
gender VARCHAR(10)
)");
$name = $_POST['name'];
$email = $_POST['email'];
$password = $_POST['password'];
$gender = $_POST['gender'];
$sql = "INSERT INTO registrations (name, email, password, gender)
VALUES ('$name', '$email', '$password', '$gender')";
if ($conn->query($sql) === TRUE) {
echo "Registration successful!";
} else {
echo "Error: " . $conn->error;
}
$conn->close();
?>

Q5. Python - File Handling

Q5. Python - File Handling (50 Marks)

Python Code:
students = []
for i in range(5):
name = input(f"Enter name of student {i+1}: ")
marks = int(input("Enter marks: "))
students.append((name, marks))

with open("students.txt", "w") as f:


for name, marks in students:
f.write(f"{name},{marks}\n")

print("\nStudent Results:")
with open("students.txt", "r") as f:
for line in f:
name, marks = line.strip().split(",")
marks = int(marks)
result = "Pass" if marks >= 40 else "Fail"
print(f"Name: {name}, Marks: {marks}, Result: {result}")

You might also like