52 solutions available
Question 5Assertion (A): Comments are non-executable statements that enable the users to understand the program logic.Reasoning (R): Comments are...
Question 6Assertion (A): A set of valid characters recognized by Python constitutes a character set.Reasoning (R): Character set in Python is a...
Question 2Identifier name cannot be composed of special characters other than ............... .#Hyphen (-)$\text{\textdollar}$Underscore (_)
Question 15What will be the output of the following Python code?>>> 6*3+4**2//5-8 1314ErrorNone
Question 16What will be the output of the following Python code?>>> a=72.55 >>> b=10 >>> c=int(a + b) >>> c...
Question 1Write a Python command/instruction/statement to display your name.
Question 3Evaluate the following expressions manually:(a) (2 + 3) ** 3 - 6/2(b) (2 + 3) * 5//4 + (4 + 6)/2(c) 12 + (3 * 4 - 6)/3(d) 12 + (3 ** 4 -...
Question 4Evaluate the above expressions by using IDLE as a calculator and verify the results that you get manually.
Question 7Explain the difference between syntax error and runtime error with examples.
Question 8Identify invalid variable names from the following, giving reason for each:Group, if, total marks, S.I., volume, tot_strength, #tag,...
Question 9(a)Find the output of the following code:x=3 y=x+2 x+=y print(x,y)
Question 9(b)Find the output of the following code:x=-2 y=2 x+=y y-=x print (x,y)
Question 9(c)Find the output of the following code:a=5 b=2*a a+=a+b b*=a+b print (a,b)
Question 9(d)Find the output of the following code:p=10 q=20 p*=q/3 q+=p+q*2 print (p,q)
Question 9(e)Find the output of the following code: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)
Question 9(f)Find the output of the following code:p = 21 // 5 q = p % 4 r = p * q p+= p + q - r r*= p - q + r q+= p + q print(p, q, r)
Question 12What are operators? What is their function? Give examples of some unary and binary operators.
Question 13What is an expression and a statement?
Question 14What all components can a Python program contain?
Question 15What are variables? How are they important for a program?
Question 16What is 'Dynamic Typing' feature in Python?
Question 17Which data type will be used to represent the following data values and why?(a) Number of months in a year(b) Resident of Delhi or not(c)...
Question 18Write a function called calculate_area() that takes base and height as an input argument and returns an area of a triangle as an output....
Question 19Modify the above function to take a third parameter called shape type. Shape type should be either triangle or rectangle. Based on the...
Question 20Write a function that takes amount in dollars and performs dollar-to-rupee price conversion; it then displays the amount converted to...
Question 21What would the following code do?a = b = 70
Question 22What is the error in the following code?z, p = 6
Question 23(a)Find out the error(s) in the following code fragment:temperature = 90 Print temperature
Question 23(b)Find out the error(s) in the following code fragment:a = 30 b = a + b print (a And b)
Question 23(c)Find out the error(s) in the following code fragment:a, b, c = 2, 8, 9 print(a, b, c) c, b, a + a, b, c print(a; b; c)
Question 23(d)Find out the error(s) in the following code fragment:x = 24 4 = x
Question 23(e)Find out the error(s) in the following code fragment:Print ("X =" X)
Question 24(a)What will be the output produced by the following code fragment?X = 10 X = X+10 X = X-5 print (X) X, Y = X - 2, 22 print (X, Y)
Question 24(b)What will be the output produced by the following code fragment?first = 2 second = 3 third = first * second print (first, second,...
Question 24(c)What will be the output produced by the following code fragment?side = int (input ('side')) #Side given as 7 area = side * side print...
Question 25"Comments are useful and an easy way to enhance readability and understandability of a program." Elaborate with examples.
Question 26(a)Find errors in the following code fragment.a = 3 print(a) b = 4 print(b) s = a + b print (s)
Question 26(b)Find errors in the following code fragment.Name = "Prateek" Age = 26 print("your name & age are", Name + Age)
Question 26(c)Find errors in the following code fragment.A = 3 S = A + 10 A = "New" Q = A / 10
Question 27Give the output.x = 40 y = x + 1 x, y = 20, y + x print (x, y)
Question 28Give the output.x, y = 20, 60 y, x, y = x, y - 10, x + 10 print (x, y)
Question 29Give the output.a, b = 12, 13 c, b = a * 2, a/2 print(a, b, c)
Question 30Give the output.a, b, c = 10, 20, 30 p, q, r = c - 5, a + 3, b - 4 print(p, q, r)
Question 31Find errors in the following code fragment. (The input entered as XI)c = int (input ("Enter your class:")) print ("Your class is", c)
Question 32Find errors in the following code fragment.cl = input("Enter your class") print("Last year you were in class", cl - 1)
Question 33Write a Python program that accepts radius of a circle and prints its area.Solutionr = float(input("Enter radius of circle: ")) a =...
Question 34Write Python program that accepts marks in 5 subjects and outputs total and average marks.Solutionsubject1 = float(input("Enter marks for...
Question 35Write a program to find the area of a triangle.Solutionh = float(input("Enter height of the triangle: ")) b = float(input("Enter base of...
Question 36Write a program to input a number and print its first five multiples.Solutionn = int(input("Enter number: ")) print("First five multiples...
Question 37Write a program to read details like name, class, age of a student and then print the details, firstly in the same line and then in...
Question 38Write a program to read three numbers in three variables and swap first two variables with the sums of first and second, second and third...
Question 39Write Python codes for the following statements:(a) Assign value 10 to variable a.(b) Assign value 10 to variables a, b and c.(c) Assign...