Lesson 3 Quiz - CIST2381-Mobile Application Development
Which of the following is NOT the best example of encapsulation? A) A main function doing error-checking before setting a Rectangle's instance variables' values. B) A Rectangle having two instance variables: width and length. C) A Rectangle object displaying its own data onscreen. D) A Rectangle object setting its height value.
A) A main function doing error-checking before setting a Rectangle's instance variables' values.
What term is used to identify when an object hands off some functionality to another object? A) Delegate B) Client C) Slave D) Minion
A) Delegate
What are the more commonly used names for accessor methods? A) Getters and setters B) Makers and takers C) Pushers and pullers D) Givers and takers
A) Getters and setters
The Java programming language is considered what type of language? A) Object-oriented (OO) B) Scripting C) Event-driven D) Procedural
A) Object-oriented (OO)
Given the UML class diagram seen in the accompanying figure, what is the class's name? A) Rectangle B) double C) getArea D) Unknown
A) Rectangle
A child class can inherit the methods from its parent class (or super class) A) True B) False
A) True
MVC stands for Model-View-Controller, a design pattern that separates program tasks into different tiers. A) True B) False
A) True
Best practices are the result of finding the most successful set of test runs for an application. A) True B) False
B) False
C#, Java, and Objective-C have automatic garbage collection enabled by default. A) True B) False
B) False
Design patterns are just another name for best practices. A) True B) False
B) False
In C#, Java, and Objective-C, String objects are immutable, meaning that after strings are created, they can't be changed. Therefore, the following code is illegal: String str1 = "abc"; str1 = str1 + "123"; A) True B) False
B) False
Like object-oriented programs, procedural programs are data centered. A) True B) False
B) False
Given the UML class diagram seen in the accompanying figure, what is/are the class's data member(s)?
B) Length and width
Which is not a possible outcome of an app with a memory leak? A) The app will run without issue. B) The app will close itself automatically when it reaches the memory limit. C) The app will crash. D) The system will crash.
B) The app will close itself automatically when it reaches the memory limit.
Given the inheritance tree in the accompanying figure, which is a list of all subclasses? A) UnpoweredVehicle, PoweredVehicle B) UnpoweredVehicle, PoweredVehicle, Bicycle, Skateboard, Motorcycle, Car C) Bicycle, Skateboard, Motorcycle, Car D) Cannot be determined from the diagram
B) UnpoweredVehicle, PoweredVehicle, Bicycle, Skateboard, Motorcycle, Car
Which of the following is NOT an example of a best practice? A) Using an Application Programming Interface (API) B) Using inheritance C) Using accessor methods D) Using the Model-View-Controller design pattern
B) Using inheritance
Given the inheritance tree in the accompanying figure, which is a list of all superclasses?
B) Vehicle, UnpoweredVehicle, PoweredVehicle
Given the UML class diagram seen in the accompanying figure, what is/are the class's data member(s)? A) Rectangle B) length and width C) getArea and getPerimeter D) Unknown
B) length and width
Given the UML class diagram seen in the accompanying figure, what is/are the class's member method(s)? A) Rectangle B) length and width C) getArea and getPerimeter D) Unknown
C) getArea and getPerimeter
In C#, Java, and Objective-C, what is the greatest number of subclasses a class can have? A) Depends on the language B) 0 C) 1 D) More than 1
D) More than 1
14.Which is the most efficient way to concatenate the two strings, "quick brown fox" and "jumped over the lazy dog" in Java?
D) StringBuffer buffer = new StringBuffer("quick brown fox"); buffer.append(" jumped over the lazy dog"); String string1 = buffer.toString();
Which is the most efficient way to concatenate the two strings, "quick brown fox" and "jumped over the lazy dog" in Java? A) String string1 = "quick brown fox"; string1 = string1 + " jumped over the lazy dog"; B) String string1 = "quick brown fox"; String string2 = string1 + " jumped over the lazy dog"; C) String string1 = "quick brown fox"; String string2 =" jumped over the lazy dog"; String string3 = string1 + string2; D) StringBuffer buffer = new StringBuffer("quick brown fox"); buffer.append(" jumped over the lazy dog"); String string1 = buffer.toString();
D) StringBuffer buffer = new StringBuffer("quick brown fox"); buffer.append(" jumped over the lazy dog"); String string1 = buffer.toString();