logo

Crowdly

Browser

Додати до Chrome

Questions Bank (1401169 total)

Consider the following Python code of 4 lines, with line numbers (not part of the code) shown on the left. The objective is to write a string onto the file.

1 f = open('Out.txt', 'w')
2 f.write("this is the string")
3 ...........
4 print('Done...')

What should fill the blank at line 3 to make the code complete?

0%
0%
100%
0%
Переглянути це питання

Out of the four control structures used in programs, a Python function is a:

0%
100%
0%
0%
Переглянути це питання

What will be the output of the following Python function?

def findList( inputList ):

return [i for i in inputList if i%2 == 1]

0%
0%
0%
0%
Переглянути це питання

What will be the output of the following Python code segment?

def printinfo(arg1,*vartuple):

  total = 0;

  for var in vartuple:

    total += var

  print (total)

  return

printinfo(70,60,50,40,30,20)
Переглянути це питання

What will be the output of the following Python code segment?

d = "M"

def add( arg2 , arg1 = "U" ):

    global d

    d += arg2 + arg1

    return

add("o")

print (d)
Переглянути це питання

What will be the output of the following Python code segment?

def myFunc( x ):

        x += 30

        return x

x = 20

myFunc(x)

print (x)

Переглянути це питання

Regulārā trijstūra piramīdā ievilkts konuss. Aprēķini konusa tilpumu, ja piramīdas pamata malas garums ir 6 cm un piramīdas augstums ir 8 cm!

 

0%
0%
0%
0%
Переглянути це питання

What will be the output of the following Python code segment?

def makeWord( c1 = "m", *c2 ):

    c = c1

    for a in c2:

        c += a

    return c

print (makeWord("k","i","n","d"))
Переглянути це питання

Consider the following Python function.

def PerformTask(S):

    L = [];

    for i in range(0, len(S)):

        if S[i] == "(":

            L.append(S[i])

        elif S[i] == ")" and len(L)>0:

            L.pop()

        else:

            return False

    return True

Which of the following input parameter will result in a return value of “True" in the above?

0%
0%
100%
Переглянути це питання

What will be the output of the following Python code segment?

def printname( fn = "L", sn = "D", ln = "Shanaka" ):

    ln = "Mathews"

    print(fn,sn,ln)

    return

printname("A")
Переглянути це питання