Questions

1 Marks Each

🎯

Test yourself on this topic

24 questions · timed · auto-graded

Question 21 Mark
Write Python expressions equivalent to the following arithmetic/algebraic expressions:
Answer
(i) (a+b)/2
(ii) (3**2 + 9**3)/2
(iii) 3**2 + 9**3/5
(iv) math.sqrt(a) + (a+2)/b
(v) 8-6 +(6*sum)/7 – math.sqrt(var))
(vi) u*t + (1/2)*a*t**2
View full question & answer
Question 31 Mark
Find the output of the following code:
Answer
(i) 8 5
(ii) 0 2
(iii) 20 30
(iv) 66.67 126.67
(v) 4 –10 7
(vi) 8 8 0
View full question & answer
Question 41 Mark
Identify invalid variable names from the following, give reason for each:
Group, if, int, total marks, S.I., volume,
tot_strength, #tag, tag$, 9a
Answer
Group : Valid
if: not Valid as it is a Keyword
int:not Valid as it is a Keyword
total marks:not Valid as space cannot be a part of variable name.
S.I. :not Valid, No Special character can be part of variable name, (.) is special character.
Volume: Valid
tot_strength: valid
#tag: not Valid, No Special character can be a part of variable name, (#) is special character.
tag$: not Valid, no Special character can be a part of variable name, ($) is special character.
9a: not Valid, cannot start with number.
View full question & answer
Question 51 Mark
A book publisher conducted a survey and found that 70% of the teenagers love to read fiction novels. In general, maximum 40% of the population of a city are teenagers. The publisher earns a profit of Rupees n on the sale of each copy of a fiction novel. Write Python script to find maximum profit that the publisher can earn by selling copies of one fiction novel to teenagers in a city.
Answer
profit=eval(input("Enter the profit earned on each copy: "))
population=eval(input("Enter population of the city: "))
max_profit = profit*70/100*40/100*population print("Maximum profit that can be earned = Rs",max_profit)
View full question & answer
Question 61 Mark
Mahmood has taken some loan from Ashraf at a certain rate of simple interest. After 6 years Mahmood wants to repay the loan in full and final including interest. Write Python code to calculate and display the interest and total amount to be paid by Mahmood to settle the account.
Answer
Principal=eval(input("Enter the value of Principal: "))
Rate=eval(input("Enter the annual rate of interest: "))
Time=6
Simple_Int = Principal*Rate*Time/100
Amount = Principal+Simple_Int
print("Simple Interest = Rs",Simple_Int)
print("Amount payable = Rs",Amount)
View full question & answer
Question 71 Mark
Sonia has to travel a distance of 450km by car. From her experience she knows that she will be travelling at a certain average speed. Write Python script to find out how much time will she take to cover the distance.
Answer
Distance=450
# to input distance from the user
Speed=eval(input("Enter average speed: "))
Time=Distance/Speed #Calculate time taken
print("Time taken: ",Time,"hr")
View full question & answer
Question 81 Mark
A school conducts two weekly tests of 30 marks each and a term exam of 100 marks. To calculate the aggregate percentage of marks obtained by a student, calculations are done as follow: Aggregate Percentage = (weekly test total)/3+80% of term exam.
Write Python script to calculate and display aggregate percentage of a student if she scored 20, 25, and 60 marks respectively in 1st weekly test, 2nd weekly test, and term exam.
Answer
wt1 = 20
wt2 = 25
te = 60
agg_per = (wt1+wt2)/3+80/100*te
print("Aggregate Percentage = ",agg_per)
View full question & answer
Question 91 Mark
A book publisher conducted a survey and found that 70% of the teenagers love to read fiction novels. The population of the area that the publisher can cover is 500000, out of which 40% are teenagers. The publisher earns a profit of Rs10 on the sale of each copy of a fiction novel. Write Python script to find maximum profit that the publisher can earn by selling copies of one fiction novel to teenagers.
Answer
profit=10
population=500000
max_profit = profit*70/100*40/100*population
print("Maximum profit that can be earned = Rs",max_profit)
View full question & answer
Question 101 Mark
Mahmood has taken a loan of Rs 40000 from Ashraf at a rate of 8% per annum simple interest. After 6 years Mahmood wants to repay the loan in full and final including interest. Write Python code to calculate and display the interest and total amount to be paid by Mahmood to settle the account.
Answer
Principal=40000
Rate=8
Time=6
Simple_Int = Principal*Rate*Time/100
Amount = Principal+Simple_Int
print("Simple Interest = Rs",Simple_Int)
print("Amount payable = Rs",Amount)
View full question & answer
Question 111 Mark
Sonia has to travel a distance of 450km by car. She knows that the speed limit is 100km/hr, but due to traffic conditions, the average speed is 60km/hr. Write Python script to find out how much time will she take to cover the distance.
Answer
Distance=450
S peed=60
Time=Distance/Speed
print("Time taken: ",Time,"hr")
View full question & answer
Question 121 Mark
What will be the output of the following code: (a) What will be the output of the above code?
(b) How many times the loop executed?
Answer
(a) One,Two,Three,Four
(b) The loop executed 4 times
View full question & answer
Question 131 Mark
How many times the given loops will be excecuted:
Answer
(i) 9 times
(ii) 2 times
(iii) 3 times
(iv) 2 times
View full question & answer
Question 141 Mark
Find the output generated by the following code:
(a) x=2
y=3
x+=y
print(x,y)
(b) x=8
y=2
x+=y
y-=x
print(x,y)
(c) a=5
b=10
a+=a+b
b*=a+b
print(a,b)
(d) p=10
q=20
p*=q//3
q+=p+q**2
print(p,q)
(e) p=5/2
q=p*4
r=p+q
p+=p+q+r
r+=p+q+r
q-=p+q*r
print(p,q,r)
(f) p=2/5
q=p*4
r=p*q
p+=p+q-r
r*=p-q+r
q+=p+q
print(p,q,r)
Answer
(a) 5 3
(b) 10 –8
(c) 20 300
(d) 60 480
(e) 27.5 –642.5 62.5
(f) 1.7599999999999998 4.96 0.512
View full question & answer
Question 151 Mark
Evaluate the following expressions:
(i) (5 + 8) * 3 - 6 / 2
(ii) (2 + 3) * 5/4+(4 + 6)//2
(iii) 12 + (3 * 4 – 6) / 3
(iv) 12 + (3 **4 - 6)// 2
(v) 12 * 3 % 5 + 2 ** 6//4
(vi) 12 % 5 **3 +(2*6)//4
Answer
(i) 36.0
(ii) 11.25
(iii) 14.0
(iv) 49.0
(v) 17
(vi) 15
View full question & answer
Question 161 Mark
Write the few rules for the variable naming convention.
Answer
The rules are:
(i) A variable name must start with an alphabet (capital or small) or an underscore (_).
(ii) A variable name can consist of alphabets, digits, and underscore(_). No other character is allowed.
(iii) A Python keyword cannot be used as a variable name.
View full question & answer
Question 171 Mark
What are Comments? Write the two ways to write comments.
Answer
Comments are included with the reason for making the source to code simpler for people to comprehend, and are for the most part ignored by compilers and interpreters.
• Single-line comments are created simply by beginning a line with the hash (#) character, and they are automatically terminated by the end of line.
For example:
#We are learning Python.
• Multiple line comment Entry. In Python, doc string (''') be used as multiple line comment entry
View full question & answer
Question 181 Mark
 Define Variable.
Answer
 A variable is a named memory location which is used to store data temporarily.
View full question & answer
Question 211 Mark
 Write the full form of IDE and IDLE.
Answer
IDE - Integrated Development Environment
IDLE - Integrated Development and Learning Environment
View full question & answer
Question 221 Mark
 What is Python?
Answer
 Python is an easy to learn, open-source, object-oriented general-purpose programming language.
View full question & answer
Question 231 Mark
 Why python is named "Python"?
Answer
 Python's name is derived from the television series Monty Python's Flying Circus.
View full question & answer
1 Marks Each - Computer Science STD 12 Humanities Questions - Vidyadip