[miniorange_social_sharing]
[TheChamp-Login]

/40

Final Exam for Python for Everyone (A to Z)

BEST OF LUCK!!!

1 / 40

1.

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

2 / 40

2.

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.

3 / 40

3. The format() method takes the passed arguments

4 / 40

4. Which of the following is used to define a block of code in Python language?
a) Indentation
b) Key
c) Brackets
d) All of the mentioned

5 / 40

5.

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

6 / 40

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

7 / 40

7. Pip is  not a powerful package management system for Python software packages

8 / 40

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

9 / 40

9. You can use three double quotes only:

a = “””Lorem ipsum dolor sit amet,
consectetur adipiscing elit,
sed do eiusmod tempor incididunt
ut labore et dolore magna aliqua.”””
print(a)

10 / 40

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

11 / 40

11. What is another word for ‘iteration’ ?

a) Selection

b) Assignment

c) Sequencing

d) Repetition

12 / 40

12.

Which of the following precedence order is correct in Python?

  1. Parentheses, Exponential, Multiplication, Division, Addition, Subtraction
  2. Multiplication, Division, Addition, Subtraction, Parentheses, Exponential
  3. Division, Multiplication, Addition, Subtraction, Parentheses, Exponential
  4. Exponential, Parentheses, Multiplication, Division, Addition, Subtraction

13 / 40

13. With the break statement we can stop the loop even if the while condition is true

14 / 40

14.

 Select the correct example of complex datatype in Python

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

15 / 40

15. Find the output of the following program segments:

for i in range(20,30,2):

print(i)

a) 20 22 24 26 28

b) 20

22

24

26

28

c) 20 22 24 26 28 30

d) 20

22

24

26

28

30

16 / 40

16. Comments can be used to explain Python code.

17 / 40

17. An array is a special variable, which can hold more than one value at a time

18 / 40

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

19 / 40

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

20 / 40

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

21 / 40

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

22 / 40

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

23 / 40

23. A variable name can only contain alpha-numeric characters and
underscores

24 / 40

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

25 / 40

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

26 / 40

26. Suppose t = (1, 2, 4, 3), which of the following is incorrect?
a) print(t[3])
b) t[3] = 45
c) print(max(t))
d) print(len(t))

27 / 40

27. Python has various versions available

28 / 40

28. Comments starts with a #

29 / 40

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

30 / 40

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

31 / 40

31. 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”

32 / 40

32. The for loop does not require an indexing variable to set beforehand

33 / 40

33. Which of the following loop is not supported by the python programming language?

a) for loop

b) while loop

c) do…while loop

d) None of the above

34 / 40

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

35 / 40

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

36 / 40

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

37 / 40

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

38 / 40

38. You can use the pop() method to remove an element from the array

39 / 40

39.

What will be the output of above Python code?

str1="6/4"print("str1")

A. 1
B. 6/4
C. 1.5
D. str1

40 / 40

40.

Function defined to achieve some task as per the programmer’s requirement is called a ___________

a. user defined function

b. library function

c. built in functions

d. All 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.