[miniorange_social_sharing]
[TheChamp-Login]

/40

Final Exam for Python for Everyone (A to Z)

BEST OF LUCK!!!

1 / 40

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

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. A variable name can only contain alpha-numeric characters and
underscores

4 / 40

4. Who developed Python Programming Language?

5 / 40

5.

What is the value of the expression 100 / 25?

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

6 / 40

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

7 / 40

7. Most recent major version of Python is Python 3

8 / 40

8.

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.

9 / 40

9. With the break statement we can stop the loop before it has looped through all the items

10 / 40

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

11 / 40

11. A loop block in python starts with a –

a) ; (semicolon)

b) , (comma)

c) : (colon)

d) # (hash)

12 / 40

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

13 / 40

13.

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

14 / 40

14.

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

15 / 40

15.

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.

16 / 40

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

17 / 40

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

18 / 40

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

19 / 40

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

20 / 40

20. With the break statement we can stop the loop even if the while condition is true

21 / 40

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

22 / 40

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

23 / 40

23.

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

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

24 / 40

24. Python is an interpreted programming language

25 / 40

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

26 / 40

26. Python is a  high-level programming language.

27 / 40

27.

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

28 / 40

28. Comparison operators are not  used to compare two values

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

31 / 40

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

32 / 40

32. Pip is  not a powerful package management system for Python software packages

33 / 40

33.

 ____________________ can be defined as a named group of instructions that accomplish a specific task when it is invoked/called.

a. Function

b. Datatype

c. Token

d. Operator

34 / 40

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

35 / 40

35. Variables that are created outside of a function

36 / 40

36.

Which function overloads the >> operator?

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

37 / 40

37. Variable names are case-sensitive

38 / 40

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

39 / 40

39. The for loop in Python is an _____________

a) Entry Controlled Loop

b) Exit Controlled Loop

c) Both of the above

d) None of the above

40 / 40

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

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.