[miniorange_social_sharing]
[TheChamp-Login]

/40

Final Exam for Python for Everyone (A to Z)

BEST OF LUCK!!!

1 / 40

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

2 / 40

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

3 / 40

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

4 / 40

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

5 / 40

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

6 / 40

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

7 / 40

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

8 / 40

8.

What will be the output of below Python code?

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

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

9 / 40

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

10 / 40

10.

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

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

11 / 40

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

12 / 40

12.

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

13 / 40

13. python has two primitive loop commands:

  • while loops
  • for loops

14 / 40

14.

Python considered the character enclosed in triple quotes as String.(T/F)

a. True

b. False

15 / 40

15. Extension of all Python  Programme are .py

16 / 40

16. A variable name cannot start with a number

17 / 40

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

18 / 40

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

19 / 40

19.

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.

20 / 40

20.

 What is output of: 35 == 35.0

  1. False
  2. True
  3. 33
  4. None of the above

21 / 40

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

22 / 40

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

23 / 40

23.

What will be the output of below Python code?

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

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

24 / 40

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

25 / 40

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

26 / 40

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

27 / 40

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

28 / 40

28.

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

29 / 40

29. Operators are used to perform operations on variables and values

30 / 40

30. Comments starts with a #

31 / 40

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

 

32 / 40

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

33 / 40

33.

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

34 / 40

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

35 / 40

35.

What is the value of the expression 100 / 25?

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

36 / 40

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

37 / 40

37. Python can be install on both  Linux and  Windows

38 / 40

38.

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

39 / 40

39. The elif keyword is pythons way of saying “if the previous conditions were not true, then try this condition”.

40 / 40

40. Variables that are created outside of a function

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.