CBSE Class 11 – Computer Science Model Paper 2024-25

Q1(a) What is a function call in Python? Give Example.

A function call is an expression that invokes a function defined in Python to execute its code. A function is defined with the def keyword and is called by using the function name followed by parentheses. If the function requires arguments, they are passed inside the parentheses.
Example:

pythonCopy codedef greet(name):
    print(f"Hello, {name}!")

greet("Alice")  # Function call

Output:

Copy codeHello, Alice!

Q1(b) Write the Python code to create the dictionary to include the list of the following countries and their capital.

pythonCopy codecountries = {
    "India": "New Delhi",
    "Pakistan": "Islamabad",
    "Sri Lanka": "Colombo",
    "Bangladesh": "Dhaka"
}

print(countries)

Output:

arduinoCopy code{'India': 'New Delhi', 'Pakistan': 'Islamabad', 'Sri Lanka': 'Colombo', 'Bangladesh': 'Dhaka'}

Q2(a) Write a program in Python to find out the greater of two numbers.

pythonCopy codedef greater_number(a, b):
    if a > b:
        return a
    else:
        return b

# Example usage
num1 = 5
num2 = 8
print("Greater number is:", greater_number(num1, num2))

Output:

csharpCopy codeGreater number is: 8

Q2(b) Given the following code, write down what would be printed as output:

pythonCopy codeA = 3
while (I in a):
    print("Happy" ** i)

The code provided contains an error. The variable I is not defined and will cause a NameError. Additionally, ** is an exponentiation operator, and the code logic seems incorrect. The corrected version is needed for the proper output.

Q2(c) Write pseudo-code/flowchart to input the year and to test and display whether the given year is a leap year or not?

Pseudo-code:

sqlCopy codeStart
    Input year
    If (year % 4 == 0) AND (year % 100 != 0) OR (year % 400 == 0) then
        Print "Leap Year"
    Else
        Print "Not a Leap Year"
End

Q2(d) Write Python program to calculate the area of a circle. The radius being the input.

pythonCopy codeimport math

def area_of_circle(radius):
    return math.pi * radius ** 2

# Example usage
radius = float(input("Enter the radius of the circle: "))
print(f"The area of the circle is: {area_of_circle(radius)}")

Q2(e) Given the following python code, what values are printed as output?

pythonCopy codedef afunc(B):
    B = B % 2
    print(B)

A = 2
afunc(A)
afunc(A + 5)
print(A)

Output:

Copy code0
1
2

Explanation: A is passed to the function, and inside the function, the value of B is modified by taking the modulus with 2. However, the global A is not modified because integers are immutable in Python.


Q3(a) Is Python a compiled or an interpreted language?

Python is an interpreted language. Python code is executed line by line by the Python interpreter, and there is no need to compile the code into machine code beforehand.

Q3(b) Differentiate between compiler and interpreter.

AspectCompilerInterpreter
DefinitionTranslates the entire source code into machine code before execution.Translates and executes code line by line.
OutputProduces an independent executable file.No separate output file is generated.
ExecutionFaster execution (after compilation).Slower execution (due to line-by-line processing).

Q3(c) Write a short note on string constructs in Python.

