Troy Bowlin
Quiz por , criado more than 1 year ago

AS - Level Computer Science (CS 1101 Python) Quiz sobre CS 1101 Week 5 , criado por Troy Bowlin em 18-05-2016.

126
1
0
Troy Bowlin
Criado por Troy Bowlin aproximadamente 8 anos atrás
Fechar

CS 1101 Week 5

Questão 1 de 13

1

What does the function subroutine do?

def subroutine(n):
while n>0:
print(n,)
n-=1

Selecione uma das seguintes:

  • Counts down from 10 to 0 and displays each number

  • Counts from n down to 1 and displays each number

  • Calculates the sum of n numbers greater than 0

  • Calculates the mean of n

Explicação

Questão 2 de 13

1

What output will the following python command produce:

>>>percentage = float (60*100)/50
>>>print(percentage)

Selecione uma das seguintes:

  • percentage

  • 109

  • 109.0909090909091

  • 109.0

Explicação

Questão 3 de 13

1

What outputs will the following python commands produce:
n=10000
count=0
while n:
count=count+1
n=n//10

print(count)

Selecione uma das seguintes:

  • 5

  • 0

  • 10000

  • 1000

Explicação

Questão 4 de 13

1

What output will the following python commands produce:

x=5
if x%2==0:
print(x)
else:
print(x,x%2)

Selecione uma das seguintes:

  • 5

  • 5 1

  • 2

  • 5 0

Explicação

Questão 5 de 13

1

What is the output of the following statements?

pi=float(3.14159)
print(pi)

Selecione uma das seguintes:

  • 3

  • 3.0

  • 3.14159

  • 0

Explicação

Questão 6 de 13

1

Expressions evaluate to either True or False:. What will the output of the following code be when the expression "Ni!" is evaluated?

if "Ni!"
print("We are the knights who say, "Ni!")
else
print("Stop it! No more of this!")

Selecione uma das seguintes:

  • Stop it!

  • We are the knights who say, "Ni!"

  • Stop it! No more of this!

  • No output will be produced

Explicação

Questão 7 de 13

1

What output will the following python commands produce:

x=1
y=2
if x==y:
print(x,"and",y,"are equal")
else
if x<y:
print(x,"is less than", y)
else
print(x,"is greater than",y)

Selecione uma das seguintes:

  • 1 and 2 are equal

  • 1 is less than 2

  • 1 is greater than 2

  • 2 is greater than 2

Explicação

Questão 8 de 13

1

The following code is an example of what principle?

bruce=5
print(bruce,)
bruce=7
print(bruce)

Selecione uma das seguintes:

  • Multiple Assignment

  • An iteration or loop structure

  • A logical operator

  • A conditional operator

Explicação

Questão 9 de 13

1

The % or modulus operator returns the remainder present when two integers do not divide evenly into one another

Selecione uma das opções:

  • VERDADEIRO
  • FALSO

Explicação

Questão 10 de 13

1

An algorithm is a step by step process for solving a problem

Selecione uma das opções:

  • VERDADEIRO
  • FALSO

Explicação

Questão 11 de 13

1

Functions allow the programmer to encapsulate and generalize sections of code.

Selecione uma das opções:

  • VERDADEIRO
  • FALSO

Explicação

Questão 12 de 13

1

One way to generalize a function is to replace a variable with a value.

Selecione uma das opções:

  • VERDADEIRO
  • FALSO

Explicação

Questão 13 de 13

1

A variable name defined in a function cannot appear in the calling program because it will cause a conflict error.

Selecione uma das opções:

  • VERDADEIRO
  • FALSO

Explicação