[miniorange_social_sharing]
[TheChamp-Login]

/40

Final Exam for Python for Everyone (A to Z)

BEST OF LUCK!!!

1 / 40

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

2 / 40

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

3 / 40

3. The format() method takes the passed arguments

4 / 40

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

5 / 40

5. Python can connect to database systems.

6 / 40

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

7 / 40

7.

The most important object defined in NumPy is an N-dimensional array type called?

A. ndarray
B. narray
C. nd_array
D. darray

8 / 40

8.

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

9 / 40

9. Comparison operators are not  used to compare two values

10 / 40

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

11 / 40

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

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. To insert characters that are illegal in a string, use an escape character

14 / 40

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

15 / 40

15. Which of the following is used to define a block of code in Python language?
a) Indentation
b) Key
c) Brackets
d) All of the mentioned

16 / 40

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

17 / 40

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

18 / 40

18. Extension of all Python  Programme are .py

19 / 40

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

20 / 40

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

21 / 40

21. Comments can be used to explain Python code.

22 / 40

22.

Which function overloads the >> operator?

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

23 / 40

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

24 / 40

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

25 / 40

25. Which of the following loop is not supported by the python programming language?

a) for loop

b) while loop

c) do…while loop

d) None of the above

26 / 40

26.

Which of the following statement will execute in last?

def s(n1): #Statement 1      print(n1) #Statement 2n2=4 #Statement 3s(n2) #Statement 4

a. Statement 1

b. Statement 2

c. Statement 3

d. Statement 4

27 / 40

27. Which of the following is the use of function in python?
a) Functions are reusable pieces of programs
b) Functions don’t provide better modularity for your application
c) you can’t also create your own functions
d) All of the mentioned

28 / 40

28.

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

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

29 / 40

29. What is the output of the given below program?

if 1 + 3 == 7:    print("Hello")else:    print("Know Program")

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

30 / 40

30. You can use the pop() method to remove an element from the array

31 / 40

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

32 / 40

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

33 / 40

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

34 / 40

34. What is another word for ‘iteration’ ?

a) Selection

b) Assignment

c) Sequencing

d) Repetition

35 / 40

35.

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

36 / 40

36. Python is an interpreted programming language

37 / 40

37. Variable names are case-sensitive

38 / 40

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

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 be treated in a procedural way, an object-oriented way or a functional way.

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.