In the next section of important QnA Python Fundamentals Class 11 we will discuss some applications-based questions.
In the first section application-based questions for important QnA Python Fundamentals Class 11 let’s discuss python basics questions.
Q – 1 Which of the following are invalid identifiers?
mynum, 1tab, stu roll no, for1, for, While, while
Ans.: 1tab ￫ Starts with a number, stu roll no ￫ space is given in the variable name, for and while are keywords
The next section contains for important QnA Python Fundamentals Class 11 contains error based questions.
Q – 2 Find errors in the following code:
i) stu_marks = 90
print(Students Score stu_marks)
Ans.: There is error in line 2. The print() function accepts only variable without function if the user needs to print any custom message, the message text should be enclosed in double-quotes. So correct statement is anyone these:
print(“Students Score:”, stu_marks)
ii) a = 30, b = 40
Ans.: There is an error in line 1. Python doesn’t allow to assign multiple variables like this. If its required it can be done either one of these ways:
a,b = 30, 40
a = 30
b = 40
There is an error in line 2 as well. To separate values of the variable in print, user can use, (comma) not a semicolon, hence the correct code is like this:
iii) stu_name (input=”Enter name of student:”)
Ans.: There is error in line 1. When input() function is used in the expression, in must come after =. Here the correction is like this:
stu_name = input(“Enter name of student:”)
iv) x, y = 30, 7
z = (int) x/y
Ans.: There is an error in the typecasting statement. In python, the statement where type casting is required is written as a parameter in a specific data type function.
The next section have some output finding questions for QnA Python Fundamentals Class 11,
Q – 3 Find the output:
(i) a = 3
(ii) a = 5
b = a
c = b – 3
Ouptut: 5 5 2
(iii) cname = “Subodh”
print(“Customer Name & Bill:”,cname+1500)
Output:No output due to Error, cname is string and bill_amount is integer
(iv) a = 55
b = a + 4
a = 30, b + 2
Ouptut: 59 (30,61) . Initially, the value of a is 55, the value of b is 55 + 4 = 59, in third line the value of a is gain changed as mentions 30, 59 + 2= (30, 61). So in print function first value of b is printed, then a is printed Hence ouptut is 59 (30,61)
(v) a, b = 10, 30
a, b, a = b, b + 3, a – 5
print( a, b)
Ouptut: The value of a and b is 10 and 30 respectively. After that, in next line the value of b is assigned to a i.e 30 then b + 3 = 30 + 3 = 33 assigned to b and finally a -5 = 10 – 5 = 5 assigned to a. So output will be 5 33.
(vi) a, b = 10 , 5
<class ‘NoneType’>. As print() function is nested in the code gives None output for the outer print() function. type() function returns the final data type of the value.