[miniorange_social_sharing]
[TheChamp-Login]

/40

Final Exam for Python for Everyone (A to Z)

BEST OF LUCK!!!

1 / 40

1. Is there any comments in  following codes

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

 

2 / 40

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

3 / 40

3.

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

4 / 40

4.

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

5 / 40

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

6 / 40

6. Python is a  high-level programming language.

7 / 40

7.

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.

8 / 40

8. Comments can be used to make the code more readable.

9 / 40

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

10 / 40

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

11 / 40

11.

Which of the following is not a keyword in Python language?

  1. val
  2. raise
  3. try
  4. with

12 / 40

12.

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

13 / 40

13. What will be the output of the following Python code?

x = ['ab', 'cd']for i in x:    i.upper()print(x)

a) [‘ab’, ‘cd’]
b) [‘AB’, ‘CD’]
c) [None, None]
d) none of the mentioned

14 / 40

14.

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

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

15 / 40

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

16 / 40

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

17 / 40

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

18 / 40

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

19 / 40

19.

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

20 / 40

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

21 / 40

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

22 / 40

22.

What will be the output of below Python code?

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

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

23 / 40

23. Which of the following is a Python tuple?
a) [1, 2, 3]
b) (1, 2, 3)
c) {1, 2, 3}
d) {}

24 / 40

24.

Write the output of the following code :

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

a. Weacome

b. Error

c. aWelcome

d. Welcomea

25 / 40

25.

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

a. Define

b. DEF

c. def

d. Def

26 / 40

26.

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

27 / 40

27.

Which of the following statement is a function call?

a. call sum( )

b. def sum( )

c. sum( )

d. function sum( )

28 / 40

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

29 / 40

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

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

32 / 40

32. Comments starts with a #

33 / 40

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

34 / 40

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

35 / 40

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

36 / 40

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

37 / 40

37.

 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.

38 / 40

38. Pascal Case
Each word starts with a capital letter:

39 / 40

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

40 / 40

40. Python has various versions available

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.