Grade 7-ICT Workbook-Term 3-Answers
Grade 7-ICT Workbook-Term 3-Answers
Grade 7-ICT Workbook-Term 3-Answers
Grade 7 – Term 3
Name:
Class:
Section:
INDEX
Date Content Page Number Signature
1
CHAPTER # 8
More about Python
Q.1: Fill in the blanks.
i. The continue statement skips the rest of the loop statements and causes the next iteration
of the loop to take place.
ii. The break statement enables a program to skip over a part of the code.
iii. The else part of the while loop is executed only when the while loop completes all its
iterations.
iv. Condition is checked for True or False, and the statements are executed only if the
condition is True.
v. The while loop is helpful when the number of iterations are not known prior to the
execution of the loop.
Q.2: Convert the following loops as directed.
1. While=> for
x=5
while(x<10):
print(x+10)
x+=2
for x in range(5,10,2):
print (x+10)
2. for=>while
for x in range(5,20,5)
print(x)
x=5
while(x<20):
print(x)
x+=5
Q.3: Give the output for the following codes.
I. Num=0
While (Num<10):
Num+=1
If Num==5:
Break
Print(Num,end=”,”)
1, 2, 3, 4,
II. for val in “String”:
if val==”1”:
break
print(val)
print(“Over”)
2
S
t
r
i
n
g
Over
Q.4: Write Python programs for the following.
1) Write a program to accept a number from the user and display if it is a palindrome
or not. [HINT: A palindrome number is where the reverse of the number is the same
as the number itself.]
Input Output
Num=1221 Palindrome Number
Num=231 Not a Palindrome Number
n=int(input(“Enter number:”))
temp=n
rev=0
while(n>0):
dig=n%10
rev=rev*10+dig
n=n//10
if(temp==rev):
print(“Palindrome Number”)
else:
print(“Not a Palindrome Number”)
2) Write a program to accept a number and find out whether it is a perfect number or
not. [HINT: A perfect number is a positive integer that is equal to the sum of its
proper divisors. The smallest perfect number is 6].
n=int(input(“Enter number:”))
sum = 0
for i in range(1, n-1):
mod = n%i
if mod == 0:
sum = sum + i
if sum == n:
print(“perfect number“)
else:
print(“not a perfect number“)
3
3) Write a program to accept a number from the user and check if it ends with 4 or 8.
If it ends with 4, print “Ends with 4”, if it ends with 8, print “Ends with 8”, otherwise
print “Ends with neither”.
n=int(input(“Enter number:”))
mod = n%10
if mod == 8:
print(“ends with 8“)
elif mod == 4:
print(“ends with 4“)
else:
print(“ends with neither“)
4) Write a program to calculate and print the sum of even and odd integers of the first
N natural numbers.
n=int(input(“Enter a number: “))
sum1 = 0
while(n > 0):
sum1=sum1+n
n=n-1
print(“The sum of first n natural numbers is”,sum1)
Q.5: Answer the following questions.
i. What is the significance of using iterations in Python?
Sometimes there is a need to repeat a set of statements more than once based on a certain
condition. This process of repetition is called loop or iteration in programming. A loop,
is thus used to repeat a block of statements a specific number of times. The loops used in
Python are for loop and while loop.
ii. Explain the range() function with the help of an example.
The range() function is used to create a list containing a sequence of numbers starting
from start and ending with one less than the stop. Syntax: range([start], stop,[step])
Example: >>>range(10); output: [0,1,2,3,4,5,6,7,8,9]
iii. Explain the difference between FOR and WHILE loops.
for… structure is used when you want to perform a loop a specific number of times. It
uses a counter variable which is incremented or decremented with each repetition of the
loop. A while loop executes a block of code repeatedly as long as the test/control
condition of the loop is true. It is ideally suited when the number of iterations are not
known prior to the execution of the loop.
iv. What are jump statements?
Python offers two jump statements to be used within loops to jump out of loop iterations.
These are break and continue statements. It alters the flow of control in a loop.
4
Chapter # 9
Introduction to Artificial Intelligence
Q.1: Fill in the blanks with the correct word.
1. Implementing is the last step in problem-solving after choosing the best solution.
2. Tasks that humans do on a routine basis without any special training are called mundane
task.
3. In vision system using AI, the systems can understand and comprehend the visual input
on the computer.
4. Artificial Intelligence is the science and engineering of making intelligent machines,
especially intelligent computer programs.
5. In speech recognition AI is capable of handling speech-related data.
Q.3: Number the following steps used for problem solving in AI.
a. Identification of solutions b. Implementing
c. Defining a problem d. Analysing the problem.
e. Choosing a solution.
c d a e b
5
2. What are the tools used for AI?
The following tools are used to imbibe artificial intelligence in computers.
a. Logic
b. Search and Optimisation
c. Classifiers and Statistical Learning Methods
d. Probabilistic Methods for Unrealistic Reasoning
e. Artificial Neural Network
3. What are the goals of AI?
Major goal of an intelligent system is to enable a system to think and behave like humans
do, in order to solve a problem. Intention of AI is to:
a. implement human intelligence in machines by creating systems that can think, act,
learn and behave like humans.
b. create expert systems that can behave intelligently, learn, explain, demonstrate and
give suggestions to its users.
c. enable a system to understand and process natural language.
d. empower a system to perform intellectual tasks that a human can perform.
6
Chapter # 11
Troubleshooting
Q.1: Fill in the blanks.
1) You can speed up your computer by running the disk cleanup utility.
2) The restarting of a computer is called rebooting.
3) Many printer models have a built-in self-test option.
4) You check the power supply points for hardware related problems.
5) Disk defragments is available in Tools tab of Properties dialog box.
3) The three areas to troubleshoot are: hardware, software, and operating system. True
T 4) If your Windows restarts without warning, then there is a problem in the computer
hardware. False
5) Proper maintenance will increase the speed and the life of your PC. True
Q.3: Identify the troubleshooting areas for each of the following problems.
7
b) Why is it important to take proper care of a computer?
It is important to take proper care of your computer for the following reasons.
• It will increase the speed and the life of your PC.
• It prevents errors.
• It secures your data and information from any unwanted damage.
• Lastly, it saves your precious time.
d) Write about two common problems related to software that you might have
experienced.
Two commonly faced problems related to the software can be:
a. You are unable to install a program.
b. Program or utility does not load. It has an error when you attempt to load it.