oop multiple choice question PDF

Title oop multiple choice question
Course object oriented programming
Institution Adeleke University
Pages 30
File Size 574 KB
File Type PDF
Total Downloads 7
Total Views 175

Summary

oop multiple choice question ...


Description

Department of Computer Scie Science nce REVISION Course Code: CSC 412 Course Title: Object Oriented Design and Programming

1.

Unit: 3 Credits

Which of the following is correct about python? A. Python is a high-level, interpreted, interactive and object-oriented scripting language B. Python is designed to be highly readable C. It uses English keywords frequently where as other languages use punctuation, and it has fewer syntactical construction than other languages D. All of the above

2.

Which of the following best defines a class? A. Parent of an object B. Instance of an object C. Blueprint of an object D. Scope of an object

3.

Who invented OOP? A. Alan Kay B. Andrea Ferro C. Dennis Ritchie D. Adele Goldberg

4.

Which of the following is correct about Python?

A. It supports functional and structured programming methods as well as OOP B. It can be used as scripting language or can be compiled byte-code for building large applications C. It provides very high-level dynamic data types and supports dynamic type checking D. All of the above 5.

Which is not feature of OOP in general definitions? A. Code reusability B. Modularity C. Duplicate/Redundant data D. Efficient Code

6.

Which Feature of OOP illustrated the code reusability? A. Polymorphism B. Abstraction C. Encapsulation D. Inheritance

7.

Which of the following is correct about Python? A. It supports automatic garbage collection B. It can be easily integrated with C, C++, COM, ActiveX, CORBA, and Java

2

C. Both of the above D. None of the above 8.

Which of the following data types is not supported in Python? A. Numbers B. String C. List D. Slice

9.

Which of the following data types is not supported in Python? A. Tuple B. Dictionary C. Generics D. List

10.

Which of the two features match each other? A. Inheritance and Encapsulation B. Encapsulation and Polymorphism C. Encapsulation and Abstraction D. Abstraction and Polymorphism

11.

If a function can perform more than 1 type of tasks, where the function name remains same, which feature of OOP is used here? A. Encapsulation B. Inheritance C. Polymorphism D. Abstraction 3

12.

If different properties and functions of a real world entity is grouped or embedded into a single element, what is it called in OOP language? A. Inheritance B. Polymorphism C. Abstraction D. Encapsulation

13.

Which of the following is not a feature of pure OOP? A. Classes must be used B. Inheritance C. Data may/may not be declared using object D. Functions Overloading

14.

Which among the following doesn’t come under OOP concept? A. Platform independent B. Data binding C. Message passing D. Data hiding

15.

What is the output of print str if str =’Hello World!’? A. Hello World! B. Error C. Str D. None of the above

16.

Which feature may be violated if we don’t use classes in a program?

4

A. Inheritance can’t be implemented B. Object must be used is violated C. Encapsulation only is violated D. Basically all the features of OOP gets violated 17.

What is the output of print str[0] if str = ‘Hello World!’? A. Hello World! B. H C. ello World! D. None of the above

18.

The feature by which one object can interact with another object is

_________ A. Data transfer B. Data Binding C. Message Passing D. Message Reading 19.

___________ underlines the feature of Polymorphism in a class. A. Nested Class B. Enclosing Class C. Inline Function D. Virtual Function

20.

What is the output of print str[2:5] if str = ‘Hello World!’?

5

A. llo World! B. H C. llo D. None of the above 21.

What is the output of print str[2:] if str = ‘Hello World!’? A. llo World! B. H C. llo D. None of the above

22.

Which among the following, for a pure OOP language, is true? A. The language should follow 3 or more features of OOP B. The language should follow at least 1 feature of OOP C. The language must follow only 3 features of OOP D. The language must follow all the rules of OOP

23.

Does OOP provide better security than POP? A. Always true for any programming language B. May not be true with respect to all programming languages C. It depends on type of program D. It’s vice-versa is true

24.

Is Python case sensitive when dealing with identifiers? A. Yes B. No

6

C. Machine Dependent D. None of the Mentioned 25.

What is the output of print str * 2 if str = ‘Hello World!’? A. Hello World! Hello World! B. Hello World! * 2 C. Hello World! D. None of the above

26.

What is the output of print list[0] if list = [‘abcd’, 786, 2.23, ‘john’, 70.2]? A. [‘abcd’, 786, 2.23, ‘john’, 70.2] B. abcd C. Error D. None of the above

27.

What is the output of print list if list = [‘abcd’, 786, 2.23, ‘john’, 70.2]? A. [‘abcd’, 786 , 2.23, ‘john’, 70.2] B. list C. Error D. None of the above

28.

What is the output of print list[1:3] if list = [‘abcd’, 786, 2.23, ‘john’, 70.2]? A. [‘abcd’, 786, 2.23, ‘john’, 70.2] B. abcd C. [786, 2.23] D. None of the above

