[miniorange_social_sharing]
[TheChamp-Login]

/40

Final Exam for Python for Everyone (A to Z)

BEST OF LUCK!!!

1 / 40

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

2 / 40

2. A loop block in python starts with a –

a) ; (semicolon)

b) , (comma)

c) : (colon)

d) # (hash)

3 / 40

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

4 / 40

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

5 / 40

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

6 / 40

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

7 / 40

7.

Which one of the following is the correct extension of the Python file?

  1. .py
  2. .python
  3. .p
  4. None of these

8 / 40

8. Python can be install on both  Linux and  Windows

9 / 40

9.

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.

10 / 40

10.

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

11 / 40

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

12 / 40

12. Variables that are created outside of a function

13 / 40

13. What is the index value of ‘i’ in string “Learning”

a. 5

b. 3

c. 6

d. 7

14 / 40

14. python file can also run on command line

15 / 40

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

16 / 40

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

17 / 40

17.

What will be the output of below Python code?

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

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

18 / 40

18.

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

19 / 40

19.

def cal(n1) : What is n1?

a. Parameter

b. Argument

c. Keyword

d. None of the above

20 / 40

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

21 / 40

21.

Which of the following is not a keyword in Python language?

  1. val
  2. raise
  3. try
  4. with

22 / 40

22.

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

23 / 40

23. python has two primitive loop commands:

  • while loops
  • for loops

24 / 40

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

25 / 40

25. You can also use the remove() method to remove an element from the array

26 / 40

26. The format() method takes the passed arguments

27 / 40

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

28 / 40

28. Comments can be used to explain Python code.

29 / 40

29.

Which is the correct operator for power(xy)?

  1. X^y
  2. X**y
  3. X^^y
  4. None of the mentioned

30 / 40

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

31 / 40

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

32 / 40

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

 

33 / 40

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

34 / 40

34. Indentation refers to the spaces at the beginning of a code line.

35 / 40

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

36 / 40

36.

What will be the output of below Python code?

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

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

37 / 40

37. You can have if statements inside if statements, this is called nested if statements.

38 / 40

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

39 / 40

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

40 / 40

40.

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

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.