[miniorange_social_sharing]
[TheChamp-Login]

/40

Final Exam for Python for Everyone (A to Z)

BEST OF LUCK!!!

1 / 40

1.

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

2 / 40

2. The for loop in Python is an _____________

a) Entry Controlled Loop

b) Exit Controlled Loop

c) Both of the above

d) None of the above

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. Pascal Case
Each word starts with a capital letter:

5 / 40

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

6 / 40

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

7 / 40

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

8 / 40

8. Python  was created by Guido van Rossum, and released in 1999.

9 / 40

9.

Which is the correct operator for power(xy)?

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

10 / 40

10. All keywords in Python are in _________
a) Capitalized
b) lower case
c) UPPER CASE
d) None of the mentioned

11 / 40

11.

Following is an example of ___________________

sv = “csiplearninghub.com”

a. List

b. String

c. Dictionary

d. None of the above

12 / 40

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

13 / 40

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

14 / 40

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

15 / 40

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

16 / 40

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

17 / 40

17. What will be the output of the following Python code?

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

a) 1 2
b) 1 2 3
c) error
d) none of the mentioned

18 / 40

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

19 / 40

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

20 / 40

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

21 / 40

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

22 / 40

22. What is another word for ‘iteration’ ?

a) Selection

b) Assignment

c) Sequencing

d) Repetition

23 / 40

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

24 / 40

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

25 / 40

25.

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

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

26 / 40

26.

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

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

27 / 40

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

28 / 40

28. Extension of all Python  Programme are .py

29 / 40

29.

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

30 / 40

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

31 / 40

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

32 / 40

32.

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

33 / 40

33.

Which function overloads the >> operator?

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

34 / 40

34.

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

35 / 40

35. python has two primitive loop commands:

  • while loops
  • for loops

36 / 40

36. A variable name cannot start with a number

37 / 40

37. Python allows you to extract the values into variables.

38 / 40

38. What does the following code print?

x = -10if x < 0:    print("The negative number ",  x, " is not valid here.")print("This is always printed")
a.This is always printedb.The negative number -10 is not valid hereThis is always printedc.The negative number -10 is not valid here

39 / 40

39.

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

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

40 / 40

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

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.