29.

What is the output of print list[2] if list = [‘abcd’, 786, 2.23, ‘john’, 70.2]? 7

A. [‘abcd’, 786, 2.23, ‘john’, 70.2] B. abcd C. [786, 2.23] D. [2.23, ‘john’, 70.2] 30.

What is the output of print tinylist * 2 if tinylist = [123, ‘john’]? A. [123, ‘john’, 123, ‘john’] B. [123, ‘john’] * 2 C. Error D. None of the above

31.

Which is the correct operator for power(xy)? A. X^y B. X**y C. X^^y D. None of the mentioned

32.

Which one of these is floor division? A. / B. // C. % D. None of the mentioned

33.

What is the answer to this expression, 22 % 3 is? A. 7 B. 1 8

C. 0 D. 5 34.

Operators with the same precedence are evaluated in which manner? A. Left to Right B. Right to Left C. Can’t Say D. None of the mentioned

35.

What is the output of print tinylist * 2 if tinylist = [123, ‘john’]? A. [123, ‘john’, 123, ‘john’] B. [123, ‘john’] * 2 C. Error D. None of the above

36.

Which one of the following has the same precedence level? A. Addition and Subtraction B. Multiplication, Division and Addition C. Multiplication, Division, Addition and Subtraction D. Addition and Multiplication

37.

Which one of the following has the highest precedence in the expression? A. Exponential B. Addition C. Multiplication D. Parentheses 9

38.

Which of these in not a core data type? A. Lists B. Dictionary C. Tuples D. Class

39.

Which of the following is correct about tuples in Python? A. A tuple is another sequence data type that is similar to the list B. A tuple consists of a number of values separated by commas C. Unlike lists, however, tuples are enclosed within parentheses D. All of the above

40.

What is the output of print tuple[0] if tuple = ‘abcd’, 786, 2.23, ‘john’, 70.2? A. ‘abcd’, 786, 2.23, ‘john’, 70.2 B. abcd C. Error D. None of the above

41.

Which of the following will run without errors? A. round(45.8) B. round(6352.898,2,5) C. round() D. round(7463.123,2,1)

42.

What is the output of print tuple[1:3] if tuple = ‘abcd’, 786, 2.23, ‘john’,

70.2? 10

A. ‘abcd’, 786, 2.23, ‘john’, 70.2? B. abcd C. 786, 2.23 D. None of the above 43.

What is the output of print tuple[2:] if tuple = ‘abcd’, 786, 2.23, ‘john’,

70.2? A. ‘abcd’, 786, 2.23, ‘john’, 70.2 B. abcd C. 786, 2.23 D. 2.23, ‘john’, 70.2

44.

What is the output of print tinytuple * 2 if tinytuple = 123, ‘john’? A. 123, ‘john’, 123, ‘john’ B. 123, ‘john’ * 2 C. Error D. None of the above

45.

What data type is the object below? L = [1, 23, 'hello', 1] A. List B. Dictionary C. Array D. Tuple 11

46.

In order to store values in terms of key and value we use what core data type. A. List B. Tuple C. Class D. Dictionary

47.

Which of the following operator in Python performs exponential calculation on operands? A. ** B. // C. is D. not in

48.

Which of the following operator in Python performs the division on operands where the result is the quotient in which the digits after the decimal point are removed? A. ** B. // C. is D. not in

49.

Select all options that print. hello-how-are-you A. print(‘hello’, ‘how’, ‘are’, ‘you’) B. print(‘hello’, ‘how’, ‘are’, ‘you’ + ‘-‘ * 4) C. print(‘hello-‘ + ‘how-are-you’) D. print(‘hello’ + ‘-‘ + ‘how’ + ‘-‘ + ‘are’ + ‘you’) 12

50.

What is the return value of trunc()? A. int B. bool C. float D. None

51.

Which of the following statement terminates the loop statement and transfers execution to the statement immediately following the loop? A. break B. continue C. pass D. None of the above

52. Which of the following function returns a random item from a list, tuple, or string? A. choice B. randrange C. random D. seed 53.

Which of the following function checks in a string that all characters are in lowercase? A. islower B. isnumeric C. isspace D. istitle

54. Which of the following function checks in a string that all characters are numeric? A. islower B. isnumeric 13

C. isspace D. istitle 55. Which of the following function checks in a string that all characters are whitespaces? A. islower B. isnumeric C. isspace D. istitle 56.

Which of the following function checks in a string that all characters are titlecased? A. islower B. isnumeric C. isspace D. istitle

57.

Which of the following function checks in a string that all characters are in uppercase? A. isupper B. join C. len D. ljust

58.

Which of the following function merges elements in a sequence? A. isupper B. join C. len D. ljust

14

59.