In Python, a string is a sequence of characters enclosed in single quotes (') or double quotes ("). Strings are immutable, meaning once a string is created, it cannot be altered. Python also supports multi-line strings using triple quotes (''' or """). Strings can be manipulated using slicing, concatenation, and various built-in methods.
Example:

pythonCopy codes1 = "Hello"
s2 = 'World'
s3 = """This is a multi-line
string."""

Q3(d) What are the benefits of using cloud computing (any two)?

  1. Scalability: Cloud computing provides on-demand access to resources that can scale according to the user’s needs.
  2. Cost Efficiency: Users pay only for the resources they use, reducing the need for expensive infrastructure and maintenance costs.

Q3(e) List some common data types used in Python.

  1. int – Integer values
  2. float – Floating-point numbers
  3. str – String values
  4. list – A mutable collection of elements
  5. tuple – An immutable collection of elements
  6. dict – Dictionary for key-value pairs
  7. bool – Boolean values (True or False)

I’ll continue to answer the remaining questions in subsequent messages due to space limitations.

You said:

continue

ChatGPT said:

ChatGPT

Q4(a) What is the function performed by len() and reverse() in the list module?

  • len() function: It returns the number of elements in the list. Example:pythonCopy codemy_list = [1, 2, 3, 4] print(len(my_list)) # Output: 4
  • reverse() function: It reverses the elements of the list in place, modifying the original list. It does not return a new list. Example:pythonCopy codemy_list = [1, 2, 3, 4] my_list.reverse() print(my_list) # Output: [4, 3, 2, 1]

Q4(b) Find the error in the given SQL code:

sqlCopy codeinsert into values {“admin”, “write”};

Error:

  1. The INSERT INTO statement should specify the table name and column names.
  2. The use of curly braces {} is incorrect. SQL uses parentheses () for value insertion.
  3. Quotation marks should be standard ASCII quotes ", not curly quotes.

Corrected code:

sqlCopy codeINSERT INTO table_name (username, permission) VALUES ("admin", "write");

Q5(a) Convert:

  • (A) (1234.56)10 = (?)16:
    To convert a decimal number (base 10) to hexadecimal (base 16), we divide by 16 and keep track of the remainders.Conversion Process:
    • 1234 divided by 16 = 77 remainder 2
    • 77 divided by 16 = 4 remainder 13 (D in hex)
    • 4 divided by 16 = 0 remainder 4
    Hexadecimal Representation:
    1234.56 (decimal) = 4D2.8F (hexadecimal) (rounded for simplicity).
  • (B) (476)8 = (?)2:
    To convert an octal number to binary, each octal digit is converted to a 3-bit binary equivalent.Conversion Process:
    • 4 in octal = 100 in binary
    • 7 in octal = 111 in binary
    • 6 in octal = 110 in binary
    Binary Representation:
    476 (octal) = 100 111 110 (binary)100111110.

Q5(b) i) What is the role of load balancing in parallel computing?

Load balancing in parallel computing ensures that the computational work is evenly distributed across multiple processors or nodes. This improves performance and prevents some processors from being idle while others are overloaded. Proper load balancing helps to minimize execution time and optimizes resource utilization in parallel systems.

Q5(b) ii) Arrange the following in ascending order of memory capacity: TB, Byte, KB, Nibble, PB, MB, GB

Ascending Order:

  1. Nibble (4 bits)
  2. Byte (8 bits)
  3. KB (Kilobyte = 1024 bytes)
  4. MB (Megabyte = 1024 KB)
  5. GB (Gigabyte = 1024 MB)
  6. TB (Terabyte = 1024 GB)
  7. PB (Petabyte = 1024 TB)

Q5(c) Define primary key.

A primary key is a unique identifier for each record in a database table. It ensures that no two rows in a table can have the same value for the primary key column(s). The primary key must contain unique values, and it cannot contain NULL values.


Q6(a) What are the rules for using social networking sites?

  1. Privacy Settings: Adjust privacy settings to control who can view your information.
  2. Be Mindful of Content: Avoid posting sensitive, offensive, or inappropriate content.
  3. Respect Others: Avoid online harassment, trolling, or bullying. Be respectful of other users.
  4. Limit Personal Information: Avoid sharing too much personal information to protect yourself from identity theft.

Q6(b) What is Cracking? Suggest the ways to protect the computer from cyber attack.

  • Cracking refers to the act of breaking into a computer system or network, often by bypassing security measures like passwords or encryption.
  • Ways to protect against cyber attacks:
    1. Use strong, complex passwords.
    2. Regularly update software and security patches.
    3. Use firewalls and antivirus software.
    4. Be cautious of phishing attacks and malicious links.

Q6(c) Define eavesdropping and phishing.

  • Eavesdropping is the act of secretly listening to private communications or data transmissions without the consent of the participants, often with malicious intent.
  • Phishing is a type of cyber attack where attackers impersonate legitimate organizations to trick individuals into providing sensitive information such as passwords, credit card details, etc.

Q6(d) What is cyber bullying? How is it done?

Cyberbullying is the use of digital platforms (social media, emails, or websites) to harass, intimidate, or bully others. It may involve spreading false rumors, sending abusive messages, or posting harmful content about someone.
How it is done:

  • Posting hurtful comments or images online
  • Sending threatening or abusive emails or texts
  • Excluding someone from online groups or social media platforms

Q6(e) What are the tips to safely browse the internet?

  1. Use Strong Passwords: Ensure your passwords are unique and complex.
  2. Avoid Public Wi-Fi for Sensitive Transactions: Avoid entering sensitive data when using unsecured networks.
  3. Install Antivirus Software: Keep antivirus software up to date to detect and protect against malware.
  4. Enable Two-Factor Authentication: Use two-factor authentication on your accounts to increase security.

Q7: Answer the question based on the table given below:

Let’s assume the table is for students with columns like roll number, name, stream, etc.

(i) Write the SQL command to create the table with constraints:

sqlCopy codeCREATE TABLE Student (
    roll_no INT PRIMARY KEY,
    name VARCHAR(100),
    stream VARCHAR(50),
    age INT
);

(ii) Insert 2 records into the table:

sqlCopy codeINSERT INTO Student (roll_no, name, stream, age) VALUES (100, 'John Doe', 'Science', 20);
INSERT INTO Student (roll_no, name, stream, age) VALUES (536, 'Jane Smith', 'Arts', 22);

(iii) Display all the records of the table:

sqlCopy codeSELECT * FROM Student;

(iv) Delete the Student whose Roll no is 100:

sqlCopy codeDELETE FROM Student WHERE roll_no = 100;

(v) Change the Stream of Student to ‘Computer’ whose Roll no is 536:

sqlCopy codeUPDATE Student SET stream = 'Computer' WHERE roll_no = 536;

(vi) Add one column email of data type VARCHAR and size 30 to the table:

sqlCopy codeALTER TABLE Student ADD email VARCHAR(30);

Q8: Answer the question based on the table given below:

Let’s assume the table is for hospital patients with columns like name, department, charges, age, etc.

(a) To list the names of all the patients admitted after 15/01/98:

sqlCopy codeSELECT name FROM Hospital WHERE admission_date > '1998-01-15';

(b) To list the names of female patients who are in ENT department:

sqlCopy codeSELECT name FROM Hospital WHERE sex = 'F' AND department = 'ENT';

(c) To list names of all patients with their date of admission in ascending order:

sqlCopy codeSELECT name, admission_date FROM Hospital ORDER BY admission_date ASC;

(d) To display Patient’s Name, Charges, Age for only female patients:

sqlCopy codeSELECT name, charges, age FROM Hospital WHERE sex = 'F';

(e) Find Out the Output of Following SQL Command:

(i) SELECT COUNT(DISTINCT charges) FROM Hospital;
This query counts the number of unique charge amounts in the Hospital table.

(ii) SELECT MIN(Age) FROM Hospital WHERE sex = "F";
This query returns the minimum age of female patients.


Q9(a) What is the difference between math.abs() and math.fabs()?

  • math.abs(): It returns the absolute value of a number. It works for both integers and floats. Example:pythonCopy codeimport math print(math.abs(-5)) # Output: 5
  • math.fabs(): It returns the absolute value of a number as a float, even if the input is an integer. Example:pythonCopy codeimport math print(math.fabs(-5)) # Output: 5.0

Q9(b) What is String? How do you create a string in Python?

A string is a sequence of characters enclosed in either single (') or double (") quotes in Python. Strings are immutable, meaning their content cannot be changed after creation. You can create a string using either single, double, or triple quotes for multi-line strings. Example:

pythonCopy codes1 = "Hello, World!"  # Using double quotes
s2 = 'Python'          # Using single quotes
s3 = """This is a multi-line
string."""            # Using triple quotes