24). Which of the following will run without errors?
>>>str="hello"
>>>str[:2]
>>>

[A]round(45.8)
[B]round(6352.898,2,5)
[C]round()
[D]round(7463.123,2,1)

Show Answer

25). What is the return type of function id?
>>>str="hello"
>>>str[:2]
>>>

[A]int
[B]float
[C]bool
[D]dict

Show Answer

26). In python we do not specify types, it is directly interpreted by the compiler, so consider the following operation to be performed. objective is to make sure x has a integer value, select all that apply (python 3.xx)
>>>x = 13 ? 2

[A]x = 13 // 2
[B]x = int(13 / 2)
[C]x = 13 % 2
[D]All of the mentioned

Show Answer

28). What will be the output of the following Python code snippet?
def example(a):
    a = a + '2'
     a = a*2
    return a
>>>example("hello")

[A]indentation Error
[B]cannot perform mathematical operation on strings
[C]hello2
[D]hello2hello2

Show Answer

30). In order to store values in terms of key and value we use what core data type.
L = [1, 23, 'hello', 1]

[A]list
[B]tuple
[C]class
[D]dictionary

Show Answer

31). Which of the following results in a SyntaxError?
L = [1, 23, 'hello', 1]

[A]‘”Once upon a time…”, she said.’
[B]“He said, ‘Yes!'”
[C] ‘3\’
[D] ”’That’s okay”’

Show Answer

32). The following is displayed by a print function call. Select all of the function calls that result in this output.
tom
dick
harry

[A] print('''tom \ndick \nharry''')
[B]print(”’tomdickharry”’)
[C]print(‘tom\ndick\nharry’)
[D]print('tom dick harry')

Show Answer

33). What is the average value of the following Python code snippet?
>>>grade1 = 80
>>>grade2 = 90
>>>average = (grade1 + grade2) / 2

[A]85.0
[B]85.1
[C]95.0
[D]95.1

Show Answer

34). Select all options that print.
hello-how-are-you

[A]print(‘hello’, ‘how’, ‘are’, ‘you’)
[B]print(‘hello’, ‘how’, ‘are’, ‘you’ + ‘-‘ * 4)
[C]print(‘hello-‘ + ‘how-are-you’)
[D]print(‘hello’ + ‘-‘ + ‘how’ + ‘-‘ + ‘are’ + ‘you’)

Show Answer