What is the result of round(0.5) – round(-0.5)? A. 1.0 B. 2.0 C. 0.0 D. Value depends on Python version

60.

What does 3 ^ 4 evaluate to? A. 81 B. 12 C. 0.75 D. 7

61.

What will be the output of the following Python code? print("Hello {name1} and {name2}".format(name1='foo', name2='bin')) A. Hello foo and bin B. Hello {name1} and {name2} C. Error D. Hello and

62.

Which of the following function gets the length of the string? A. isupper B. join C. len D. ljust

63.

Which of the following function converts a string to all lowercase? A. lower B. lstrip 15

C. max D. min 64.

Which of the following function removes all leading whitespace in string? A. lower B. lstrip C. max D. min

65.

What will be the output of the following Python code snippet?

print('The sum of {0} and {1} is {2}'.format(2, 10, 12)) A. The sum of 2 and 10 is 12 B. Error C. The sum of 0 and 1 is 2 D. None of the mentioned 66.

Which of the following function returns the max alphabetical character from the string str? A. lower B. lstrip C. max D. min

67.

Which of the following function returns the min alphabetical character from the string str? A. lower B. lstrip

16

C. max D. min 68.

Which of the following function replaces all occurrences of old substring in string with new string? A. replace B. strip C. swapcase D. title

69.

Which of the following function removes all leading and trailing whitespace in string? A. replace B. strip C. swapcase D. title

70.

Which of the following commands will create a list? A. list1 = list() B. list1 = [] C. list1 = list([1, 2, 3]) D. all of the mentioned

71.

Which of the following is a building block of UML? A. Things B. Relationships C. Diagrams D. All of the mentioned 17

72.

Classes and interfaces are a part of A. Structural things B. Behavioral things C. Grouping things D. Annotational things

73. What is a collection of operations that specify a service of a class or component? A. Use Case B. Actor C. Interface D. Relationship 74.

What is a physical element that exists at runtime in UML? A. A node B. An interface C. An activity D. None of the mentioned

75.

What can be requested from any object of the class to affect behavior? A. Object B. Attribute C. Operation D. Instance

76.

Which things are dynamic parts of UML models? A. Structural things 18

B. Behavioral things C. Grouping things D. Annotational things 77.

Which diagram in UML emphasizes the time-ordering of messages? A. Activity B. Sequence C. Collaboration D. Class

78.

If you are working on real-time process control applications or systems that involve concurrent processing, you would use a A. Activity diagram B. Sequence diagram C. Statechart diagram D. Object diagram

79.

Which things in UML are the explanatory parts of UML models? A. Structural things B. Behavioral things C. Grouping things D. Annotational things

80.

Which of the following term is best defined by the statement:”a structural relationship that specifies that objects of one thing are connected to objects of another”?

19

A. Association B. Aggregation C. Realization D. Generalization 81.

What refers to the value associated with a specific attribute of an object and to any actions or side? A. Object B. State C. Interface D. None of the mentioned

82.

Which of the following UML diagrams has a static view? A. Collaboration B. Use case C. State chart D. Activity

83.

What type of core-relationship is represented by the symbol in the figure below?

A. Aggregation

20

B. Dependency C. Generalization D. Association 84.

What type of relationship is represented by Shape class and Square ?

A. Realization B. Generalization C. Aggregation D. Dependency 85.

Which diagram in UML shows a complete or partial view of the structure of a modeled system at a specific time? A. Sequence Diagram B. Collaboration Diagram C. Class Diagram D. Object Diagram

87.

Which of the following diagram is time oriented?

21

A. Collaboration B. Sequence C. Activity D. None of the mentioned 88.

How many diagrams are there in Unified Modelling Language? A. Six B. Seven C. Eight D. Nine

89. Which UML diagram is shown below?

22

A. Use Case B. Collaboration Diagram C. Class Diagram D. Object Diagram

23

90.

Which UML diagram is shown below?

A. Use Case B. State Chart C. Activity D. Object Diagram

24

91.

A. Use Case B. Collaboration Diagram C. Sequence Diagram D. Object Diagram 25

92.

Which UML diagram’s symbols are shown below?

A. Deployment Diagram B. Collaboration Diagram C. Component Diagram D. Object Diagram 93.

Which UML diagram is shown below?

A. Deployment Diagram

26

B. Collaboration Diagram C. Object Diagram D. Class Diagram

94.

Which UML diagram is shown below?

27

A. Activity B. State chart C. Sequence D. Collaboration

28

95.

A. Component B. Deployment C. Use Case D. DFD 96.

Which diagram shows the configuration of run-time processing elements? A. Deployment diagram B. Component diagram C. Node diagram D. ER-diagram 29

97.

Wh

L is being shown in the figure?

A. Node B. Interface C. Class D. Component

30...


Similar Free PDFs