[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. With the for loop we can execute a set of statements

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

5 / 40

5.

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

6 / 40

6.

Which of the following statement is a function call?

a. call sum( )

b. def sum( )

c. sum( )

d. function sum( )

7 / 40

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

8 / 40

8.

Which function overloads the >> operator?

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

9 / 40

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

10 / 40

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

11 / 40

11. Who developed Python Programming Language?

12 / 40

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

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 unlimited number of arguments

15 / 40

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

16 / 40

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

17 / 40

17.

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

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

18 / 40

18. What is the output of the given below program?

if 1 + 3 == 7:    print("Hello")else:    print("Know Program")

a) Hello
b) Know Program
c) Compiled Successfully, No Output.
d) Error

19 / 40

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

20 / 40

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

21 / 40

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

22 / 40

22. A variable name cannot start with a number

23 / 40

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

24 / 40

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

25 / 40

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

26 / 40

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

27 / 40

27.

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

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

28 / 40

28.

 Select the correct example of complex datatype in Python

  1. 3 + 2j
  2. -100j
  3. 5j
  4. All of the above are correct

29 / 40

29.

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

30 / 40

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

31 / 40

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

32 / 40

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

33 / 40

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

34 / 40

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

35 / 40

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

36 / 40

36.

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

37 / 40

37. Arithmetic operators are used with numeric values to perform common mathematical operations

38 / 40

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

39 / 40

39. Python is a  high-level programming language.

40 / 40

40.

What is the value of the expression 100 / 25?

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

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.