[miniorange_social_sharing]
[TheChamp-Login]

/40

Final Exam for Python for Everyone (A to Z)

BEST OF LUCK!!!

1 / 40

1. Python can connect to database systems.

2 / 40

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

3 / 40

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

4 / 40

4.

Function defined to achieve some task as per the programmer’s requirement is called a ___________

a. user defined function

b. library function

c. built in functions

d. All of the above.

5 / 40

5. Python can be install on both  Linux and  Windows

6 / 40

6.

 Select the correct example of complex datatype in Python

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

7 / 40

7.

Following is an example of ___________________

sv = “csiplearninghub.com”

a. List

b. String

c. Dictionary

d. None of the above

8 / 40

8.

How to copy one list to another in python?

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

9 / 40

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

10 / 40

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

11 / 40

11. + operator is used  to get output of multiple variables

12 / 40

12. python file can also run on command line

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

15 / 40

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

16 / 40

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

17 / 40

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

18 / 40

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

19 / 40

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

20 / 40

20. Variables that are created outside of a function

21 / 40

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

22 / 40

22. With the for loop we can execute a set of statements

23 / 40

23.

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.

24 / 40

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

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.

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

27 / 40

27.

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

28 / 40

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

29 / 40

29. Which keyword is used for function?
a) Fun
b) Define
c) Def
d) Function

30 / 40

30. An array can hold many values under a single name

31 / 40

31. python has two primitive loop commands:

  • while loops
  • for loops

32 / 40

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

33 / 40

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

34 / 40

34. To insert characters that are illegal in a string, use an escape character

35 / 40

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

36 / 40

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

37 / 40

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

38 / 40

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

39 / 40

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

40 / 40

40. Find the output of the given Python program?

a = 25if a < 15:    print("Hi")if a <= 30:    print("Hello")else:    print("Know Program")

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

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.