[miniorange_social_sharing]
[TheChamp-Login]

/40

Final Exam for Python for Everyone (A to Z)

BEST OF LUCK!!!

1 / 40

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

2 / 40

2.

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

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

3 / 40

3. python has two primitive loop commands:

  • while loops
  • for loops

4 / 40

4.

Which function overloads the >> operator?

  1. more()
  2. gt()
  3. ge()
  4. None of the above

5 / 40

5. Comments can be used to explain Python code.

6 / 40

6. Camel Case
Each word, except the first, starts with a capital letter:

7 / 40

7. Python can be install on both  Linux and  Windows

8 / 40

8.

 What is output of: 35 == 35.0

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

9 / 40

9. The format() method takes unlimited number of arguments

10 / 40

10. Which of the following is False regarding loops in Python?

a)Loops are used to perform certain tasks repeatedly.

b) while loop is used when multiple statements are to executed repeatedly until the given condition becomes true.

c) while loop is used when multiple statements are to executed repeatedly until the given condition becomes false.

d) for loop can be used to iterate through the elements of lists.

11 / 40

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

12 / 40

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

13 / 40

13. Find the output of the given Python program?

a = 25if a < 15:    print("Hi")if a <= 30:    print("Hello")else:    print("Know Program")

a) Hi
b) Hello
c) Know Program
d) Compiled Successfully, No Output.

14 / 40

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

15 / 40

15. We can combine strings and numbers by using the format() method

16 / 40

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

17 / 40

17.

Which of the following creates a tuple?

A. tuple1=(“a”,”b”)
B. tuple1[2]=(“a”,”b”)
C. tuple1=(5)*2
D. None of the above

18 / 40

18. Most recent major version of Python is Python 3

19 / 40

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

20 / 40

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

21 / 40

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

22 / 40

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

23 / 40

23. Variables that are created outside of a function

24 / 40

24.

def cal(n1) : What is n1?

a. Parameter

b. Argument

c. Keyword

d. None of the above

25 / 40

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

26 / 40

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

27 / 40

27. Suppose t = (1, 2, 4, 3), which of the following is incorrect?
a) print(t[3])
b) t[3] = 45
c) print(max(t))
d) print(len(t))

28 / 40

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

29 / 40

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

30 / 40

30.

Which of the following is False?

A. String is immutable.
B. capitalize() function in string is used to return a string by converting the whole given string into uppercase.
C. lower() function in string is used to return a string by converting the whole given string into lowercase.
D. None of these.

31 / 40

31.

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

32 / 40

32. The elif keyword is pythons way of saying “if the previous conditions were not true, then try this condition”.

33 / 40

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

34 / 40

34. Extension of all Python  Programme are .py

35 / 40

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

36 / 40

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

37 / 40

37.

The most important object defined in NumPy is an N-dimensional array type called?

A. ndarray
B. narray
C. nd_array
D. darray

38 / 40

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

39 / 40

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

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.