106 solutions available
Question 1A keyword is a reserved word carrying special meaning and purpose.
Question 2Identifiers are the user defined names for different parts of a program.
Question 3Literals are the fixed values.
Question 4Operators are the symbols that trigger some computation or action.
Question 5An expression is a legal combination of symbols that represents a value.
Question 6Non-executable, additional lines added to a program, are known as comments.
Question 7In Python, the comments begin with # character.
Question 8Python is a case sensitive language.
Question 9The print( ) function prints the value of a variable/expression.
Question 10The input( ) function gets the input from the user.
Question 11The input( ) function returns the read value as of string type.
Question 12To convert an input( )'s value in integer type, int( ) function is used.
Question 13To convert an input( )'s value in floating-point type, float( ) function is used.
Question 14Strings can be created with single quotes, double quotes and triple quotes.
Question 1Special meaning words of Pythons, fixed for specific functionality are called .......... .IdentifiersfunctionsKeywords ✓literals
Question 2Names given to different parts of a Python program are .......... .Identifiers ✓functionsKeywordsliterals
Question 3Data items having fixed value are called .......... .IdentifiersfunctionsKeywordsliterals ✓
Question 4Which of the following is/are correct ways of creating strings ?name = Jiyaname = 'Jiya' ✓name = "Jiya" ✓name = (Jiya)
Question 5Which of the following are keyword(s) ?namePrintprint ✓input ✓
Question 6Which of the following are valid identifiers ?my name_myname ✓myname ✓my-name
Question 7Which of the following are literals ?myname"Radha" ✓24.5 ✓24A
Question 8Escape sequences are treated as .......... .stringscharacters ✓integersnone of these
Question 9Which of the following is an escape sequence for a tab character ?\a\t ✓\n\b
Question 10Which of the following is an escape sequence for a newline character ?\a\t\n ✓\b
Question 11Which of the following is not a legal integer type value in Python ?DecimalOctalHexadecimalRoman ✓
Question 12Which of the following symbols are not legal in an octal value ?78 ✓9 ✓0
Question 13Value 17.25 is equivalent to0.1725E-20.1725E+2 ✓1725E20.1725E2 ✓
Question 14Value 0.000615 is equivalent to615E3615E-30.615E30.615E-3 ✓
Question 15Which of the following is/are expression(s) ?a+b-5 ✓a-5b-5 ✓
Question 16The lines beginning with a certain character, and which are ignored by a compiler and not executed, are called...
Question 17Which of the following can be used to create comments ?//# ✓'''''' . . . ''' ✓
Question 18Which of the following functions print the output to the console ?Output( )Print( )Echo( )print( ) ✓
Question 19Select the reserved keyword in Python.elseimportprintall of these ✓
Question 20The input( ) returns the value as .......... type.integerstring ✓floating pointnone of these
Question 21To convert the read value through input( ) into integer type, ..........( ) is used.floatingfloatint ✓integer
Question 22To convert the read value through input( ) into a floating point number, ..........( ) is used.floatingfloat ✓intinteger
Question 23To print a line a text without ending it with a newline, .......... argument is used with print( )sepnewlineend ✓next
Question 24The default separator character of print( ) is ..........tabspace ✓newlinedot
Question 25To give a different separator with print( ) .......... argument is used.sep ✓separatorendtab
Question 1Keywords can be used as identifier names.False
Question 2The identifiers in Python can begin with an underscore.True
Question 30128 is a legal literal value in Python.False
Question 40x12EFG is a legal literal value in Python.False
Question 50123 is a legal literal value in Python.True
Question 6Variables once assigned a value can be given any other value.True
Question 7Variables are created when they are first assigned their value.True
Question 8Python variables support dynamic typing.True
Question 9You can rename a keyword.False
Question 10String values in Python can be single line strings, and multi-line strings.True
Question 11A variable can contain values of different types at different times.True
Question 12Expressions contain values/variables along with operators.True
Question 1What are tokens in Python ? How many types of tokens are allowed in Python ? Examplify your answer.
Question 2How are keywords different from identifiers ?
Question 3What are literals in Python ? How many types of literals are allowed in Python ?
Question 4Can nongraphic characters be used in Python ? How ? Give examples to support your answer.
Question 5How are floating constants represented in Python ? Give examples to support your answer.
Question 6How are string-literals represented and implemented in Python ?
Question 7Which of these is not a legal numeric type in Python ? (a) int (b) float (c) decimal.
Question 8Which argument of print( ) would you set for:(i) changing the default separator (space) ?(ii) printing the following line in current line ?
Question 9What are operators ? What is their function ? Give examples of some unary and binary operators.
Question 10What is an expression and a statement ?
Question 11What all components can a Python program contain ?
Question 12What do you understand by block/code block/suite in Python ?
Question 13What is the role of indentation in Python ?
Question 14What are variables ? How are they important for a program ?
Question 15What do you understand by undefined variable in Python ?
Question 16What is Dynamic Typing feature of Python ?
Question 17What would the following code do : X = Y = 7 ?
Question 18What is the error in following code : X, Y = 7 ?
Question 19Following variable definition is creating problem X = 0281, find reasons.
Question 20"Comments are useful and easy way to enhance readability and understandability of a program." Elaborate with examples.
Question 1From the following, find out which assignment statement will produce an error. State reason(s) too.(a) x = 55(b) y = 037(c) z = 0o98(d)...
Question 2How will Python evaluate the following expression ?(i) 20 + 30 * 40
Question 3Find out the error(s) in following code fragments:(i)temperature = 90 print temperature
Question 4What will be the output produced by following code fragment (s) ?(i)X = 10 X = X + 10 X = X - 5 print (X)...
Question 5What is the problem with the following code fragments ?(i)a = 3 print(a) b = 4 print(b) s = a + b print(s)
Question 6Predict the output:(a)x = 40 y = x + 1 x = 20, y + x print (x, y)Output(20, 81) 41 Explanationx = 40 ⇒ assigns an initial value...
Question 7Predict the outputa, b, c = 10, 20, 30 p, q, r = c - 5, a + 3, b - 4 print ('a, b, c :', a, b, c, end = '') print ('p, q, r :', p, q,...
Question 8Find the errors in following code fragment(a)y = x + 5 print (x, Y)
Question 9Find the errors in following code fragment : (The input entered is XI)c = int (input ( "Enter your class") ) print ("Your class is", c)
Question 10Consider the following code :name = input ("What is your name?") print ('Hi', name, ',') print ("How are you doing?")was intended to print...
Question 11Find the errors in following code fragment :c = input( "Enter your class" ) print ("Last year you were in class") c - 1
Question 12What will be returned by Python as result of following statements?(a) >>> type(0)
Question 13What will be the output produced by following code ?(a) >>> str(print())+"One"OutputNoneOneExplanationprint() function doesn't...
Question 14Carefully look at the following code and its execution on Python shell. Why is the last assignment giving error ?>>> a = 0o12...
Question 15Predict the outputa, b, c = 2, 3, 4 a, b, c = a*a, a*b, a*c print(a, b, c)Output4 6 8 Explanationa, b, c = 2, 3, 4 ⇒ assigns initial value...
Question 16The id( ) can be used to get the memory address of a variable. Consider the adjacent code and tell if the id( ) functions will return the...
Question 17Consider below given two sets of codes, which are nearly identical, along with their execution in Python shell. Notice that first...
Question 18Predict the output of the following code :days = int (input ("Input days : ")) * 3600 * 24 hours = int(input("Input hours: ")) * 3600...
Question 19What will the following code result into ?n1, n2 = 5, 7 n3 = n1 + n2 n4 = n4 + 2 print(n1, n2, n3, n4)
Question 20Correct the following program so that it displays 33 when 30 is input.val = input("Enter a value") nval = val + 30 print(nval)
Question 1Write a program that displays a joke. But display the punchline only when the user presses enter key.(Hint. You may use input(...
Question 2Write a program to read today's date (only del part) from user. Then display how many days are left in the current month.Solutionday =...
Question 3Write a program that generates the following output :5109Assign value 5 to a variable using assignment operator (=) Multiply it with 2 to...
Question 4Modify above program so as to print output as 5@10@9.Solutiona = 5 print(a, end='@') a = a * 2 print(a, end='@') a = a - 1...
Question 5Write the program with maximum three lines of code and that assigns first 5 multiples of a number to 5 variables and then print...
Question 6Write a Python program that accepts radius of a circle and prints its area.Solutionr = float(input("Enter radius of circle: ")) a = 3.14159...
Question 7Write Python program that accepts marks in 5 subjects and outputs average marks.Solutionm1 = int(input("Enter first subject marks: ")) m2 =...
Question 8Write a short program that asks for your height in centimetres and then converts your height to feet and inches. (1 foot = 12 inches, 1...
Question 9Write a program to read a number n and print n2, n3 and n4.Solutionn = int(input("Enter n: ")) n2, n3, n4 = n ** 2, n ** 3, n ** 4 print("n...
Question 10Write a program to find area of a triangle.Solutionh = float(input("Enter height of the triangle: ")) b = float(input("Enter base of the...
Question 11Write a program to compute simple interest and compound interest.Solutionp = float(input("Enter principal: ")) r = float(input("Enter...
Question 12Write a program to input a number and print its first five multiples.Solutionn = int(input("Enter number: ")) print("First five multiples...
Question 13Write a program to read details like name, class, age of a student and then print the details firstly in same line and then in separate...
Question 14Write a program to input a single digit(n) and print a 3 digit number created as <n(n + 1)(n + 2)> e.g., if you input 7, then it...
Question 15Write a program to read three numbers in three variables and swap first two variables with the sums of first and second, second and third...