[miniorange_social_sharing]
[TheChamp-Login]

/40

Final Exam for Python for Everyone (A to Z)

BEST OF LUCK!!!

1 / 40

1.

What will be the output of below Python code?

str1="Information"print(str1[2:8])

A. format
B. formatio
C. orma
D. ormat

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

 

4 / 40

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

5 / 40

5. 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))

6 / 40

6. The else keyword catches anything which isn’t caught by the preceding conditions.

7 / 40

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

8 / 40

8.

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

9 / 40

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

10 / 40

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

11 / 40

11.

How to copy one list to another in python?

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

12 / 40

12. Python relies on indentation?

13 / 40

13.

Write the output of the following code :

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

a. Weacome

b. Error

c. aWelcome

d. Welcomea

14 / 40

14. The format() method takes the passed arguments

15 / 40

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

16 / 40

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

17 / 40

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

18 / 40

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

19 / 40

19.

What is the value of the expression 100 / 25?

  1. 4
  2. 4.0
  3. 0
  4. 25

20 / 40

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

21 / 40

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

22 / 40

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

23 / 40

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

24 / 40

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

25 / 40

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

26 / 40

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

27 / 40

27.

What will be the output of above Python code?

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

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

28 / 40

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

29 / 40

29.

Python considered the character enclosed in triple quotes as String.(T/F)

a. True

b. False

30 / 40

30. A loop block in python starts with a –

a) ; (semicolon)

b) , (comma)

c) : (colon)

d) # (hash)

31 / 40

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

32 / 40

32.

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.

33 / 40

33. Which of the following character is used to give single-line comments in Python?
a) //
b) #
c) !
d) /*

34 / 40

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

35 / 40

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

36 / 40

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

37 / 40

37. You can also have an else without the elif

38 / 40

38. Comparison operators are not  used to compare two values

39 / 40

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

40 / 40

40.

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

a. 2

b. 3

c. 5

d. Multiple times

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.