option
Questions
ayuda
daypo
search.php

python basic 6

COMMENTS STATISTICS RECORDS
TAKE THE TEST
Title of test:
python basic 6

Description:
python basic set 6

Creation Date: 2021/04/29

Category: Others

Number of questions: 27

Rating:(0)
Share the Test:
Nuevo ComentarioNuevo Comentario
New Comment
NO RECORDS
Content:

Consider the following code: v1 = 1 v2 = 0 v1 = v1 ^ v2 v2 = v1 ^ v2 v1 = v1 ^ v2 print(v1) What is the result?. 0. 3. 2. 1.

In which of the following cases, True will be printed to the console ?. print('r' in 'Larry') (Correct). a=45 b=45 print(a is not b). x=[1,2,3] y=[1,2,3] print(x is y). s1='The Python Course' s2='The Python Course'.upper() print(s1 is s2).

Consider the code x='10' y='20' The type of x+y ?. int. complex. str. float.

Consider the code a=7 b=3 c=5 d=1 Which line of the code assigns 9 to the output?. output=a%c+1. output=a+d*2. output=c*d-1. output=a+c//d.

Consider the code: from sys import argv print(argv[0]) and given the command invocation:py test.py SampleText What is the result?. ImportError will be thrown at runtime. test.py. IndexError will be thrown at runtime. SampleText.

Given the command invocation:py test.py AlexWhich of the following code prints 'Alex' to the console?. from sys import argv print(argv[0]). from sys import args print(args[1]). from sys import argv print(argv[1]). from sys import args print(args[0]).

Consider the code a=float('123.456')Which expression evaluates to 2?. int(a)+False. str(a). bool(a). bool(a)+True.

Consider the code: print(not 0) print(not 10) print(not '') print(not 'Google') print(not None) What is the result?. True False True False False. False False True False True. True False True False True. True False False False True.

You develop a Python application for your company. You required to accept input from the user and print that information to the user screen. Consider the code: print('Enter Your Name:') #Line-1 print(name) At Line-1, which code we have to write?. input(name). name=input(). name=input. input('name').

Consider the code count=input('Enter the number of customers of the bank:') #Line-1 print(output) Which code inserted at Line-1 will print 20 to the console if we pass 15 as count value from the console?. output=str(count)+5. output=int(count)+5. output=float(count)+5. output=count+5.

Consider the variable declaration b = 'BANANA' Which of the following lines will not print 'AA' to the console?. print(b[1]+b[3]). print(b[1]+b[5]). print(b[1]+b[2]). print(b[3]+b[5]).

Which of the following are valid statements? there are two answers select any one. type('') is. True and False evaluates to False. True or False evaluates to False. True+1 evaluates to 2. 5+False evaluates to False.

Consider the following expression : 6//4%5+2**3-2//3 This expression results in: -1. 25. 3. 9.

Consider the Variable declarations: a='5' b='2' Which of the following expressions are of type str there are two answers select any one. a-b. a*b. a*2. a+b.

Consider the code t=([10,20],10,False) Which line of the code assigns <class 'list'> to x. x= type(t[0:]). x= type(t). x= type(t[0]). x= type(t[1]).

Which expression evaluates to 4?. 7/2*3. 7%2+3. 7//2-3. 7-2*3.

Consider the Code x=3/3+3**3-3 print(x) What is the output?. 0.11. 25. 25.0. 32.

In which of the following cases we will get <class 'int'> as output?. x=47.0 print(type(x)). x=2**2**2 print(type(x)). x=10+20j print(type(x)). x='47' print(type(x)).

The XYZ Company has hired you as an intern on the coding team that creates a e-commerce application.You must write a script that asks the user for a value. The value must be used as a whole number in a calculation,even if the user enters a decimal value.Which of the following meets this requirement?. total_items=float(input('How many items you required?')). total_items=str(input('How many items you required?')). total_items=int(float(input('How many items you required?'))). total_items=input('How many items you required?').

Which of the following statements are valid?. The following expression evaluates to 12 b=False+5-True+35//4. The following line will print result:4.5 print('result:',(7/2)+(False or True)+(9%3)). result=456+456.0 type of result is int. s="Siri's voice recognition is Good" It causes an error because we cannot use double quotes and single quotes simultaneously.

Consider the code: from sys import argv print(argv[1]+argv[2]) and given the command invocation:py test.py 10 20 What is the result?. IndexError will be thrown at runtime. ImportError will be thrown at runtime. 30. 1020.

From the sys module, by using which variable we can access command-line arguments?. argsv. argv. arguments. args.

Consider the code: lst = [7, 8, 9] b = lst[:] print(b is lst) print(b == lst) What is the result?. False True. True False. True True. False False.

Which type of exception will be raised if we are trying to call a method on the inappropriate object?. IndexError. TypeError. AttributeError. None of these.

Consider the code f=open('abc.txt') f.readall() Which exception will be raised?. AttributeError. EOFError. SystemError. SyntaxError.

Consider the code: def f1(): try: return 1 finally: return 2 x=f1() print(x) What is the result?. 1. 2. prints both 1 and 2. Error, because more than one return statement is not allowed.

The base class for all exceptions in python is: ExceptionBase. BaseException. Exception. EOFError.

Report abuse
Chistes IA