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

Computer Science Worksheet

The document contains a series of worksheets for Class 11 Computer Science covering topics such as Python programming, lists, strings, dictionaries, and cybersecurity. Each worksheet includes programming tasks, theoretical questions, and code output predictions. The exercises aim to enhance students' understanding of fundamental programming concepts and cybersecurity principles.

Uploaded by

buckedit7
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 views5 pages

Computer Science Worksheet

The document contains a series of worksheets for Class 11 Computer Science covering topics such as Python programming, lists, strings, dictionaries, and cybersecurity. Each worksheet includes programming tasks, theoretical questions, and code output predictions. The exercises aim to enhance students' understanding of fundamental programming concepts and cybersecurity principles.

Uploaded by

buckedit7
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/ 5

MPVM GANGA GURUKULAM

COMPUTER SCIENCE CLASS 11 WORKSHEETS

Worksheet 1: Python Flow of Control


1. Write the output of the following code:
for i in range(3, 8, 2):
print(i, end=' ')

2. What is the difference between if-elif-else and nested if?


3. Write a Python program to check if a number is even or odd.

4. What will be the output of the following code?

a x = 10 b a = 5
if x % 2 == 0: b = 10
print("Even") if a > b:
else: print("A is greater")
elif a == b:
print("Odd") print("A is equal to B")
else:
print("B is greater")

Worksheet 2: Lists
1. Write a program to find the sum of elements in a list.
2. What will be the output of the code below?
my_list = [1, 2, 3]
my_list.append([4, 5])
print(len(my_list))

3. Define mutable and immutable with examples.

4. What will be the output of the following code?

num = 7 b x = 3
if num % 2 == 0: if x > 5:
print("Even") print("x is greater than 5")
elif num % 3 == 0: elif x == 3:
print("Divisible by 3") print("x is equal to 3")
else: else:
print("Neither even nor print("x is less than 5")
divisible by 3")
Worksheet 3: Strings
1. Write a program to reverse a string.
2. Explain the difference between isalpha() and isdigit() methods with examples.
3. Write the output of the code below:
s = "Python"
print(s[1:4])

4. Find and correct the error in the following code:

x = 4
if x > 3
print("x is greater than 3")

5. Find and correct the error in the following code:

num = 7
if num % 2 == 0
print("Even")
elif num % 3 = 0:
print("Divisible by 3")

Worksheet 4: Dictionaries
1. Write a Python program to merge two dictionaries.
2. Define the following dictionary:
student = {"name": "Alex", "age": 18, "marks": 85}

Write code to add a new key-value pair grade: "A" to it.


3. What is the difference between keys() and values() methods?

Worksheet 5: Cybersecurity
1. What is phishing? Explain with an example.
2. How does two-factor authentication improve security?
3. Define the term "malware" and list two examples.

Worksheet 6: Python Flow of Control


1. Write a Python program to check whether a given year is a leap year or not.
2. Explain the purpose of break and continue statements with examples.
3. Predict the output:
for i in range(1, 6):
if i == 3:
continue
print(i, end=' ')
Worksheet 7: Lists
1. Write a Python program to find the largest element in a list.
2. What will be the output of:
a = [10, 20, 30]
b=a
b[0] = 100
print(a)

3. Define pop() and remove() methods in lists.

Worksheet 8: Strings
1. Write a Python program to count the frequency of vowels in a string.
2. Explain the difference between find() and index() methods.
3. Predict the output:
text = "AI is fun"
print(text.upper())

Worksheet 9: Dictionaries
1. Write a Python program to check if a given key exists in a dictionary.
2. What will the following code print?
my_dict = {"a": 1, "b": 2}
my_dict["c"] = 3
print(len(my_dict))

3. Define get() method in dictionaries.

Worksheet 10: Cybersecurity


1. What are strong passwords, and why are they important?
2. Explain the term "firewall" in the context of cybersecurity.
3. Name two examples of social engineering attacks.

Worksheet 11: Python Flow of Control


1. Write a Python program to find the factorial of a number using a while loop.
2. What is the purpose of the else block in a loop? Explain with an example.
3. Predict the output:
n=5
while n > 0:
print(n, end=' ')
n -= 1
Worksheet 12: Lists
1. Write a Python program to find all even numbers in a list.
2. Explain the difference between append() and extend() methods with examples.
3. Predict the output:
x = [1, 2]
x.extend([3, 4])
print(x)

4. Write a Python program that removes all duplicate elements from a list.
5. Write a Python program to find the maximum and minimum elements in a list of numbers.

Worksheet 13: Strings


1. Write a program to check whether a given string is a palindrome or not.
2. Explain the use of slicing in strings.
3. Predict the output:
word = "Machine"
print(word[-1])

Worksheet 14: Dictionaries


1. Write a Python program to remove a key from a dictionary.
2. Predict the output:
d = {"x": 10, "y": 20}
del d["x"]
print(d)

3. What are nested dictionaries? Give an example.

Worksheet 15: Cybersecurity


1. Define encryption and decryption.
2. Explain how antivirus software protects a computer.
3. What is the difference between a virus and a worm?

Worksheet 16: Mixed Questions


1. Write a program to find the sum of all numbers in a dictionary where keys are strings and
values are integers.
2. Write the output:
items = {"apple": 2, "banana": 3}
items["orange"] = 4
print(items)
3. What is the importance of ethical hacking?

4. Find and correct the error in the following code:

a = 20
b = 15
if a > b
print("a is greater than b")
elif a == b:
print("a is equal to b")
else
print("b is greater than a")

5. Find and correct the error in the following code:

x = 8
if x > 3:
print("x is greater")
else x == 5:
print("x is equal to 5")

You might also like