[miniorange_social_sharing]
[TheChamp-Login]

/40

Final Exam for Python for Everyone (A to Z)

BEST OF LUCK!!!

1 / 40

1.

How to copy one list to another in python?

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

2 / 40

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

 

3 / 40

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

4 / 40

4. Python can connect to database systems.

5 / 40

5. Python can be used to handle big data and perform complex mathematics.

6 / 40

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

7 / 40

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

8 / 40

8.

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

9 / 40

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

10 / 40

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

11 / 40

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

12 / 40

12.

What will be the output of below Python code?

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

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

13 / 40

13. What is another word for ‘iteration’ ?

a) Selection

b) Assignment

c) Sequencing

d) Repetition

14 / 40

14. With the for loop we can execute a set of statements

15 / 40

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

16 / 40

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

17 / 40

17. Extension of all Python  Programme are .py

18 / 40

18. Comments can be used to explain Python code.

19 / 40

19.

Which of the following statement is a function call?

a. call sum( )

b. def sum( )

c. sum( )

d. function sum( )

20 / 40

20.

 What is output of: 35 == 35.0

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

21 / 40

21. The elif keyword is pythons way of saying “if the previous conditions were not true, then try this condition”.

22 / 40

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

23 / 40

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

24 / 40

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

25 / 40

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

26 / 40

26. Bitwise operators are used to compare (binary) numbers

27 / 40

27.

What is the value of the expression 100 / 25?

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

28 / 40

28. We can combine strings and numbers by using the format() method

29 / 40

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

30 / 40

30.

Which is the correct operator for power(xy)?

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

31 / 40

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

32 / 40

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

33 / 40

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

34 / 40

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

35 / 40

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

36 / 40

36.

Following is an example of ___________________

sv = “csiplearninghub.com”

a. List

b. String

c. Dictionary

d. None of the above

37 / 40

37.

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

a. 2

b. 3

c. 5

d. Multiple times

38 / 40

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

39 / 40

39. Most recent major version of Python is Python 3

40 / 40

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

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.