[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 is a Python tuple?
a) [1, 2, 3]
b) (1, 2, 3)
c) {1, 2, 3}
d) {}

2 / 40

2.

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

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

3 / 40

3.

How to copy one list to another in python?

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

4 / 40

4.

Which statement is correct?

A. List is immutable && Tuple is mutable
B. List is mutable && Tuple is immutable
C. Both are Mutable.
D. Both are Immutable

5 / 40

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

6 / 40

6. An array can hold many values under a single name

7 / 40

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

8 / 40

8. To insert characters that are illegal in a string, use an escape character

9 / 40

9. The list’s remove() method only removes the first occurrence of the specified value.

10 / 40

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

11 / 40

11.

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

a. [ ]

b. { }

c. ( )

d. None of the above

12 / 40

12. Which keyword is used for function?
a) Fun
b) Define
c) Def
d) Function

13 / 40

13. Which term describes a loop that continues repeating without a terminating (ending) condition?

a) Infinite Loop

b) Conditional Loop

c) Unlimited Loop

d) Sequence Loop

14 / 40

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

15 / 40

15. A variable name cannot start with a number

16 / 40

16.

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

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

17 / 40

17.

Following is an example of ___________________

sv = “csiplearninghub.com”

a. List

b. String

c. Dictionary

d. None of the above

18 / 40

18.

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.

19 / 40

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

20 / 40

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

21 / 40

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

22 / 40

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

23 / 40

23. During Installation Make sure to select both the checkboxes at the bottom .

24 / 40

24.

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.

25 / 40

25.

What will be the output of above Python code?

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

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

26 / 40

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

27 / 40

27. python has two primitive loop commands:

  • while loops
  • for loops

28 / 40

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

29 / 40

29.

Which function overloads the >> operator?

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

30 / 40

30.

Which of the following statements assigns the value 25 to the variable x in Python:

  1. x ← 25
  2. x = 25
  3. x := 25
  4. int x = 25
  5. x << 25

31 / 40

31. Is there any comments in  following codes

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

 

32 / 40

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

33 / 40

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

34 / 40

34.

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

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

35 / 40

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

36 / 40

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

37 / 40

37.

What will be the output of below Python code?

str1="poWer"str1.upper()print(str1)

A. POWER
B. Power
C. power
D. poWer

38 / 40

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

39 / 40

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

a) for

b) while

c) Both (a) and (b)

d) None of the above

40 / 40

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

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.