[miniorange_social_sharing]
[TheChamp-Login]

/40

Final Exam for Python for Everyone (A to Z)

BEST OF LUCK!!!

1 / 40

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

2 / 40

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

3 / 40

3. Official site of python is www.python.org

4 / 40

4.

In the Python statement x = a + 5 – b:

a and b are ________a + 5 - b is ________
  1. terms, a group
  2. operators, a statement
  3. operands, an expression
  4. operands, an equation

5 / 40

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

6 / 40

6.

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

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

7 / 40

7. Python relies on indentation?

8 / 40

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

 

9 / 40

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

10 / 40

10.

How to copy one list to another in python?

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

11 / 40

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

12 / 40

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

13 / 40

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

14 / 40

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

15 / 40

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

16 / 40

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

17 / 40

17. What is another word for ‘iteration’ ?

a) Selection

b) Assignment

c) Sequencing

d) Repetition

18 / 40

18.

Which is the correct operator for power(xy)?

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

19 / 40

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

20 / 40

20.

What will be the output of below Python code?

str1="Information"print(str1[2:8])

A. format
B. formatio
C. orma
D. ormat

21 / 40

21. Camel Case
Each word, except the first, starts with a capital letter:

22 / 40

22.

Which of the following statement is a function call?

a. call sum( )

b. def sum( )

c. sum( )

d. function sum( )

23 / 40

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

24 / 40

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

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

a) Hi
b) Know Program

c)
Hi
Hello

d)
Know Program
Hello

25 / 40

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

26 / 40

26. Python can be install on both  Linux and  Windows

27 / 40

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

28 / 40

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

29 / 40

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

30 / 40

30.

 What is output of: 35 == 35.0

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

31 / 40

31. Comparison operators are not  used to compare two values

32 / 40

32. Python has syntax that allows developers to write programs with fewer lines than some other programming languages.

33 / 40

33. You can also use the remove() method to remove an element from the array

34 / 40

34.

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

35 / 40

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

36 / 40

36. Extension of all Python  Programme are .py

37 / 40

37. Python will give you an error if you skip the indentation

38 / 40

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

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 keyword is used for function?
a) Fun
b) Define
c) Def
d) Function

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.