[miniorange_social_sharing]
[TheChamp-Login]

/40

Final Exam for Python for Everyone (A to Z)

BEST OF LUCK!!!

1 / 40

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

2 / 40

2. When does the else statement written after loop executes?

a) When loop condition becomes false

b) When break statement is executed in the loop

c) else statement is always executed

d) None of the above

3 / 40

3. Python can be used to handle big data and perform complex mathematics.

4 / 40

4.

Which of the following creates a tuple?

A. tuple1=(“a”,”b”)
B. tuple1[2]=(“a”,”b”)
C. tuple1=(5)*2
D. None of the above

5 / 40

5.

def cal(n1) : What is n1?

a. Parameter

b. Argument

c. Keyword

d. None of the above

6 / 40

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

7 / 40

7. The list’s remove() method only removes the first occurrence of the specified value.

8 / 40

8. To insert characters that are illegal in a string, use an escape character

9 / 40

9. An array can hold many values under a single name

10 / 40

10. The length of an array is always one more than the highest array index.

11 / 40

11. A loop block in python starts with a –

a) ; (semicolon)

b) , (comma)

c) : (colon)

d) # (hash)

12 / 40

12. The format() method takes unlimited number of arguments

13 / 40

13. A variable name cannot start with a number

14 / 40

14. You can return a range of characters by using the slice syntax

15 / 40

15. Operators are used to perform operations on variables and values

16 / 40

16. Which term describes a loop that continues repeating without a terminating (ending) condition?

a) Infinite Loop

b) Conditional Loop

c) Unlimited Loop

d) Sequence Loop

17 / 40

17. What will be the output of the following Python code?

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

a) 1 2
b) 1 2 3
c) error
d) none of the mentioned

18 / 40

18. 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.

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. What is another word for ‘iteration’ ?

a) Selection

b) Assignment

c) Sequencing

d) Repetition

21 / 40

21. Which of the following character is used to give single-line comments in Python?
a) //
b) #
c) !
d) /*

22 / 40

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

23 / 40

23. X wants to allow the program to repeatedly ask the user to enter their Choice if it does not equal the Answer. Which loop option should X use?

a) while Choice == Answer:

Choice = input()

b) while Choice != Answer:

Choice = input()

c) while Answer != Choice:

Choice = input()

d) while Answer =! Choice:

Choice = input()

 

24 / 40

24.

Which of the following statement is a function call?

a. call sum( )

b. def sum( )

c. sum( )

d. function sum( )

25 / 40

25. A variable name must start with a letter or the underscore character

26 / 40

26.

Which one of the following is the correct extension of the Python file?

  1. .py
  2. .python
  3. .p
  4. None of these

27 / 40

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

28 / 40

28. Bitwise operators are used to compare (binary) numbers

29 / 40

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

30 / 40

30. Variable names are case-sensitive

31 / 40

31. Which of the following is the correct extension of the Python file?

32 / 40

32.

The function can be called in the program by writing function name followed by ____

a. [ ]

b. { }

c. ( )

d. None of the above

33 / 40

33. You can use the append() method to add an element to an array

34 / 40

34.

 What is output of: 35 == 35.0

  1. False
  2. True
  3. 33
  4. None of the above

35 / 40

35. Python is an interpreted programming language

36 / 40

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

37 / 40

37. break in Python is used ______________

a) To restart a loop

b) Terminate a loop

c) To jump in between the loop

d) None of the above

38 / 40

38.

What will be the output of below Python code?

str1="Information"print(str1[2:8])

A. format
B. formatio
C. orma
D. ormat

39 / 40

39. What keyword would you use to add an alternative condition to an if statement?

a) else if
b) elseif
c) elif
d) None of the above

40 / 40

40. Python can be install on both  Linux and  Windows

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.