80 solutions available
Question 1Assertion (A): When a set of statements is indented under the same block, starting from the same indentation, it is said to be a compound...
Question 2Assertion (A): The conditional flow of control is implemented using if statement.Reasoning (R): if statements can only be used to execute a...
Question 3Assertion (A): In an if-else statement, the if block checks the true part whereas the else checks for the false part.Reasoning (R): if-else...
Question 4Assertion (A): When a Python code is unable to accept an input, it results in runtime error.Reasoning (R): Runtime error arises due to...
Question 5Assertion (A): The break and continue statements are known as jump statements.Reasoning (R): Jump statements are used only with looping...
Question 6Assertion (A): The range() method is used with both for and while loops.Reasoning (R): By default, the values for start and step are 0...
Question 7Assertion (A): The for loop is described as finite loop and while loop is described as unknown or indefinite iterative construct.Reasoning...
Question 1Statements in Python are executed sequentially while working with a sequence construct.
Question 2Flow charts are diagrams that show the step-by-step solution to a given problem.
Question 3Two types of looping statements are for and while.
Question 4For loop is the best when the number of iterations is known.
Question 5break statement terminates the loop.
Question 6A loop that never ends is called an infinite loop.
Question 7The iterative or looping construct means repetition of a set of statements depending upon a condition test.
Question 8In nested loop inner loop must be terminated before the outer loop.
Question 9continue statement abandons the current iteration of the loop.
Question 10Header line begins with a keyword and ends with a colon.
Question 1A graphical representation of an algorithm to solve a given problem:Flow chartPie chartBar chartColumn chart
Question 2Which of the following is not a decision-making statement?if-elif statementfor statementif-else statementif statement
Question 3The symbol used to end the if statement:Semicolon (;)Hyphen ( - )Underscore ( _ )Colon (:)
Question 4Which of the following is a valid keyword?IFIfifNone of these
Question 5What does the following code print to console?if True: print (101) else: print (202)101202303102
Question 6Which of the following is not a loop statement in Python?do-whilewhileforAll of these
Question 7How many times will the following code be executed?a = 5 while a > 0: print(a) print("Thank You")5 timesOnceInfiniteNone of these
Question 8Which statement is used to iterate itself over a range of values or a sequence?ifwhiledo-whilefor
Question 9In a Python program, a control structure:Directs the order of execution of the statements in the programDictates what happens before the...
Question 10Find the output of the following Python program:for x in range(1, 20, 3): print(x, end...
Question 11What abandons the current iteration of the loop?continuebreakstopinfinite
Question 12An empty/null statement in Python is:gopassover;
Question 13In Python, which of the following will create a block in a compound statement?colonstatements indented at a lower, same levelindentation...
Question 1What are compound statements?
Question 2What are jump statements?
Question 3What is nested loop? Explain with example.
Question 4What is the significance of updating loop control variable in while statements?
Question 5Construct a logical expression to represent each of the following conditions:(a) Mark is greater than or equal to 100 but less than 70.(b)...
Question 6Find error in the following code (if any) and correct it by rewriting the code and underline the corrections:code=input ("Enter season code...
Question 7(i)Write the output of the following:for i in '123': print("guru99",i,)
Question 7(ii)Write the output of the following:for i in [100,200,300] : print (i)
Question 7(iii)Write the output of the following:for j in range (10,6,-2) : print (j*2)
Question 7(iv)Write the output of the following:for x in range (1, 6) : for y in range (1, x+1): print (x, ' ', y)
Question 7(v)Write the output of the following:for x in range (10, 20): if (x == 15): break print(x)
Question 7(vi)Write the output of the following:for x in range (10, 20): if (x % 2 == 0): continue print (x)
Question 8Write the output of the following program on execution if x = 50:if x > 10: if x > 25: print ( 'ok' ) if x > 60:...
Question 9Write the output of the following code:for i in range (2) : for j in range (1) : if i+2 == j: print ("+",end=" ") else:...
Question 10(a)Give the output of the following when num1 = 4, num2 = 3, num3 = 2.num1 += num2 + num3 print(num1)
Question 10(b)Give the output of the following when num1 = 4, num2 = 3, num3 = 2.num1 = num1 ** (num2 + num3) print (num1)
Question 10(c)Give the output of the following when num1 = 4, num2 = 3, num3 = 2.num1 **= num2 + c print (num1)
Question 10(d)Give the output of the following when num1 = 4, num2 = 3, num3 = 2.num1 = '5' + '5' print (num1)
Question 10(e)Give the output of the following when num1 = 4, num2 = 3, num3 = 2.print(4.00 / (2.0+2.0))
Question 10(f)Give the output of the following when num1 = 4, num2 = 3, num3 = 2.num1 = 2 + 9 * ((3*12)-8)/10 print(num1)
Question 10(g)Give the output of the following when num1 = 4, num2 = 3, num3 = 2.num1 = float(10) print(num1)
Question 10(h)Give the output of the following:num1 = int(float('3.14')) print(num1)
Question 10(i)Give the output of the following:print (10 != 9 and 20 >= 20)
Question 10(j)Give the output of the following:print(5 % 10 + 10 < 50 and 29 <= 29)
Question 11What is the difference between else and elif constructs of if statement?
Question 12(a)Find the output of the following program segment:for i in range(20, 30, 2): print(i)
Question 12(b)Find the output of the following program segment:country = 'INDIA' for i in country: print (i)
Question 12(c)Find the output of the following program segment:i = 0; sum = 0 while i < 9: if i % 4 == 0: sum = sum + i i = i...
Question 13Write a program to check if the number is positive or negative and display an appropriate message.Solutionnumber = int(input("Enter a...
Question 14WAP to display even numbers between 10 and 20.Solutionfor num in range(10, 21): if num % 2 == 0: print(num)Output10 12 14 16...
Question 15WAP to perform all the mathematical operations of a calculator.Solutionprint("Select operation:") print("1. Add") print("2. Subtract")...
Question 16Write a program to accept a number and display the factorial of that number.Solutionnumber = int(input("Enter a number: ")) factorial = 1...
Question 17Write a function to display prime numbers below 30.Solutiondef prime_numbers(): for num in range(2, 30): for i in range(2,...
Question 18WAP to print the sum of the series 1 - x1/2! + x2/3! - x3/4! ............... xn/(n + 1)! — exponential series.Solutionx = int(input("Enter...
Question 19WAP to print the sum of the series 1 - x2/4! + x3/6! - x4/8! + x5/10! ............... xn/(2n)! — exponential series.Solutionx =...
Question 20WAP to display the sum of the given series:Sum = 1 + (1 + 2) + (1 + 2 + 3) + (1 + 2 + 3.....n)Solutionn = int(input("Enter the value of n:...
Question 21(a)WAP to print the following pattern:* * * * * * * * * * * * * * * Solutionn = 5 for i in range(1, n + 1): for j in range(i):...
Question 21(b)WAP to print the following pattern:A B B C C C D D D D E E E E E Solutionn = 5 for i in range(n): for j in range(i + 1):...
Question 21(c)WAP to print the following pattern:1 2 1 3 2 1 4 3 2 1 5 4 3 2 1 Solutionn = 5 for i in range(1, n + 1): for j in range(i, 0, -1):...
Question 1Flow chart is not a graphical representation of steps to solve a given problem.
Question 2if, elif, else are not block or compound statements.
Question 3Every compound statement of Python has a header and indented body below the header.
Question 4Block is the group of consecutive statements having some indentation level.
Question 5Python offers pass statement as empty statement.
Question 6To cancel the running of endless loop, you can press CTRL+C key any time during its endless repetition to stop it.
Question 7Indentation while working with blocks is not necessary in Python.
Question 8else if statement can be used in Python.
Question 9The continue statement skips the current iteration in a loop and causes the next iteration of loop to take place.
Question 10The else block for a loop executes only in the case of normal termination of the loop.
Question 11Repeated execution of a set of statements is called iteration.