[miniorange_social_sharing]
[TheChamp-Login]

/40

Final Exam for Python for Everyone (A to Z)

BEST OF LUCK!!!

1 / 40

1.

 ____________________ 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

2 / 40

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

3 / 40

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

4 / 40

4. The len() method to return the length of an array

5 / 40

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

6 / 40

6.

Following is an example of ___________________

sv = “csiplearninghub.com”

a. List

b. String

c. Dictionary

d. None of the above

7 / 40

7. What is another word for ‘iteration’ ?

a) Selection

b) Assignment

c) Sequencing

d) Repetition

8 / 40

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

9 / 40

9. break in Python is used ______________

a) To restart a loop

b) Terminate a loop

c) To jump in between the loop

d) None of the above

10 / 40

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

11 / 40

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

12 / 40

12. Python has syntax that allows developers to write programs with fewer lines than some other programming languages.

13 / 40

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

14 / 40

14. Pascal Case
Each word starts with a capital letter:

15 / 40

15.

Which is the correct operator for power(xy)?

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

16 / 40

16.

def cal(n1) : What is n1?

a. Parameter

b. Argument

c. Keyword

d. None of the above

17 / 40

17.

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

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

18 / 40

18. The length of an array is always one more than the highest array index.

19 / 40

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

20 / 40

20. A loop block in python starts with a –

a) ; (semicolon)

b) , (comma)

c) : (colon)

d) # (hash)

21 / 40

21. Comparison operators are not  used to compare two values

22 / 40

22.

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

a. True

b. False

23 / 40

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

24 / 40

24.

Which of the following statement is a function call?

a. call sum( )

b. def sum( )

c. sum( )

d. function sum( )

25 / 40

25. Python can be install on both  Linux and  Windows

26 / 40

26.

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

27 / 40

27.

The function can be called in the program by writing function name followed by ____

a. [ ]

b. { }

c. ( )

d. None of the above

28 / 40

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

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

31 / 40

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

a. 5

b. 3

c. 6

d. 7

32 / 40

32.

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

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

33 / 40

33. Python has various versions available

34 / 40

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

35 / 40

35.

 Which of the following statement is False?

  1. Variable names can be arbitrarily long.
  2. They can contain both letters and numbers.
  3. Variable name can begin with underscore.
  4. Variable name can begin with number.

36 / 40

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

37 / 40

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

38 / 40

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

39 / 40

39.

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

40 / 40

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

 

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.