[miniorange_social_sharing]
[TheChamp-Login]

/40

Final Exam for Python for Everyone (A to Z)

BEST OF LUCK!!!

1 / 40

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

2 / 40

2. Who developed Python Programming Language?

3 / 40

3.

Write the output of the following code :

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

a. Weacome

b. Error

c. aWelcome

d. Welcomea

4 / 40

4.

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

5 / 40

5. Which of the following is the use of function in python?
a) Functions are reusable pieces of programs
b) Functions don’t provide better modularity for your application
c) you can’t also create your own functions
d) All of the mentioned

6 / 40

6. Is there any comments in  following codes

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

 

7 / 40

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

8 / 40

8.

Which of the following statement is a function call?

a. call sum( )

b. def sum( )

c. sum( )

d. function sum( )

9 / 40

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

10 / 40

10. python has two primitive loop commands:

  • while loops
  • for loops

11 / 40

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

12 / 40

12.

Which is the correct operator for power(xy)?

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

13 / 40

13.

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

a. 2

b. 3

c. 5

d. Multiple times

14 / 40

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

15 / 40

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

16 / 40

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

17 / 40

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

18 / 40

18.

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

a. [ ]

b. { }

c. ( )

d. None of the above

19 / 40

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

20 / 40

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

21 / 40

21. Comments can be used to explain Python code.

22 / 40

22. Most recent major version of Python is Python 3

23 / 40

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

24 / 40

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

25 / 40

25. Strings in python are surrounded by either single quotation marks, or double quotation marks

26 / 40

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

27 / 40

27. + operator is used  to get output of multiple variables

28 / 40

28. python file can also run on command line

29 / 40

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

30 / 40

30. Variables that are created outside of a function

31 / 40

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

32 / 40

32.

What is the data type of print(type(0xFF))

33 / 40

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

 

34 / 40

34.

How to copy one list to another in python?

A. l1[] = l2[]
B. l1[] = l2
C. l1[] = l2[:]
D. l1 = l2

35 / 40

35. A loop block in python starts with a –

a) ; (semicolon)

b) , (comma)

c) : (colon)

d) # (hash)

36 / 40

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

37 / 40

37.

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

38 / 40

38.

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.

39 / 40

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

40 / 40

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

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.