[Type B] Chapter– 1 Class 12 CS – Sumita Arora Assignment | Q/A

Here is class 12 computer science Unit 1 [Type B] solutions for Sumita Arora back exercise assignment. Below includes both textual and video solutions wherever required. View all the answers in assignment for chapter 1 and for all chapters here.

Watch all tutorials for chapter 1: Python Revision Tour – 1.

Q1: Fill in the missing lines of code in the following code. The code reads in a limit amount and a list of prices and prints the largest price that is less than the limit. You can assume that all prices and the limit are positive numbers. When a price 0 is entered the program terminates and prints the largest price that is less than the limit.
chapter 1 Type Q1 Sumita Arora

Solution:

limit = float(input("Enter the limit")) 
max_price = 0 
# Read the next price 
next_price = float(input("Enter a price or 0 to stop:")) 
while next_price > 0: 
    if next_pricemax_price and next_price>max_price:
        max_price =next_price
     #Read the next price 
    next_price = float(input("Enter a price or 0 to stop:"))
if max_price > 0: 
    print('The largest price', max_price)
else :
    print("No! price satisfy the condition")
Q2: Predict the outputs of the following programs:
Chapter 1 Type-B question 2

Solution:

(a)
Hello
Hello
Hello
Hello
Hello
Hello
Hello
Hello
Hello
(b)
10 0
9 1
8 2
7 3
6 4
(c)
100
90
80
70
60
50
(d)
infinite loop
(e)
1
2
3
4
5
(f)
1
2
3
4
5
6
7
8
9
(g)
-500
-400
-300
-200
-100
0
100
200
300
400
(h)
No output
(i)
50
(j)
%
*
* *
* * *
%%
*
* *
* * *
%%%
*
* *
* * *
(k)
L
A
M
P
(l)
o t
n w
e o
(m)
apple
pear
peach

(n)
apple
PEAR
PEACH
grapefruit
Q3: Find and write the output of the following python code:
Chapter 1 Type-B Question 3

Solution:

Jayes
Finished!
Ramya
Finished!
Taruna
Got it!
Q4: How many times will the following for loop execute and what’s the output?
Chapter 1 Type-B Question 4

Solution:

(a) No output
    Reason: In proper range() parameter passed.

(b) output is follow: 
*
*
*
*
*
In total loop execute total 5 times.
Q5: Is the loop in the code below infinite? How do you know (for sure) before you run it?
Chapter 1 Type-B Question 5

Solution:

No, the loop is not infinite and the conclusion is come into account through limit of while loop and terminating case in that. 

Clear Doubts with Computer Tutor
In case you’re facing problems in understanding concepts, writing programs, solving questions, want to learn fun facts | tips | tricks or absolutely anything around computer science, feel free to join CTs learner-teacher community: students.computertutor.in

You cannot copy content of this page