75 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): A statement or statements (block of code)...
Question 3Assertion (A): In an if-else statement, the if block checks the true part whereas else checks for the false part.Reasoning (R): In a...
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 8Assertion (A): Indentation is a very important factor while writing a program in Python.Reasoning (R): Indentation refers to the spaces at...
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 3The most popularly used looping constructs in Python are for loop and while loop.
Question 4For loop is the best when the number of iterations is known.
Question 5Conditional statements let us write a program to do different tasks or take different paths based on the outcome of the conditions.
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 8The for statement is used to iterate over a range of values or a sequence.
Question 9The statements within the body of for loop are executed till the range of values is exhausted.
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 7What will be the output?x = ['ab', 'cd'] for i in x: i.upper() print (x)['ab', 'cd']['AB', 'CD'][None, None]None of these
Question 8Which statement is used to iterate itself over a range of values or a sequence?ifwhiledo-whilefor
Question 9Find the output of the following Python program:for x in range(1, 20, 3): print(x, end...
Question 10if statement comes in which category of statements?Sequential statementsConditional statements.Iterative statementsLoop statement
Question 1What are compound statements?
Question 2Construct a logical expression to represent each of the following conditions:(a) Marks are greater than or equal to 70 but less than...
Question 3Find error in the following code (if any) and correct it by rewriting the code and underline the corrections:code=input ("Enter season code...
Question 4(a)Give the output of the following when num1 = 4, num2 = 3, num3 = 2.num1 += num2 + num3 print(num1)
Question 4(b)Give the output of the following when num1 = 4, num2 = 3, num3 = 2.num1 = num1 ** (num2 + num3) print (num1)
Question 4(c)Give the output of the following when num1 = 4, num2 = 3, num3 = 2.num1 **= num2 + c print (num1)
Question 4(d)Give the output of the following when num1 = 4, num2 = 3, num3 = 2.num1 = '5' + '5' print (num1)
Question 4(e)Give the output of the following when num1 = 4, num2 = 3, num3 = 2.print(4.00 / (2.0+2.0))
Question 4(f)Give the output of the following when num1 = 4, num2 = 3, num3 = 2.num1 = 2 + 9 * ((3*12)-8)/10 print(num1)
Question 4(g)Give the output of the following when num1 = 4, num2 = 3, num3 = 2.num1 = float(10) print(num1)
Question 4(h)Give the output of the following when num1 = 4, num2 = 3, num3 = 2.num1 = int('3.14') print(num1)
Question 4(i)Give the output of the following:print (10 != 9 and 20 >= 20)
Question 4(j)Give the output of the following:print(5 % 10 + 10 < 50 and 29 <= 29)
Question 5What is the difference between else and elif constructs of if statement?
Question 6(a)Find the output of the following program segment:for i in range(20, 30, 2): print(i)
Question 6(b)Find the output of the following program segment:country = 'INDIA' for i in country: print (i)
Question 6(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 7(a)Write the output of the following:for i in '123' : print ("Message",i,)
Question 7(b)Write the output of the following:for i in [100,200,300] : print (i)
Question 7(c)Write the output of the following:for j in range (10,6,-2) : print (j*2)
Question 7(d)Write the output of the following:for x in range (1, 6) : for y in range (1, x+1): print (x, ' ', y)
Question 7(e)Write the output of the following:for x in range (10, 20): if (x == 15): break print(x)
Question 7(f)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 10WAP 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 11WAP to perform all the mathematical operations of a calculator.Solutionprint("Select operation:") print("1. Add") print("2. Subtract")...
Question 12WAP to convert binary number to decimal number.Solutionbinary = input("Enter a binary number: ") decimal = 0 for digit in binary:...
Question 13WAP to find the sum of the digits of a number.Solutionnumber = int(input("Enter a number: ")) sum_of_digits = 0 while number > 0:...
Question 14Write a function to display prime numbers below 30.Solutiondef prime_numbers(): for num in range(2, 30): for i in range(2,...
Question 15WAP to print the sum of the series 1 - x1/2! + x2/3! - x3/4! ............... xn/(n + 1)! — exponential series.Solutionx = int(input("Enter...
Question 16WAP to print the sum of the series 1 - x2/4! + x3/6! - x4/8! + x5/10! ............... xn/(2n)! — exponential series.Solutionx =...
Question 17WAP 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 18(a)WAP to print the following pattern:* * * * * * * * * * * * * * * Solutionn = 5 for i in range(1, n + 1): for j in range(i):...
Question 18(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 18(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 and algorithm 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 5The body of the loop that is executed more than one time is called iteration.
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 if statement is a decision-making statement.
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.