KEMBAR78
d1 Java Cat-1 Key Paper | PDF | String (Computer Science) | Computing
0% found this document useful (0 votes)
21 views12 pages

d1 Java Cat-1 Key Paper

The document outlines a Continuous Assessment Test for the course 'Object Oriented Programming using JAVA' with a maximum of 50 marks and a duration of 90 minutes. It includes five programming questions that require students to write Java programs for various scenarios, such as determining winners based on name criteria, checking loan eligibility, and calculating employee salaries. Additionally, it provides guidelines for question paper preparation, including Bloom's Taxonomy levels and difficulty levels for questions.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
21 views12 pages

d1 Java Cat-1 Key Paper

The document outlines a Continuous Assessment Test for the course 'Object Oriented Programming using JAVA' with a maximum of 50 marks and a duration of 90 minutes. It includes five programming questions that require students to write Java programs for various scenarios, such as determining winners based on name criteria, checking loan eligibility, and calculating employee salaries. Additionally, it provides guidelines for question paper preparation, including Bloom's Taxonomy levels and difficulty levels for questions.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 12

Continuous Assessment Test – Winter Sem(2024-25) -FEB 2025

Maximum Marks: 50 Duration: 90 Mins


Course Code:CSE2005 Course Title:Object Oriented Programming using JAVA
Set No: Exam Type : Closed Book School: SCOPE
Date: Slot: Session:
Keeping mobile phone/smart watch, even in ‘off’ position is treated as exam malpractice
General Instructions:
1. Don’t use short form for syntax.

PART – A: Answer any ALL Questions, Each Question Carries 10 Marks (5×10=50 Marks)

1. In a surprise competition conducted, students were asked to enrol their name. The organizer
allowed only N students to enrol. Write a java program to read the name of N students in an
array. Winners for the competition are announced based on the condition, if the student’s
name contains the alphabet ‘a’ or ‘A’. Print the winners. (10 M)
Input: N=3
John, Arun, Vijay
Output: Arun Vijay

Answer

import java.util.Scanner;
public class Winners {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
System.out.print("Enter number of students: ");
int N = sc.nextInt();
sc.nextLine(); // Consume newline
String[] names = new String[N];
System.out.println("Enter student names:");
for (int i = 0; i < N; i++) {
names[i] = sc.nextLine();
}
System.out.println("Winners:");
for (String name : names) {
if (name.toLowerCase().contains("a")) {
System.out.print(name + " ");
}
}
sc.close();
}
}
Page 1 of 12
Input:

3
John
Arun
Vijay

Output

Winners:
Arun Vijay

2. Design a banking system that determines loan eligibility based on three criteria: age, monthly
salary, and credit score. A method named “checkLoanEligibility” should take age, monthly
salary, and credit score as parameter and use an if-else condition to determine whether a user
qualifies for a loan. The applicant must be between 21 and 60 years old, earn more than
₹30,000 per month, and have a credit score above 700 to be eligible. If any of these
conditions fail, the system should print "Loan not approved" else “you are eligible”. Read the
input for 3 customers and display the status. (10 M)

Answer

import java.util.Scanner;
public class BankLoan {
public static void checkLoanEligibility(int age, double salary, int creditScore) {
if (age >= 21 && age <= 60 && salary > 30000 && creditScore > 700) {
System.out.println("You are eligible");
} else {
System.out.println("Loan not approved");
}
}
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
for (int i = 1; i <= 3; i++) {
System.out.println("Enter details for customer " + i + ": ");
System.out.print("Age: ");
int age = sc.nextInt();
System.out.print("Monthly Salary: ");
double salary = sc.nextDouble();
System.out.print("Credit Score: ");
int creditScore = sc.nextInt();
checkLoanEligibility(age, salary, creditScore);
}
sc.close();
Page 2 of 12
}
}
Input:
Enter details for customer 1:
Age: 25
Monthly Salary: 35000
Credit Score: 750

Enter details for customer 2:


Age: 20
Monthly Salary: 40000
Credit Score: 720

Enter details for customer 3:


Age: 45
Monthly Salary: 29000
Credit Score: 710

Output
You are eligible
Loan not approved
Loan not approved

