[miniorange_social_sharing]
[TheChamp-Login]

/40

Final Exam for Python for Everyone (A to Z)

BEST OF LUCK!!!

1 / 40

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

2 / 40

2.

What do we use to define a block of code in Python language?

  1. Key
  2. Brackets
  3. Indentation
  4. None of these

3 / 40

3.

Which of the following statement is a function call?

a. call sum( )

b. def sum( )

c. sum( )

d. function sum( )

4 / 40

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

5 / 40

5.

How to copy one list to another in python?

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

6 / 40

6. Comparison operators are not  used to compare two values

7 / 40

7. Is Python code compiled or interpreted?
a) Python code is both compiled and interpreted
b) Python code is neither compiled nor interpreted
c) Python code is only compiled
d) Python code is only interpreted

8 / 40

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

9 / 40

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

10 / 40

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

11 / 40

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

12 / 40

12. Find and write the output of the following python code:

x = “abcdef”

i = “a”

while i in x:

print(i, end = ” “)

a) a

b) a a a a a a

c) a a a a a a … infinite times

d) Code will generate error

13 / 40

13. What is the index value of ‘i’ in string “Learning”

a. 5

b. 3

c. 6

d. 7

14 / 40

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

15 / 40

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

16 / 40

16.

Which of the following statement will execute in last?

def s(n1): #Statement 1      print(n1) #Statement 2n2=4 #Statement 3s(n2) #Statement 4

a. Statement 1

b. Statement 2

c. Statement 3

d. Statement 4

17 / 40

17. Is there any comments in  following codes

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

 

18 / 40

18.

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

19 / 40

19. Python is a  high-level programming language.

20 / 40

20.

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

21 / 40

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

22 / 40

22.

Which function overloads the >> operator?

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

23 / 40

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

24 / 40

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

25 / 40

25. Most recent major version of Python is Python 3

26 / 40

26. Comments can be used to explain Python code.

27 / 40

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

28 / 40

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

29 / 40

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

30 / 40

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

31 / 40

31. Variables that are created outside of a function

32 / 40

32.

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

33 / 40

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

34 / 40

34. python has two primitive loop commands:

  • while loops
  • for loops

35 / 40

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

36 / 40

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

37 / 40

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

38 / 40

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

39 / 40

39. Comments can be used to make the code more readable.

40 / 40

40.

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

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.