Quiz
Loops, Function and strings
Create a free account to finish this quiz
Save your progress and see your final score.
Already have an account? Sign in
Questions in this quiz (14)
1myString.isupper() method returns a string in upper case
- ATrue
- BFalse
2When checking if a string is a sub-string of another, both the in operator and the find(substring) method can be used. Both will return a True value when the substring is part of the given string.
- Atrue
- Bfalse
3Given the following string:
str = "This is a Quiz!"
both statements will return the same character
str[8]
str[-7]- Atrue
- Bfalse
4All of the following string methods require a substring as an argument.
endswith()
replace()
find()- Atrue
- Bfalse
5The following is a valid function definition:
def _getInput():
name = input()
return name- Atrue
- Bfalse
6A statement in one function can access a local variable in another function.
- Atrue
- Bfalse
7The argument is assigned the value of a parameter when the function is called.
- Atrue
- Bfalse
8The built-in input() function is an example of a void function.
- Atrue
- Bfalse
9A function that is defined will never execute unless it is called.
- Atrue
- Bfalse
10global number
def function1(number):
number += 7
return number
number = 5
number = function1(number)
print(number)
From the given code, the variable number in function1() is used as a global variable.- Atrue
- Bfalse
11Input validation is a way to design a program such that bad input will never be accepted to avoid producing bad output.
- ATrue
- BFalse
12In a nested loop, the inner loop goes through all of its iterations for every single iteration of the outer loop.
- ATrue
- BFalse
13To calculate the total number of iterations of a nested loop, add the number of iterations of all the loops.
- ATrue
- BFalse
14The process of input validation using loop, iterates when the user of a program enters invalid data.
- ATrue
- BFalse
Information
- Description
- Quiz on Loops, Function and strings, created by Kaithlyn Reyes on 15/11/2022.
- Author
- Kaithlyn Reyes
- Language
- English
- Views
- 6
- Rating
- No ratings yet Rate this quiz