Quiznetik

Problem Solving and Python Programming | Set 1

1. The word                         comes from the name of a Persian mathematician Abu Ja’far Mohammed ibn-i Musa al Khowarizmi.

Correct : C. algorithm

2. In computer science, algorithm refers to a special method usable by a computer for the solution to a problem.

Correct : A. true

3. This characteristic often draws the line between what is feasible and what is impossible.

Correct : A. performance

4. The time that depends on the input: an already sorted sequence that is easier to sort.

Correct : C. running

5. When an algorithm is written in the form of a programming language, it becomes a

Correct : B. program

6. Any algorithm is a program.

Correct : B. false

7. A system wherein items are added from one and removed from the other end.

Correct : B. queue

8. Another name for 1-D arrays.

Correct : A. linear arrays

9. A data structure that follows the FIFO principle.

Correct : A. queue

10. The symbol denotes

Correct : C. terminal

11. In computer science, algorithm refers to a pictorial representation of a flowchart.

Correct : B. false

12. The process of drawing a flowchart for an algorithm is called

Correct : D. flowcharting

13. Actual instructions in flowcharting are represented in

Correct : B. boxes

14. The following box denotes?

Correct : A. decision

15. A box that can represent two different conditions.

Correct : B. diamond

16. There should be certain set standards on the amount of details that should be provided in a flowchart.

Correct : B. false

17. A detailed flowchart is called

Correct : C. micro

18. Which of the following is not an advantage of a flowchart?

Correct : D. improper documentation

19. A flowchart that outlines the main segments of a program.

Correct : B. macro

20. A                              is diagram that depicts the flow of a program.

Correct : D. flowchart

21. Terminals are represented by diagonals in a flowchart.

Correct : B. false

22. The operation represented by parallelograms.

Correct : A. input/output

23. Which of the following is not a flowchart structure?

Correct : A. process

24. The action performed by a                         structure must eventually cause the loop to terminate.

Correct : C. repetition

25. The following symbol denotes:

Correct : A. module

26. What type of structure is this?

Correct : C. repetition

27. A                is a connector showing the relationship between the representative shapes.

Correct : B. arrow

28. The following box denotes?

Correct : A. decision

29. Capitalize initial keyword – This is a rule while writing a pseudo code.

Correct : A. true

30. is used to show hierarchy in a pseudo code.

Correct : A. indentation

31. The statement that tells the computer to get a value from an input device and store it in a memory location.

Correct : C. read

32. begins with lower case letters.

Correct : B. variables

33. Another notation for exponentiation.

Correct : B. **

34. A symbol used for grouping.

Correct : A. ()

35. A statement used to close the IF block.

Correct : D. endif

36. Is Python case sensitive when dealing with identifiers?

Correct : A. yes

37. What is the maximum possible length of an identifier?

Correct : D. none of the mentioned

38. Which of the following is invalid?

Correct : D. none of the mentioned

39. Which of the following is an invalid variable?

Correct : B. 1st_string

40. Why are local variable names beginning with an underscore discouraged?

Correct : A. they are used to indicate a private variables of a class

41. Which of the following is not a keyword?

Correct : A. eval

42. All keywords in Python are in

Correct : D. none of the mentioned

43. Which of the following is an invalid statement?

Correct : B. a b c = 1000 2000 3000

44. Which of the following cannot be a variable?

Correct : B. in

45. Which is the correct operator for power(xy)?

Correct : B. x**y

46. Which one of these is floor division?

Correct : B. //

47. What is the answer to this expression, 22 % 3 is?

Correct : B. 1

48. Mathematical operations can be performed on a string.

Correct : B. false

49. What is the output of this expression, 3*1**3?

Correct : C. 3

50. Which one of the following has the same precedence level?

Correct : A. addition and subtraction

51. Which one of the following has the highest precedence in the expression?

Correct : D. parentheses

52. Which of these in not a core data type?

Correct : D. class

53. Given a function that does not return any value, What value is thrown by default when executed in shell.

Correct : D. none

54. Which of the following will run without errors?

Correct : A. round(45.8)

55. What is the return type of function id?

Correct : A. int

56. In python we do not specify types, it is directly interpreted by the compiler, so consider the following operation to be performed. >>>x = 13 ? 2 objective is to make sure x has a integer value, select all that apply (python 3.xx)

