[miniorange_social_sharing]
[TheChamp-Login]

/40

Final Exam for Python for Everyone (A to Z)

BEST OF LUCK!!!

1 / 40

1.

What do we use to define a block of code in Python language?

  1. Key
  2. Brackets
  3. Indentation
  4. None of these

2 / 40

2.

Choose the correct option with respect to Python.

A. Both tuples and lists are immutable.
B. Tuples are immutable while lists are mutable.
C. Both tuples and lists are mutable.
D. Tuples are mutable while lists are immutable.

3 / 40

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

a) for

b) while

c) Both (a) and (b)

d) None of the above

4 / 40

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

5 / 40

5. The for loop in Python is an _____________

a) Entry Controlled Loop

b) Exit Controlled Loop

c) Both of the above

d) None of the above

6 / 40

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

7 / 40

7.

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

a. Define

b. DEF

c. def

d. Def

8 / 40

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

9 / 40

9.

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

10 / 40

10. Python can connect to database systems.

11 / 40

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

12 / 40

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

13 / 40

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

14 / 40

14. python file can also run on command line

15 / 40

15.

 Which of the following statement is False?

  1. Variable names can be arbitrarily long.
  2. They can contain both letters and numbers.
  3. Variable name can begin with underscore.
  4. Variable name can begin with number.

16 / 40

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

17 / 40

17.

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

18 / 40

18.

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

19 / 40

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

20 / 40

20.

 ____________________ 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

21 / 40

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

22 / 40

22.

What will be the output of below Python code?

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

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

23 / 40

23. Python is an interpreted programming language

24 / 40

24. You can also have multiple else statements on the same line:

25 / 40

25.

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

26 / 40

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

27 / 40

27.

What will be the output of below Python code?

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

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

28 / 40

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

29 / 40

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

30 / 40

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

31 / 40

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

32 / 40

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

33 / 40

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

34 / 40

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

35 / 40

35. The for loop does not require an indexing variable to set beforehand

36 / 40

36. Comparison operators are not  used to compare two values

37 / 40

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

38 / 40

38. A variable name cannot start with a number

39 / 40

39. Most recent major version of Python is Python 3

40 / 40

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

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.