[miniorange_social_sharing]
[TheChamp-Login]

/40

Final Exam for Python for Everyone (A to Z)

BEST OF LUCK!!!

1 / 40

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

2 / 40

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

3 / 40

3. Comments can be used to explain Python code.

4 / 40

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

5 / 40

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

6 / 40

6. Python has various versions available

7 / 40

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

8 / 40

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

9 / 40

9. All keywords in Python are in _________
a) Capitalized
b) lower case
c) UPPER CASE
d) None of the mentioned

10 / 40

10.

Which keyword is used to begin the definition of a function?

a. Define

b. DEF

c. def

d. Def

11 / 40

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

12 / 40

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

13 / 40

13.  ________ in Python is a counter-controlled loop.

a) for

b) while

c) Both (a) and (b)

d) None of the above

14 / 40

14.

What will be the output of below Python code?

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

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

15 / 40

15. Python is an interpreted programming language

16 / 40

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

17 / 40

17. The format() method takes the passed arguments

18 / 40

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

19 / 40

19.

How to copy one list to another in python?

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

20 / 40

20.

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

21 / 40

21.

def cal(n1) : What is n1?

a. Parameter

b. Argument

c. Keyword

d. None of the above

22 / 40

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

23 / 40

23.

Which of the following creates a tuple?

A. tuple1=(“a”,”b”)
B. tuple1[2]=(“a”,”b”)
C. tuple1=(5)*2
D. None of the above

24 / 40

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

25 / 40

25.

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

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

26 / 40

26.

What is the data type of print(type(10))

27 / 40

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

28 / 40

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

29 / 40

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

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. Python relies on indentation?

32 / 40

32.

 ____________________ can be defined as a named group of instructions that accomplish a specific task when it is invoked/called.

a. Function

b. Datatype

c. Token

d. Operator

33 / 40

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

34 / 40

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

35 / 40

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

36 / 40

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

37 / 40

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

38 / 40

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

39 / 40

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

40 / 40

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

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.