[miniorange_social_sharing]
[TheChamp-Login]

/40

Final Exam for Python for Everyone (A to Z)

BEST OF LUCK!!!

1 / 40

1.

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

a. [ ]

b. { }

c. ( )

d. None of the above

2 / 40

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

3 / 40

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

4 / 40

4. What is another word for ‘iteration’ ?

a) Selection

b) Assignment

c) Sequencing

d) Repetition

5 / 40

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

6 / 40

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

7 / 40

7.

 ____________________ 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

8 / 40

8. Variables that are created outside of a function

9 / 40

9. A loop block in python starts with a –

a) ; (semicolon)

b) , (comma)

c) : (colon)

d) # (hash)

10 / 40

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

11 / 40

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

12 / 40

12. Which keyword is used for function?
a) Fun
b) Define
c) Def
d) Function

13 / 40

13. python has two primitive loop commands:

  • while loops
  • for loops

14 / 40

14. Comments can be used to explain Python code.

15 / 40

15.

Write the output of the following code :

str = "Welcome"str[2] = 'a'print(str)

a. Weacome

b. Error

c. aWelcome

d. Welcomea

16 / 40

16.

 Select the correct example of complex datatype in Python

  1. 3 + 2j
  2. -100j
  3. 5j
  4. All of the above are correct

17 / 40

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

18 / 40

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

19 / 40

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

20 / 40

20.

 What is output of: 35 == 35.0

  1. False
  2. True
  3. 33
  4. None of the above

21 / 40

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

22 / 40

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

23 / 40

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

24 / 40

24. Arithmetic operators are used with numeric values to perform common mathematical operations

25 / 40

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

26 / 40

26.

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

27 / 40

27.

What is the data type of print(type(0xFF))

28 / 40

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

29 / 40

29.

Following is an example of ___________________

sv = “csiplearninghub.com”

a. List

b. String

c. Dictionary

d. None of the above

30 / 40

30. Python  was created by Guido van Rossum, and released in 1999.

31 / 40

31. You can also have multiple else statements on the same line:

32 / 40

32.

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

33 / 40

33.

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

a. True

b. False

34 / 40

34.

Which statement is correct?

A. List is immutable && Tuple is mutable
B. List is mutable && Tuple is immutable
C. Both are Mutable.
D. Both are Immutable

35 / 40

35.

Which keyword is used to begin the definition of a function?

a. Define

b. DEF

c. def

d. Def

36 / 40

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

37 / 40

37. You can also have an else without the elif

38 / 40

38.

Which is the correct operator for power(xy)?

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

39 / 40

39. With the for loop we can execute a set of statements

40 / 40

40. The list’s remove() method only removes the first occurrence of the specified value.

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.