[miniorange_social_sharing]
[TheChamp-Login]

/40

Final Exam for Python for Everyone (A to Z)

BEST OF LUCK!!!

1 / 40

1. A for loop is used for iterating over a sequence (that is either a list, a tuple, a dictionary, a set, or a string).

2 / 40

2.

Which of the following is not a keyword in Python language?

  1. val
  2. raise
  3. try
  4. with

3 / 40

3. Which of the following is a Python tuple?
a) [1, 2, 3]
b) (1, 2, 3)
c) {1, 2, 3}
d) {}

4 / 40

4. Find the output of the given Python program?

a, b, c = 1, 3, 5if a > 0:  if b < 2:    print("Hi")  elif c > 3:    print("Hello")else:  print("Know Program")

a) Hi
b) Hello
c) Know Program
d) Compiled Successfully, No Output.

5 / 40

5. if statements cannot be empty, but if you for some reason have an if statement with no content, put in the pass statement to avoid getting an error

6 / 40

6. You can have if statements inside if statements, this is called nested if statements.

7 / 40

7. A loop block in python starts with a –

a) ; (semicolon)

b) , (comma)

c) : (colon)

d) # (hash)

8 / 40

8. Is there any comments in  following codes

i = 1while True:    if i%3 == 0:        break    print(i)     i + = 1

 

9 / 40

9. Python  was created by Guido van Rossum, and released in 1999.

10 / 40

10.

Which keyword is used to begin the definition of a function?

a. Define

b. DEF

c. def

d. Def

11 / 40

11.

 Which of the following statement is False?

  1. Variable names can be arbitrarily long.
  2. They can contain both letters and numbers.
  3. Variable name can begin with underscore.
  4. Variable name can begin with number.

12 / 40

12. What is the output of the given below program?

if 1 + 3 == 7:    print("Hello")else:    print("Know Program")

a) Hello
b) Know Program
c) Compiled Successfully, No Output.
d) Error

13 / 40

13. A variable name cannot start with a number

14 / 40

14. Camel Case
Each word, except the first, starts with a capital letter:

15 / 40

15.

 ____________________ can be defined as a named group of instructions that accomplish a specific task when it is invoked/called.

a. Function

b. Datatype

c. Token

d. Operator

16 / 40

16. Variable names are case-sensitive

17 / 40

17. During Installation Make sure to select both the checkboxes at the bottom .

18 / 40

18. You can also have an else without the elif

19 / 40

19. Which of the following is False regarding loops in Python?

a)Loops are used to perform certain tasks repeatedly.

b) while loop is used when multiple statements are to executed repeatedly until the given condition becomes true.

c) while loop is used when multiple statements are to executed repeatedly until the given condition becomes false.

d) for loop can be used to iterate through the elements of lists.

20 / 40

20. All keywords in Python are in _________
a) Capitalized
b) lower case
c) UPPER CASE
d) None of the mentioned

21 / 40

21.

Write the output of the following code :

str = "Welcome"str[2] = 'a'print(str)

a. Weacome

b. Error

c. aWelcome

d. Welcomea

22 / 40

22.

Which statement is correct?

A. List is immutable && Tuple is mutable
B. List is mutable && Tuple is immutable
C. Both are Mutable.
D. Both are Immutable

23 / 40

23. print() function is often used to output variables.

24 / 40

24. You have to use the same number of spaces in the same block of code, otherwise Python will give you an error

25 / 40

25.

Choose the correct option with respect to Python.

A. Both tuples and lists are immutable.
B. Tuples are immutable while lists are mutable.
C. Both tuples and lists are mutable.
D. Tuples are mutable while lists are immutable.

26 / 40

26. Snake Case
Each word is separated by an underscore character:

27 / 40

27. Official site of python is www.python.org

28 / 40

28.

l = [ 4, 8, 9, 2.6, 5 ] is a type of which data type in python?

  1. List
  2. Tuple
  3. Set
  4. None of these

29 / 40

29.

Which is the correct operator for power(xy)?

  1. X^y
  2. X**y
  3. X^^y
  4. None of the mentioned

30 / 40

30. Comments can be used to explain Python code.

31 / 40

31. An example of an illegal character is a double quote inside a string that is surrounded by double quotes

32 / 40

32. Which keyword is used for function?
a) Fun
b) Define
c) Def
d) Function

33 / 40

33.

Which of the following is False?

A. String is immutable.
B. capitalize() function in string is used to return a string by converting the whole given string into uppercase.
C. lower() function in string is used to return a string by converting the whole given string into lowercase.
D. None of these.

34 / 40

34.

Which of the following statement will execute in last?

def s(n1): #Statement 1      print(n1) #Statement 2n2=4 #Statement 3s(n2) #Statement 4

a. Statement 1

b. Statement 2

c. Statement 3

d. Statement 4

35 / 40

35.

In the Python statement x = a + 5 – b:

a and b are ________a + 5 - b is ________
  1. terms, a group
  2. operators, a statement
  3. operands, an expression
  4. operands, an equation

36 / 40

36. Most recent major version of Python is Python 3

37 / 40

37.

In a program, a function can be called ____________ times.

a. 2

b. 3

c. 5

d. Multiple times

38 / 40

38.

 Select the correct example of complex datatype in Python

  1. 3 + 2j
  2. -100j
  3. 5j
  4. All of the above are correct

39 / 40

39. Comments can’t be used to prevent execution when testing code.

40 / 40

40. You can also have multiple else statements on the same line:

Exit



[hurrytimer id=”2250″]
[wooct_product]

Wrong shortcode initialized


You must log in to see your results.



Wrong shortcode initialized


There are no questions atteched yet.





[ays_quiz_leaderboard id=”Your_Quiz_ID” from=”Y-m-d H:i:sa” to=”Y-m-d H:i:s”]

Category:


Wrong shortcode initialized


[WATU 1]

You must log in to see your results.