Python Programming Language MCQ with Answers Set 3

 

1.The variable name can only have --------





ANSWER= (C) Both of above
Explain:-In Python variable can have alphanumeric, underscore. Variable cannot start with numbers.

 

2.The ----- keyword is used to pass the statement in loop or conditional statement





ANSWER= (D) pass
Explain:-In Python when pass is used nothing is happen. In case of empty code the pass statement is used. When it is used the statement is not executed

 

3.The ----- statement is used to to break out of for or while loop and to move to the next statement





ANSWER= (A) break
Explain:-In Python break statement is used to break out from the loop and move to the next statement for execution

 

4.The ----- statement is used to to skip the current iteration and move to the next iteration





ANSWER= (B)continue
Explain:-In Python contiue statement is used to skip the current iteration and to move to the next iteration

 

5.The ----- of one data type into another data type is called





ANSWER= (C)Both A and B
Explain:-In Python type casting or type conversion is the method of data type conversion from one data type to another

 

6.The ----- operator is used to get exponent of variable





ANSWER= (D)**
Explain:-In Python ** operator is used to get exponent of variable

 

7.The ------ operator is floor division in Python





ANSWER= (A)//
Explain:-In Python // operator is the floor division operator in python. / operator return the float result and // operator return integer result.

 

8.a=input("Enter first number") b=input("Enter second number") c=a*b print(c) what will be the output of above code if your input is 10 and 10





ANSWER= (C)Type casting error
Explain:-In Python input function returns the string. Though our input is 10 and 10 and we want to multyply two numbers compiler will consider these input as string and numerical operations are not possible on string so type casting error will occur

 

9.The ----- is the identity operator in Python





ANSWER= (C)Both A and B
Explain:-In Python iis and is not are used as an identity operator in Python

 

10.a=100 b=20 c=200 if a>b and a>c: print("a greater") What will be the output of given code





ANSWER= (C)Nothing will display
Explain:-The two conditions are combined with logical and. If both the conditions are true then only if block will get execute otherwise nothing will happen

 

11.a=110 b=20 c=200 if a>b or a>c: print("a greater") What will be the output of above group





ANSWER= (A)a is greater
Explain:-The two conditions are combined with logical or. In this case if any one condition is true then statement in if block will get execute.

टिप्पणी पोस्ट करा

0 टिप्पण्या