[miniorange_social_sharing]
[TheChamp-Login]

/40

Final Exam for Python for Everyone (A to Z)

BEST OF LUCK!!!

1 / 40

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

2 / 40

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

3 / 40

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

4 / 40

4.

Which of the following is False?

A. String is immutable.
B. capitalize() function in string is used to return a string by converting the whole given string into uppercase.
C. lower() function in string is used to return a string by converting the whole given string into lowercase.
D. None of these.

5 / 40

5. Variables that are created outside of a function

6 / 40

6. python has two primitive loop commands:

  • while loops
  • for loops

7 / 40

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

8 / 40

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

9 / 40

9.

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

a. True

b. False

10 / 40

10. Python has various versions available

11 / 40

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

12 / 40

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

13 / 40

13. Variable names are case-sensitive

14 / 40

14. A loop block in python starts with a –

a) ; (semicolon)

b) , (comma)

c) : (colon)

d) # (hash)

15 / 40

15. The for loop does not require an indexing variable to set beforehand

16 / 40

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

17 / 40

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

18 / 40

18. Comparison operators are not  used to compare two values

19 / 40

19.

What will be the output of below Python code?

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

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

20 / 40

20. During Installation Make sure to select both the checkboxes at the bottom .

21 / 40

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

22 / 40

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

23 / 40

23. python file can also run on command line

24 / 40

24. Who developed Python Programming Language?

25 / 40

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

26 / 40

26.

In a program, a function can be called ____________ times.

a. 2

b. 3

c. 5

d. Multiple times

27 / 40

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

28 / 40

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

29 / 40

29.

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

30 / 40

30.

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.

31 / 40

31.

 ____________________ 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

32 / 40

32. Official site of python is www.python.org

33 / 40

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

34 / 40

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

35 / 40

35.

def cal(n1) : What is n1?

a. Parameter

b. Argument

c. Keyword

d. None of the above

36 / 40

36.

Which function overloads the >> operator?

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

37 / 40

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

38 / 40

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

39 / 40

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

40 / 40

40.  ________ in Python is a counter-controlled loop.

a) for

b) while

c) Both (a) and (b)

d) None of the above

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.