3. Create a class named “Displayapp” whose main() method calls the display method by passing
different parameters and displaying the output. (10M)

display(int a)- to display factorial of a.


Input:a=5 Output:120
display(int a,int b)- read two digit numbers and print.
Input: a=12 b=56 Output: 1256
display(String s1, String s2)-read two strings and print the concatenated string.
Input: s1=“Java” and s2= “program” Output: java program

Answer

import java.util.Scanner;
class Displayapp {
public static void display(int a) {
int fact = 1;
for (int i = 1; i <= a; i++) {
fact *= i;
}
System.out.println("Factorial: " + fact);
}
Page 3 of 12
public static void display(int a, int b) {
System.out.println("Concatenated Numbers: " + a + "" + b);
}
public static void display(String s1, String s2) {
System.out.println("Concatenated String: " + s1.toLowerCase() + " " +
s2.toLowerCase());
}
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
System.out.print("Enter a number for factorial: ");
int num = sc.nextInt();
display(num);
System.out.print("Enter two numbers: ");
int num1 = sc.nextInt();
int num2 = sc.nextInt();
display(num1, num2);
sc.nextLine(); // Consume newline
System.out.print("Enter two strings: ");
String str1 = sc.next();
String str2 = sc.next();
display(str1, str2);
sc.close();
}
}
Input
Enter a number for factorial: 5
Enter two numbers: 12 56
Enter two strings: Java program

Output
Factorial: 120
Concatenated Numbers: 1256
Concatenated String: java program

4. Implement GuestLecture class that contains variables to hold employee data like employeeCode,
employeeName, designation and salary. Create an Employee superclass and an HourlyEmployee
subclass. In the HourlyEmployee class, you will add an hourlywage which is private and totaldays
instance variable. Also write a method “set” to read hourlywage and totaldays and a method “get”to
get hourlysalaryand return it(i.e hourlysalary =hourlywage X totaldays). In the main method create
an object for HourlyEmployee to read employeeCode, employeeName, designation, hourlywage and
totaldays, calculate the salary which is hourlysalaryalong with the employee details. (10 M)

Answer
Page 4 of 12
import java.util.Scanner;
class Employee {
int employeeCode;
String employeeName;
String designation;
public void setEmployeeDetails(int code, String name, String desg) {
this.employeeCode = code;
this.employeeName = name;
this.designation = desg;
}
public void displayEmployeeDetails() {
System.out.println("Employee Code: " + employeeCode);
System.out.println("Employee Name: " + employeeName);
System.out.println("Designation: " + designation);
}
}
class HourlyEmployee extends Employee {
private double hourlyWage;
private int totalDays;
public void set(double wage, int days) {
this.hourlyWage = wage;
this.totalDays = days;
}
public double getHourlySalary() {
return hourlyWage * totalDays;
}
}
public class GuestLecture {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
HourlyEmployee emp = new HourlyEmployee();
System.out.print("Enter Employee Code: ");
int code = sc.nextInt();
sc.nextLine(); // Consume newline
System.out.print("Enter Employee Name: ");
String name = sc.nextLine();
System.out.print("Enter Designation: ");
String designation = sc.nextLine();
System.out.print("Enter Hourly Wage: ");
double wage = sc.nextDouble();
System.out.print("Enter Total Days Worked: ");
Page 5 of 12
int days = sc.nextInt();
emp.setEmployeeDetails(code, name, designation);
emp.set(wage, days);
System.out.println("\nEmployee Details:");
emp.displayEmployeeDetails();
System.out.println("Salary: ₹" + emp.getHourlySalary());
sc.close();
}
}

Input

Enter Employee Code: 101


Enter Employee Name: Rajesh
Enter Designation: Guest Lecturer
Enter Hourly Wage: 500
Enter Total Days Worked: 20

Output

Employee Details:
Employee Code: 101
Employee Name: Rajesh
Designation: Guest Lecturer
Salary: ₹10000.0

