[miniorange_social_sharing]
[TheChamp-Login]

/40

Final Exam for Python for Everyone (A to Z)

BEST OF LUCK!!!

1 / 40

1. Variables that are created outside of a function

2 / 40

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

3 / 40

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

4 / 40

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

5 / 40

5.

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

6 / 40

6.

Following is an example of ___________________

sv = “csiplearninghub.com”

a. List

b. String

c. Dictionary

d. None of the above

7 / 40

7.

Write the output of the following code :

str = "Welcome"str[2] = 'a'print(str)

a. Weacome

b. Error

c. aWelcome

d. Welcomea

8 / 40

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

9 / 40

9. Python has various versions available

10 / 40

10.

What will be the output of below Python code?

tupl=([2,3],"abc",0,9)tupl[0][1]=1print(tupl)A. ([2,3],"abc",0,9)B. ([1,3],"abc",0,9)C. ([2,1],"abc",0,9)D. Error

11 / 40

11. The else keyword catches anything which isn’t caught by the preceding conditions.

12 / 40

12. Comments can be used to explain Python code.

13 / 40

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

14 / 40

14. You can also have an else without the elif

15 / 40

15. Variable names are case-sensitive

16 / 40

16. The length of an array is always one more than the highest array index.

17 / 40

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

18 / 40

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

19 / 40

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

20 / 40

20. Find the output of the given Python program?

a = 25if a < 15:    print("Hi")if a <= 30:    print("Hello")else:    print("Know Program")

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

21 / 40

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

22 / 40

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

23 / 40

23. The len() method to return the length of an array

24 / 40

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

 

25 / 40

25.

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

26 / 40

26.

How to copy one list to another in python?

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

27 / 40

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

28 / 40

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

29 / 40

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

30 / 40

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

31 / 40

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

32 / 40

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

33 / 40

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

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. Is there any comments in  following codes

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

 

36 / 40

36. Comparison operators are not  used to compare two values

37 / 40

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

38 / 40

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

39 / 40

39. Snake Case
Each word is separated by an underscore character:

40 / 40

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

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.