[miniorange_social_sharing]
[TheChamp-Login]

/40

Final Exam for Python for Everyone (A to Z)

BEST OF LUCK!!!

1 / 40

1. Python has various versions available

2 / 40

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

3 / 40

3. Can we write if/else into one line in python?

a) Yes
b) No
c) if/else not used in python
d) None of the above

4 / 40

4.

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

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

5 / 40

5. A loop block in python starts with a –

a) ; (semicolon)

b) , (comma)

c) : (colon)

d) # (hash)

6 / 40

6. To write and execute code in python, we first need to install Python on our system

7 / 40

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

8 / 40

8. Pascal Case
Each word starts with a capital letter:

9 / 40

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

10 / 40

10. Arithmetic operators are used with numeric values to perform common mathematical operations

11 / 40

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

  1. d = {"john":40, "peter":45}
  2. d["john"]

a) 40
b) 45
c) “john”
d) “peter”

12 / 40

12. A variable name cannot start with a number

13 / 40

13. python has two primitive loop commands:

  • while loops
  • for loops

14 / 40

14. Python will give you an error if you skip the indentation

15 / 40

15.

What will the below Python code will return?

If str1="save paper,save plants"str1.find("save")

A. It returns the first index position of the first occurance of “save” in the given string str1.
B. It returns the last index position of the last occurance of “save” in the given string str1.
C. It returns the last index position of the first occurance of “save” in the given string str1.
D. It returns the first index position of the first occurance of “save” in the given string str1.

16 / 40

16. Python relies on indentation?

17 / 40

17. Who developed Python Programming Language?

18 / 40

18.

Write the output of the following code :

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

a. Weacome

b. Error

c. aWelcome

d. Welcomea

19 / 40

19. Python can be treated in a procedural way, an object-oriented way or a functional way.

20 / 40

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

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.

What is the data type of print(type(10))

23 / 40

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

24 / 40

24. Python is a  high-level programming language.

25 / 40

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

26 / 40

26. Indentation refers to the spaces at the beginning of a code line.

27 / 40

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

28 / 40

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

x = ['ab', 'cd']for i in x:    i.upper()print(x)

a) [‘ab’, ‘cd’]
b) [‘AB’, ‘CD’]
c) [None, None]
d) none of the mentioned

29 / 40

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

30 / 40

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

31 / 40

31.

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

32 / 40

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

33 / 40

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

34 / 40

34. Arrays are used to store multiple values in one single variable.

35 / 40

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

36 / 40

36. You can also have an else without the elif

37 / 40

37. You can also use the remove() method to remove an element from the array

38 / 40

38.

What will be the output of below Python code?

str1="poWer"str1.upper()print(str1)

A. POWER
B. Power
C. power
D. poWer

39 / 40

39.

Which of the following statement is a function call?

a. call sum( )

b. def sum( )

c. sum( )

d. function sum( )

40 / 40

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

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.