[miniorange_social_sharing]
[TheChamp-Login]

/40

Final Exam for Python for Everyone (A to Z)

BEST OF LUCK!!!

1 / 40

1.

 Which of the following statement is False?

  1. Variable names can be arbitrarily long.
  2. They can contain both letters and numbers.
  3. Variable name can begin with underscore.
  4. Variable name can begin with number.

2 / 40

2. Identity operators are used to compare the objects, not if they are equal, but if they are actually the same object, with the same memory location

3 / 40

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

4 / 40

4. With the break statement we can stop the loop before it has looped through all the items

5 / 40

5.

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.

6 / 40

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

7 / 40

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

8 / 40

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

9 / 40

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

10 / 40

10. Python can connect to database systems.

11 / 40

11. Variables that are created outside of a function

12 / 40

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

13 / 40

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

14 / 40

14. Variable names are case-sensitive

15 / 40

15.

The most important object defined in NumPy is an N-dimensional array type called?

A. ndarray
B. narray
C. nd_array
D. darray

16 / 40

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

17 / 40

17.

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.

18 / 40

18. Python relies on indentation?

19 / 40

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

20 / 40

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

21 / 40

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

22 / 40

22.

l = [ 4, 8, 9, 2.6, 5 ] is a type of which data type in python?

  1. List
  2. Tuple
  3. Set
  4. None of these

23 / 40

23.

Which is the correct operator for power(xy)?

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

24 / 40

24. Comments starts with a #

25 / 40

25.

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

26 / 40

26.  ________ in Python is a counter-controlled loop.

a) for

b) while

c) Both (a) and (b)

d) None of the above

27 / 40

27.

Write the output of the following code :

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

a. Weacome

b. Error

c. aWelcome

d. Welcomea

28 / 40

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

29 / 40

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

30 / 40

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

31 / 40

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

 

32 / 40

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

33 / 40

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

34 / 40

34. Python can be used on a server to create web applications?

35 / 40

35. When does the else statement written after loop executes?

a) When loop condition becomes false

b) When break statement is executed in the loop

c) else statement is always executed

d) None of the above

36 / 40

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

37 / 40

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

38 / 40

38.

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

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

39 / 40

39.

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

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

40 / 40

40. python file can also run on command line

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.