[miniorange_social_sharing]
[TheChamp-Login]

/40

Final Exam for Python for Everyone (A to Z)

BEST OF LUCK!!!

1 / 40

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

2 / 40

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

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. You can use the append() method to add an element to an array

5 / 40

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

6 / 40

6.

In a program, a function can be called ____________ times.

a. 2

b. 3

c. 5

d. Multiple times

7 / 40

7. Is there any comments in  following codes

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

 

8 / 40

8.

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

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

9 / 40

9.

What is the value of the expression 100 / 25?

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

10 / 40

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

11 / 40

11.

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

12 / 40

12. You can return a range of characters by using the slice syntax

13 / 40

13. Python can be treated in a procedural way, an object-oriented way or a functional way.

14 / 40

14.

Write the output of the following code :

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

a. Weacome

b. Error

c. aWelcome

d. Welcomea

15 / 40

15. print() function is often used to output variables.

16 / 40

16.

 Select the correct example of complex datatype in Python

  1. 3 + 2j
  2. -100j
  3. 5j
  4. All of the above are correct

17 / 40

17. A variable name must start with a letter or the underscore character

18 / 40

18. Variables that are created outside of a function

19 / 40

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

20 / 40

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

 

21 / 40

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

22 / 40

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

23 / 40

23. Strings in python are surrounded by either single quotation marks, or double quotation marks

24 / 40

24.

Which of the following precedence order is correct in Python?

  1. Parentheses, Exponential, Multiplication, Division, Addition, Subtraction
  2. Multiplication, Division, Addition, Subtraction, Parentheses, Exponential
  3. Division, Multiplication, Addition, Subtraction, Parentheses, Exponential
  4. Exponential, Parentheses, Multiplication, Division, Addition, Subtraction

25 / 40

25. Python  was created by Guido van Rossum, and released in 1999.

26 / 40

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

27 / 40

27. Who developed Python Programming Language?

28 / 40

28. Python is an interpreted programming language

29 / 40

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

30 / 40

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

31 / 40

31.

What will be the output of below Python code?

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

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

32 / 40

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

33 / 40

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

34 / 40

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

35 / 40

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

36 / 40

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

37 / 40

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

38 / 40

38.

What will be the output of below Python code?

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

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

39 / 40

39.

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

40 / 40

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

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.