5. Create a class Tax which inherits class Employee. Write a class EMP and create an object for Tax
class to read and calculate the tax. Also print the pay slip for an employee using display() along with
the Employee details. (10M)
Employee class
Attributes: company name(static and it should not be changed), empid., empName, designation, dept,
basic, hra,da pf, netsalary
Methods: Employee_details()--method to print the Employee details
Tax class
Attribute: insurance, education loan, House loan
method:deduction(), allowance()
If Annual income <=3Lakhs taxpercentage is NIL
If Annual income >3 and <=7Lakhs taxpercentage is 5
If Annual income >7 and <=10Lakhs taxpercentage is 10
If Annual income >10Lakhs taxpercentage is 20
Use the formula for calculating
deduction= insurance+ education_loan+ House_loan;
allowance=hra+da+pf;
Netsalary=basic+allowance-deduction
Annual income=Netsalary*12

Answer

Page 6 of 12
import java.util.Scanner;
class Employee {
static final String companyName = "ABC Corp"; // Static and cannot be changed
int empId;
String empName, designation, dept;
double basic, hra, da, pf, netSalary;
public void setEmployeeDetails(int id, String name, String desg, String department,
double basic, double hra, double da, double pf) {
this.empId = id;
this.empName = name;
this.designation = desg;
this.dept = department;
this.basic = basic;
this.hra = hra;
this.da = da;
this.pf = pf;
}
public void displayEmployeeDetails() {
System.out.println("\nCompany: " + companyName);
System.out.println("Employee ID: " + empId);
System.out.println("Employee Name: " + empName);
System.out.println("Designation: " + designation);
System.out.println("Department: " + dept);
System.out.println("Basic Salary: ₹" + basic);
}
}
class Tax extends Employee {
double insurance, educationLoan, houseLoan;
public void setDeductions(double insurance, double eduLoan, double houseLoan) {
this.insurance = insurance;
this.educationLoan = eduLoan;
this.houseLoan = houseLoan;
}
public double calculateDeductions() {
return insurance + educationLoan + houseLoan;
}
public double calculateAllowances() {
return hra + da + pf;
}
public void calculateSalary() {
double deduction = calculateDeductions();
Page 7 of 12
double allowance = calculateAllowances();
netSalary = basic + allowance - deduction;
double annualIncome = netSalary * 12;
double taxPercentage = 0;
if (annualIncome > 300000 && annualIncome <= 700000)
taxPercentage = 5;
else if (annualIncome > 700000 && annualIncome <= 1000000)
taxPercentage = 10;
else if (annualIncome > 1000000)
taxPercentage = 20;
double taxAmount = (taxPercentage / 100) * annualIncome;
netSalary -= taxAmount;
}
public void displayPaySlip() {
displayEmployeeDetails();
System.out.println("Net Salary after Tax: ₹" + netSalary);
}
}
public class EMP {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
Tax emp = new Tax();
System.out.print("Enter Employee ID: ");
int id = sc.nextInt();
sc.nextLine(); // Consume newline
System.out.print("Enter Employee Name: ");
String name = sc.nextLine();
System.out.print("Enter Designation: ");
String designation = sc.nextLine();
System.out.print("Enter Department: ");
String dept = sc.nextLine();
System.out.print("Enter Basic Salary: ");
double basic = sc.nextDouble();
System.out.print("Enter HRA: ");
double hra = sc.nextDouble();
System.out.print("Enter DA: ");
double da = sc.nextDouble();
System.out.print("Enter PF: ");
double pf = sc.nextDouble();
System.out.print("Enter Insurance Deduction: ");
double insurance = sc.nextDouble();
Page 8 of 12
System.out.print("Enter Education Loan Deduction: ");
double eduLoan = sc.nextDouble();
System.out.print("Enter House Loan Deduction: ");
double houseLoan = sc.nextDouble();
emp.setEmployeeDetails(id, name, designation, dept, basic, hra, da, pf);
emp.setDeductions(insurance, eduLoan, houseLoan);
emp.calculateSalary();
System.out.println("\n--- Employee Pay Slip ---");
emp.displayPaySlip();
sc.close();
}
}
Input
Enter Employee ID: 101
Enter Employee Name: Rajesh
Enter Designation: Manager
Enter Department: Finance
Enter Basic Salary: 50000
Enter HRA: 10000
Enter DA: 5000
Enter PF: 3000
Enter Insurance Deduction: 2000
Enter Education Loan Deduction: 1500
Enter House Loan Deduction: 5000

