[miniorange_social_sharing]
[TheChamp-Login]

/40

Final Exam for Python for Everyone (A to Z)

BEST OF LUCK!!!

1 / 40

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

2 / 40

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

3 / 40

3. The format() method takes unlimited number of arguments

4 / 40

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

5 / 40

5. python has two primitive loop commands:

  • while loops
  • for loops

6 / 40

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

7 / 40

7.

What is the data type of print(type(0xFF))

8 / 40

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

9 / 40

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

10 / 40

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

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. Python can be used on a server to create web applications?

13 / 40

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

14 / 40

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

15 / 40

15. A variable name can only contain alpha-numeric characters and
underscores

16 / 40

16. An example of an illegal character is a double quote inside a string that is surrounded by double quotes

17 / 40

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

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. Python is a  high-level programming language.

20 / 40

20.

What is the value of the expression 100 / 25?

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

21 / 40

21. Python relies on indentation?

22 / 40

22. You can also have an else without the elif

23 / 40

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

24 / 40

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

25 / 40

25. + operator is used  to get output of multiple variables

26 / 40

26.

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

27 / 40

27. Which of the following is False regarding loops in Python?

a)Loops are used to perform certain tasks repeatedly.

b) while loop is used when multiple statements are to executed repeatedly until the given condition becomes true.

c) while loop is used when multiple statements are to executed repeatedly until the given condition becomes false.

d) for loop can be used to iterate through the elements of lists.

28 / 40

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

29 / 40

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

 

30 / 40

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

31 / 40

31. What is another word for ‘iteration’ ?

a) Selection

b) Assignment

c) Sequencing

d) Repetition

32 / 40

32.

Python considered the character enclosed in triple quotes as String.(T/F)

a. True

b. False

33 / 40

33. You can have if statements inside if statements, this is called nested if statements.

34 / 40

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

35 / 40

35. A variable name cannot start with a number

36 / 40

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

37 / 40

37.

Which of the following statement is a function call?

a. call sum( )

b. def sum( )

c. sum( )

d. function sum( )

38 / 40

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

39 / 40

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

40 / 40

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

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.