Correct : D. all of the mentioned

57. what will be the output of the following Python code snippet? def example(a): a = a + '2' a = a*2 return a >>>example("hello")

Correct : A. indentation error

58. What data type is the object below? L = [1, 23, 'hello', 1]

Correct : A. list

59. In order to store values in terms of key and value we use what core data type.

Correct : D. dictionary

60. Which of the following results in a SyntaxError?

Correct : C. ‘3\\’

61. What is the average value of the following Python code snippet? >>>grade1 = 80 >>>grade2 = 90 >>>average = (grade1 + grade2) / 2

Correct : A. 85.0

62. What is the return value of trunc()?

Correct : A. int

63. What is the output of print 0.1 + 0.2 == 0.3?

Correct : B. false

64. Which of the following is not a complex number?

Correct : C. k = 2 + 3l

65. What is the type of inf?

Correct : C. float

66. What does ~4 evaluate to?

Correct : A. -5

67. What is the result of cmp(3, 1)?

Correct : A. 1

68. Which of the following is incorrect?

Correct : D. float(’12+34′)

69. What is the result of round(0.5) – round(-0.5)?

Correct : D. value depends on python version

70. What does 3 ^ 4 evaluate to?

Correct : D. 7

71. The value of the expressions 4/(3*(2-1)) and 4/3*(2-1) is the same.

Correct : A. true

72. What will be the value of the following Python expression? 4 + 3 % 5

Correct : B. 7

73. Which of the following operators has its associativity from right to left?

Correct : D. **

74. What will be the value of x in the following Python expression? x = int(43.55+2/2)

Correct : B. 44

75. What is the value of the following expression? 2+4.00, 2**4.0

Correct : A. (6.0, 16.0)

76. Which of the following is the truncation division operator?

Correct : C. //

77. What are the values of the following Python expressions? 2**(3**2) (2**3)**2 2**3**2

Correct : D. 512, 64, 512

78. What is the value of the following expression? 8/4/2, 8/(4/2)

Correct : A. (1.0, 4.0)

79. What will be the value of X in the following Python expression? X = 2+9*((3*12)-8)/10

Correct : D. 27.2

80. What will be the output of the following Python expression? 24//6%3, 24//4//2

Correct : A. (1,3)

81. What will be the value of the following Python expression? float(4+int(2.39)%2)

Correct : C. 4.0

82. What will be the value of the following Python expression? 4+2**5//10

Correct : B. 7

83. The expression 2**2**3 is evaluates as: (2**2)**3.

Correct : B. false

84. What will be the output of the following Python expression? int(1011)?

Correct : A. 1011

85. Which of the following expressions results in an error?

Correct : C. int(1011,2)

86. Which of the following represents the bitwise XOR operator?

Correct : B. ^

87. What is the value of the following Python expression? bin(0x8)

Correct : D. ‘0b1000’

88. What will be the output of the following Python expression? 0x35 | 0x75

Correct : C. 117

89. It is not possible for the two’s complement value to be equal to the original value in any case.

Correct : B. false

90. Bitwise                    gives 1 if either of the bits is 1 and 0 when both of the bits are 1.

Correct : C. xor

91. What will be the output of the following Python expression? 4^12

Correct : C. 8

92. Which of the following expressions can be used to multiply a given number ‘a’ by 4?

Correct : A. a<<2

93. R operator. Hence the output of the code shown above is: 20 10.

Correct : B. 11010100

94. What will be the output of the following Python code snippet? not(10<20) and not(10>30)

Correct : B. false

95. What will be the output of the following Python code? for i in range(0): print(i)

Correct : B. no output

96. What will be the output of the following Python code? for i in range(2.0): print(i)

Correct : C. error

97. What will be the output of the following Python code? for i in range(int(2.0)): print(i)

Correct : B. 0 1

98. What will be the output of the following Python code snippet? a = [0, 1, 2, 3] for a[0] in a: print(a[0])

Correct : A. 0 1 2 3

99. What will be the output of the following Python statement? >>>"a"+"bc"

Correct : D. abc

100. What will be the output of the following Python statement? >>>"abcd"[2:]

Correct : C. cd