[miniorange_social_sharing]
[TheChamp-Login]

/40

Final Exam for Python for Everyone (A to Z)

BEST OF LUCK!!!

1 / 40

1. A for loop is used for iterating over a sequence (that is either a list, a tuple, a dictionary, a set, or a string).

2 / 40

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

3 / 40

3. Is there any comments in  following codes

i = 1while True:    if i%3 == 0:        break    print(i)     i + = 1

 

4 / 40

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

5 / 40

5.

 What is output of: 35 == 35.0

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

6 / 40

6.

Write the output of the following code :

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

a. Weacome

b. Error

c. aWelcome

d. Welcomea

7 / 40

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

8 / 40

8. print() function is often used to output variables.

9 / 40

9.

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

10 / 40

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

11 / 40

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

a) for

b) while

c) Both (a) and (b)

d) None of the above

12 / 40

12. Python allows you to extract the values into variables.

13 / 40

13. python file can also run on command line

14 / 40

14. Arrays are used to store multiple values in one single variable.

15 / 40

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

 

16 / 40

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

17 / 40

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

18 / 40

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

19 / 40

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

20 / 40

20.

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

a. Define

b. DEF

c. def

d. Def

21 / 40

21.

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.

22 / 40

22.

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

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

23 / 40

23.

Which of the following statement will execute in last?

def s(n1): #Statement 1      print(n1) #Statement 2n2=4 #Statement 3s(n2) #Statement 4

a. Statement 1

b. Statement 2

c. Statement 3

d. Statement 4

24 / 40

24. The format() method takes the passed arguments

25 / 40

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

26 / 40

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

27 / 40

27. Comments can be used to make the code more readable.

28 / 40

28. Python has various versions available

29 / 40

29.

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

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

30 / 40

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

31 / 40

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

32 / 40

32.

 Select the correct example of complex datatype in Python

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

33 / 40

33.

Following is an example of ___________________

sv = “csiplearninghub.com”

a. List

b. String

c. Dictionary

d. None of the above

34 / 40

34. Comparison operators are not  used to compare two values

35 / 40

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

36 / 40

36.

How to copy one list to another in python?

A. l1[] = l2[]
B. l1[] = l2
C. l1[] = l2[:]
D. l1 = l2

37 / 40

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

38 / 40

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

39 / 40

39. Python can connect to database systems.

40 / 40

40. python has two primitive loop commands:

  • while loops
  • for loops

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.