Output
--- Employee Pay Slip ---
Company: ABC Corp
Employee ID: 101
Employee Name: Rajesh
Designation: Manager
Department: Finance
Basic Salary: ₹50000
Net Salary after Tax: ₹51800.0

QP MAPPING
Page 9 of 12
Module PO PEO PSO
Q. No. E/A/T Marks BL CO Mapped
Number Mapped Mapped Mapped
Q1 E 1 10 1 1 PO1,3,4,5 PEO1,4 PSO1
Q2 A 1 10 2 1 PO1,3,4,5 PEO1,4 PSO1

Q3 E 2 10 2 2 PO1,3,4,5 PEO1,4 PSO1

Q4 A 2 10 3 2 PO1,3,4,5 PEO1,4 PSO1

Q5 T 1,2 10 4 1,2 PO1,3,4,5 PEO1,4 PSO1

Page 10 of 12
Guidelines for the preparation of the question paper

The question paper setter must keep in mind the following instructions before preparing the
question paper:

1. BL: Bloom’s Taxonomy Levels (1: Remembering, 2: Understanding, 3: Applying, 4:


Analysing, 5: Evaluating, 6: Creating)
Note: BL 1 and BL 2 = 40% of the questions; BL 3 = 30% of the questions; and BL 4 = 30%
of the questions.
BL: Coursewise deviations in percentage of BLs are permitted. As per academic regulations,
upto 80% of HOT questions are permitted.

2. Fill out the appropriate CO (course outcomes) for each question, as it is vital for CO
attainment calculation. Refer to the syllabus for course outcomes.

3. Difficulty Level: Easiness of the question in the grade Easy, Average, Tough, or E/A/T. The
recommended proportion of the questions should be 25%, 50%, and 25%, respectively, to
ensure a normal distribution.

4. CO & BL Mapping: Prepare a pie chart and bar diagram for the BL vs. Marks and CO vs.
Marks.
For Example:
Qs No BL CO
1
2
3
4
5

Faculty can work out this bar diagram and pie chart and check the balance of questions in the
given format before uploading the question paper.

5. Ensure that you have followed the approved syllabus.


6. Set the question paper for the full syllabus, covering all the units uniformly.
7. Use the given template for the preparation of the question paper.
8. Under each question, sub-sections can be included.
9. General Instructions indicate the instructions for the whole of the question paper.
10. Give the question number continuously, starting with '1', and do not break continuity when
going to the next section.
11. Module No.: Type the module number as given in the syllabus, like 1, 2, 3, 4, 5.
12. A detailed scheme of evaluation is mandatory along with the question paper . Without the key,
the question paper will not be accepted. The same will be made accessible to students
immediately after the completion of the examination for reference and possible re-evaluation.
13. If your relative is appearing for this examination, please decline the offer and return the
documents.
14. All paper setters are requested to keep their appointments strictly confidential. including your
passwords
Page 11 of 12
15. The question paper should be such that a candidate of decided ability and good preparation in
that course can reasonably be expected to answer completely within the allotted time.
16. Ensure that the questions are not used in previous examinations or anywhere else, like a
model question paper.
17. Ensure that the questions are balanced in terms of syllabus coverage, marks, and time taken to
answer each question.
18. Follow the time schedule since many follow-up activities like moderation, formatting, and
printing out the question paper rely on your punctuality.
19. The undertaking should be submitted along with question paper.

UNDERTAKING

1. I hereby certify that the question paper was typed by me and I have not retained any copy of
the same in any form.

2. I hereby certify that I have taken sufficient care to destroy the draft copy used and have
deleted the relevant files from my computer taking care to ensure it is not retrievable by any
means.

3. I hereby certify that I have taken utmost care to maintain confidentiality.

4. I am certifying that none of my relatives are either studying for or appearing for the
examination for which the question paper has been set by me.

5. Any temporary storage is completely protected with passwords. Also, no hard copy was
retained with me.

Question paper setter Moderator 1 Moderator 2

Dr Deepasikha
Name: Dr.Prabh Selvaraj _________________

Emp ID: 70123 _________________ 70034

Signature with
_________________
date

Page 12 of 12

You might also like