[miniorange_social_sharing]
[TheChamp-Login]

/40

Final Exam for Python for Everyone (A to Z)

BEST OF LUCK!!!

1 / 40

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

 

2 / 40

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

3 / 40

3.

Following is an example of ___________________

sv = “csiplearninghub.com”

a. List

b. String

c. Dictionary

d. None of the above

4 / 40

4. A variable name can only contain alpha-numeric characters and
underscores

5 / 40

5. python file can also run on command line

6 / 40

6. Comments starts with a #

7 / 40

7. Python is an interpreted programming language

8 / 40

8.

def cal(n1) : What is n1?

a. Parameter

b. Argument

c. Keyword

d. None of the above

9 / 40

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

10 / 40

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

11 / 40

11.

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

a. Define

b. DEF

c. def

d. Def

12 / 40

12.

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

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

13 / 40

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

14 / 40

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

15 / 40

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

16 / 40

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

17 / 40

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

18 / 40

18.

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

19 / 40

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

20 / 40

20.

What will be the output of below Python code?

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

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

21 / 40

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

22 / 40

22.

Which is the correct operator for power(xy)?

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

23 / 40

23.

What will be the output of below Python code?

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

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

24 / 40

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

25 / 40

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

26 / 40

26. Is there any comments in  following codes

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

 

27 / 40

27. Python has a set of built-in methods that you can use on lists/arrays

28 / 40

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

29 / 40

29. Comments can’t be used to prevent execution when testing code.

30 / 40

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

31 / 40

31. Comparison operators are not  used to compare two values

32 / 40

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

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. Python allows you to extract the values into variables.

35 / 40

35.

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

a. True

b. False

36 / 40

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

37 / 40

37. What is the output of the given below program?

if 3 + 4 == 7:    print("Hi")else:    print("Know Program")print("Hello")

a) Hi
b) Know Program

c)
Hi
Hello

d)
Know Program
Hello

38 / 40

38. Variable names are case-sensitive

39 / 40

39. Who developed Python Programming Language?

40 / 40

40. Python has various versions available

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.