Cs Python
Cs Python
Section A 5x1=5
1. The following code is not giving desired output. We want to input value as 20 and obtain
output as 40.Could you pinpoint the problem?
Number=input(“Enter Number”)
DoubleTheNumber=Number*2
Print(DoubleTheNumber)
2. What will be the output of the following code snippet?
values=[]
for i in range(1,4):
values.append(i)
print(values)
3. Trace the flow of execution for following programs:
1.def increment(x);
2. x=x+1
3.
4.#main program
5.x=3
6.print(x)
7.increment(x)
8.print(x)
4. What is docstrings?How are they useful?
5. Write a single loop to display all the contents of a text file e:\poem.txt after removing leading
and trailing whitespaces.
Section B 15x2=30
Section C 5x3=15
Section D 5x4=20
1. Evaluate the following postfix notation of expression: 50, 60, +, 20, 10, -, *
2. Consider the following table named “SOFTDRINK”. Write commands of SQL for (i) to (iv)
Table: SOFTDRINK
DRINKCODE DNAME PRICE CALORIES
101 Lime and Lemon 20.00 120
102 Apple Drink 18.00 120
103 Nature Nectar 15.00 115
104 Green Mango 15.00 140
105 Aam Panna 20.00 135
106 Mango Juice Bahaar 12.00 150
(i) To display names and drink codes of those drinks that have more than 120 calories.
(ii) To display drink codes, names and calories of all drinks, in descending order of
calories.
(iii) To display names and price of drinks that have price in the range 12 to 18 (both 12
and 18 included)
(iv) Increase the price of all drinks in the given table by 10%.
3. You have created a Django project namely EasySell. It contains three apps in it:
(i) Register (ii) Sell (iii) Work folder.
What will be the contents of Django project folder. Only list the folders, do not list any file
inside app folders.
4. Mr.Jayanto Das is confused between Shareware and Open source software. Mention at least
two points of differences to help him understand the same.
5. Write a program that asks the user to input number of seconds and then expresses it in terms
of many minutes and seconds it contains.