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

3 / 40

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

4 / 40

4.

 Select the correct example of complex datatype in Python

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

5 / 40

5. Python has various versions available

6 / 40

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

7 / 40

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

8 / 40

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

9 / 40

9.

Write the output of the following code :

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

a. Weacome

b. Error

c. aWelcome

d. Welcomea

10 / 40

10.

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

11 / 40

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

12 / 40

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

13 / 40

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

14 / 40

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

15 / 40

15. A for loop is used for iterating over a sequence (that is either a list, a tuple, a dictionary, a set, or a string).

16 / 40

16. Variable names are case-sensitive

17 / 40

17. Find the output of the given Python program?

a, b, c = 1, 3, 5if a > 0:  if b < 2:    print("Hi")  elif c > 3:    print("Hello")else:  print("Know Program")

a) Hi
b) Hello
c) Know Program
d) Compiled Successfully, No Output.

18 / 40

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

19 / 40

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

20 / 40

20.

What will be the output of below Python code?

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

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

21 / 40

21. Most recent major version of Python is Python 3

22 / 40

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

23 / 40

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

24 / 40

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

25 / 40

25. You can use three double quotes only:

a = “””Lorem ipsum dolor sit amet,
consectetur adipiscing elit,
sed do eiusmod tempor incididunt
ut labore et dolore magna aliqua.”””
print(a)

26 / 40

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

27 / 40

27.

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.

28 / 40

28.

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

a. Define

b. DEF

c. def

d. Def

29 / 40

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

30 / 40

30.

Which function overloads the >> operator?

  1. more()
  2. gt()
  3. ge()
  4. None of the above

31 / 40

31. Python allows you to extract the values into variables.

32 / 40

32. Comparison operators are not  used to compare two values

33 / 40

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

34 / 40

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

35 / 40

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

36 / 40

36. You can also have an else without the elif

37 / 40

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

38 / 40

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

39 / 40

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

40 / 40

40. Python can connect to database systems.

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.