Question: Q 1 . Using Python script as a calculator Create the variables n , r , p and assign them values 1 0 , 5
Q Using Python script as a calculator
Create the variables n r p and assign them values and respectively. Then
evaluate the following expression in the Python console.
n
a
b
c
d None of the above
Q In a given string format operation, how will you print the given string.
A
B
Str "There are students in the class, with who play at least one sport."
a printstringformatab
b printstringab
c printstringformatba
d None of the above
Q In a given sample string, How do you print a double quoted string in between a
regular
string using the escape character?
Sample output It goes without saying, Time is Money and none can deny it
a printIt goes without saying, Time is Money and none can deny it
b printIt goes without saying, Time is Money and none can deny it
c printIt goes without sayingTime is Moneyand none can deny it
d None of the above.
Q What will be the output of the following code?
x lambda ab: ab
x
a
b
c
d
Q What will be the output of the following code?
A
B
printSmaller if A B else printGreater if A B else printTrue
a True
b Smaller
c Greater
d None of the above
Q What will be the output of the following code?
a
b TypeError
c NameError: name 'numpy' is not defined
d None of the above
Q Create a string called string with the value as Machine Learning Which codes
isare appropriate to slice the substring Learn
a stringslice
b stringslice
c string:
d stringslice
Q Create a sequence of numbers from to and increment by What is the index
of the
value
a
b
c
d
Q Which of the following is true with respect to the below codes?
a num num
b num num
c num num
d num num
QA Python NameError exception is raised when:
a Trying to access a variable which has not been defined
b Trying to access a key in a dictionary that does not exist
c Accessing a column with misspelled column name
d Accessing the function from a module that has not been imported
QWhat type of exception will be raised for the code given below?
a NameError
b KeyError
c ValueError
d AttributeError
QA FileNotFoundError exception is raised by operating system errors when:
a Trying to create a file or directory which already exists
b A file or directory is requested but does not exist in the working directory
c Trying to run an operation without the adequate access rights
d A directory operation, oslistdir is requested on something which is not a
directory
QConsider a variable Z The value of Z is ID Data type of Z is:
a Complex
b Character
c Integer
d Boolean
QWhich of the following variables are character data type?
a K
b JWelcome
c L
d All of the above
QChoose the symbols that does not have the ability to convert any values to string?
a
b
c
d #
QCreate a dictionary Country that maps the following countries to their capitals
respectively:
Country India China Japan Qatar France
State Delhi Beijing Tokyo Doha Marseilles
Find commands to replace Marseilles with Paris is:
Q Create the tuples given below
tuple
tuple
Identify which of the following code does not work on a tuple.
a sumtuple
b lentuple
c tuple tuple
d tuple
Q How many elements in the following data structure?
QWrite a function which finds all pythagorean triplets of triangles whose sides are no
greater than a natural number N
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
