[miniorange_social_sharing]
[TheChamp-Login]

/40

Final Exam for Python for Everyone (A to Z)

BEST OF LUCK!!!

1 / 40

1. 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()

 

2 / 40

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

3 / 40

3. Python has syntax that allows developers to write programs with fewer lines than some other programming languages.

4 / 40

4. python file can also run on command line

5 / 40

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

6 / 40

6.

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.

7 / 40

7. You can also have an else without the elif

8 / 40

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

9 / 40

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

10 / 40

10. Python has a set of built-in methods that you can use on lists/arrays

11 / 40

11. The for loop in Python is an _____________

a) Entry Controlled Loop

b) Exit Controlled Loop

c) Both of the above

d) None of the above

12 / 40

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

13 / 40

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

14 / 40

14.

 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.

15 / 40

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

16 / 40

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

17 / 40

17. A variable name cannot start with a number

18 / 40

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

19 / 40

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

20 / 40

20. The len() method to return the length of an array

21 / 40

21.

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

a. Define

b. DEF

c. def

d. Def

22 / 40

22. Find the output of the given Python program?

a = 25if a < 15:    print("Hi")if a <= 30:    print("Hello")else:    print("Know Program")

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

23 / 40

23. We can combine strings and numbers by using the format() method

24 / 40

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

25 / 40

25.

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

26 / 40

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

27 / 40

27. Python has various versions available

28 / 40

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

29 / 40

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

30 / 40

30. A loop block in python starts with a –

a) ; (semicolon)

b) , (comma)

c) : (colon)

d) # (hash)

31 / 40

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

32 / 40

32.

Which function overloads the >> operator?

  1. more()
  2. gt()
  3. ge()
  4. None of the above

33 / 40

33. Python can be install on both  Linux and  Windows

34 / 40

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

35 / 40

35.

What will be the output of below Python code?

tupl=([2,3],"abc",0,9)tupl[0][1]=1print(tupl)A. ([2,3],"abc",0,9)B. ([1,3],"abc",0,9)C. ([2,1],"abc",0,9)D. Error

36 / 40

36.

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

a. [ ]

b. { }

c. ( )

d. None of the above

37 / 40

37. python has two primitive loop commands:

  • while loops
  • for loops

38 / 40

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

39 / 40

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

40 / 40

40.

In Python, a variable may be assigned a value of one type, and then later assigned a value of a different type:

  1. False
  2. True

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.