[miniorange_social_sharing]
[TheChamp-Login]

/40

Final Exam for Python for Everyone (A to Z)

BEST OF LUCK!!!

1 / 40

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

2 / 40

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

3 / 40

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

4 / 40

4. What is another word for ‘iteration’ ?

a) Selection

b) Assignment

c) Sequencing

d) Repetition

5 / 40

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

a. 5

b. 3

c. 6

d. 7

6 / 40

6. Which of the following is the correct extension of the Python file?

7 / 40

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

8 / 40

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

9 / 40

9.

Which function overloads the >> operator?

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

10 / 40

10.

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.

11 / 40

11.

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

a. 2

b. 3

c. 5

d. Multiple times

12 / 40

12.

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

13 / 40

13.

def cal(n1) : What is n1?

a. Parameter

b. Argument

c. Keyword

d. None of the above

14 / 40

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

15 / 40

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

16 / 40

16. python file can also run on command line

17 / 40

17. Most recent major version of Python is Python 3

18 / 40

18.

What is the value of the expression 100 / 25?

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

19 / 40

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

20 / 40

20. Python has various versions available

21 / 40

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

22 / 40

22.

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

a. [ ]

b. { }

c. ( )

d. None of the above

23 / 40

23.

Following is an example of ___________________

sv = “csiplearninghub.com”

a. List

b. String

c. Dictionary

d. None of the above

24 / 40

24. if statements cannot be empty, but if you for some reason have an if statement with no content, put in the pass statement to avoid getting an error

25 / 40

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

26 / 40

26. Comparison operators are not  used to compare two values

27 / 40

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

28 / 40

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

29 / 40

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

30 / 40

30. Variable names are case-sensitive

31 / 40

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

32 / 40

32. Python relies on indentation?

33 / 40

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

34 / 40

34.

 What is output of: 35 == 35.0

  1. False
  2. True
  3. 33
  4. None of the above

35 / 40

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

36 / 40

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

37 / 40

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

38 / 40

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

39 / 40

39.

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

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

40 / 40

40.

Which one of the following is the correct extension of the Python file?

  1. .py
  2. .python
  3. .p
  4. None of these

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.