Chapter 10 Polymorphism
STR at several loci were screened by capillary electrophoresis and fluorescent detection for informative peaks prior to a bone marrow transplant. The following results were observed: Locus Donor Alleles Recipient Allele LPL 10,11 10,11 F13B 2,7 3,9 FESFPS 9 7 F13A01 3,8 3,8 Which loci are informative for engraftment testing using STR?
F13B, FESFPS Donor and recipient have different alleles= informative
DNA found at the crime scene of the crime was determined to have one peak at 212 bp at the amelogenin locus. The source of this DNA is which of the following?
Female
What are the two ways to achieve polymorphism in Java?
Inheritance and Interfaces
The ability to inherit method definitions from multiple classes
Multiple inheritance of IMPLEMENTATION in polymorphism refers to what situation? A) The ability to inherit method definitions from multiple classes B) The ability to inherit fields from multiple classes C) The ability to implement more than one interface D) The ability to inherit constants from multiple static classes
The ability to inherit fields from multiple classes
Multiple inheritance of STATE in polymorphism refers to what situation? A) The ability to inherit constants from multiple static classes B) The ability to inherit method definitions from multiple classes C) The ability to inherit fields from multiple classes D) The ability to implement more than one interface
A class can implement more than one interface AND An object can have multiple types
Multiple inheritance of TYPE in polymorphism refers to what situation? A) A class can implement more than one interface B) An object can have multiple types C) A class can implement more than one interface AND An object can have multiple types
If B1 is the parent of B2 then can object reference objA be changed from a new B2 to a new B1?
NO if the object starts as a B2 then it cannot become an object B1 because B1 is NOT a B2 it is the parent of B2.
A partial STR profile was produced from a highly degraded sample. Allele matched to reference sample at 8 loci. Is this sufficient for a legal identification?
No, you need all 13
abstract
An abstract class must have the modifier ______ included in the class heading.
How are Y alleles inherited? a) as a diploid on two chromosomes b) as a haplotype on one chromosome c) as a haplotype on two chromosomes d) as a diploid on one chromosome
As a haplotype on one chromosome
downcasting
Assigning an object of an ancestor class to a descendant class is called:
A southern blot could be used to detect which of the following polymorphisms?
RFLPs
What is an example of Chimerism? a) Recipient with donor marrow b) Recipient with donor blood c) Recipient with donor organ d) None of the above
Recipient with donor marrow
Which of the following polymorphisms are classified as tandem repeats of 1-10bps?
STR
How do STR and VNTR differ?
STR has shorter repeat than VNTR
What are Allelic ladders?
Standards representing all alleles observed in in a population
When a class implements one or more interfaces and may also extend a superclass
What is polymorphism in object-oriented programming? A) When a class implements one or more interfaces and may also extend a superclass B) The same as implementing a single interface C) The same as inheritance with one or more super classes.
Subclasses can share some of the same behavior of the parent class but also can define their own unique behaviors
When polymorphism is applied to OOP it means that: _______________ can share some of the same _______________ of the _______________ class but also can define their own unique _______________
If the superclass contains only abstract method declarations, the superclass is used for ________. a. implementation inheritance. b. interface inheritance. c. Both. d. Neither.
b. interface inheritance
It is a UML convention to denote the name of an abstract class in ________. a. bold. b. italics. c. a diamond. d. there is no convention of the UML to denote abstract classes—they are listed just as any other class.
b. italics
Which of the following is false? a. You should not call overridable methods from constructors—when creating a subclass object, this could lead to an overridden method being called before the subclass object is fully initialized. b. It's OK to any of a class's methods from its constructors. c. When you construct a subclass object, its constructor first calls one of the direct superclass's constructors. If the superclass constructor calls an overridable method, the subclass's version of that method will be called by the superclass constructor. d. It's acceptable to call a static method from a constructor.
b. its ok to any of a class' methods from its constructors.
For which of the following would polymorphism not provide a clean solution? a. A billing program where there is a variety of client types that are billed with different fee structures. b. A maintenance log program where data for a variety of types of machines is collected and maintenance schedules are produced for each machine based on the data collected. c. A program to compute a 5% savings account interest for a variety of clients. d. An IRS program that maintains information on a variety of taxpayers and determines who to audit based on criteria for classes of taxpayers.
c. A program to compute a 5% savings account interest for a variety of clients.
Which interface is specifically intended to be implemented by classes that can be used with the try-with-resources statement? a. Comparable b. Runnable c. AutoCloseable d. Serializable
c. AutoClosable
Consider classes A, B and C, where A is an abstract superclass, B is a concrete class that inherits from A and C is a concrete class that inherits from B. Class A declares abstract method originalMethod, implemented in class B. Which of the following statements is true of class C? a. Method originalMethod cannot be overridden in class C—once it has been implemented in concrete class B, it is implicitly final. b. Method originalMethod must be overridden in class C, or a compilation error will occur. c. If method originalMethod is not overridden in class C but is called by an object of class C, an error occurs. d. None of the above.
d. none of the above
Which interface is used to identify classes whose objects can be written to or read from some type of storage or transmitted across a network? a. Comparable b. Runnable c. AutoCloseable d. Serializable
d. serializable
hiding
involves non-virtual methods
During a criminal investigation, the suspect is heterozygous at the amelogenin locus. Is the suspect male or female?
male
How are mitochondrial polymorphisms inherited?
maternally
Mitochondrial DNA are _________inherited.
maternally
abstract method
method without a body; children must override it
overloading
methods in the same scope, same name method/function but with different signatures
Older biological samples that lack of nucleated cellular material such as hair, bones and teeth cannot be analyzed by following methods EXCEPT a) STR b) RFLP c) Y-STR d)SNP e) mtDNA analysis
mtDNA analysis
What is the different between a polymorphic allele and a mutant allele?
mutant alleles are associated with an abnormality
polymorphism
object with many meanings, variable of many forms
A change in DNA sequence that is present in at least 1% to 2% of the population is called
polymorphism
overriding
two virtual methods with the same name and signature
static binding
type of object is determined at compile time
dynamic binding
type of object is not determined until run-time
non-virtual method
usually static classes, cannot be overridden in derived class
override
If you choose to use the method clone in your code, you must ______ the clone method.
False
Polymorphism in the Java programming language allows for extending multiple superclasses. [T/F]
True
Polymorphism refers to a principle in biology in which an organism or species can have many different forms or stages [T/F]
dynamic type
The runtime type for an object.
abstract class constructor
You cannot create an object using a/an:
Early
______ binding refers to the method definition being associated with the method invocation when the code is compiled.
Polymorphic reference
a reference that can refer to different types of objects at different times.
What are different versions of polymorphic markers called?
allele
static method
an object but do not require instance data. Therefore, they !!can be called directly with the class name, such as Math.random(). don't need to instantiate an object of the class
Which of the following is not possible? a. A class that implements two interfaces. b. A class that inherits from two classes. c. A class that inherits from one class, and implements an interface. d. All of the above are possible.
b. a class that inherits from two classes.
Assigning a subclass reference to a superclass variable is safe ________. a. because the subclass object has an object of its superclass. b. because the subclass object is an object of its superclass. c. only when the superclass is abstract. d. only when the superclass is concrete.
b. because the subclass object is an object of its superclass
Which keyword is used to specify that a class will define the methods of an interface? a. uses b. implements c. defines d. extends
b. implements
abstract class
can't instantiate an object
What can SNPs be used for? a) Mapping genes b) human identification c) chimerism analysis d) All of the Above
d) All of the Above
Non-abstract classes are called ________. a. real classes. b. instance classes. c. implementable classes. d. concrete classes.
d. Concrete classes.
Interfaces can have methods. a. 0 b. 1 c. 2 d. any number of
d. any number of methods
Which of the following does not complete the sentence correctly? An interface . a. forces classes that implement it to declare all the abstract interface methods. b. can be used in place of an abstract class when there is no default implementation to inherit. c. is declared in a file by itself and is saved in a file with the same name as the interface followed by the .java extension. d. can be instantiated.
d. can be instantiated
static type
declared type of variable/compile type
What are more likely to be successfully analyzed on highly degraded DNA?
mini-STR
The FBI uses ________________while investigating the suspect of the crime.
13 STR loci
STR are repeats of ________________ in tandem.
1-10 base sequences
STR are repeats of ___ in tandem and can be detected by ___
1-10 base sequences; PCR
How many loci are considered core loci by the federal bureau of investigation in the combined DNA indexing system?
13
How does polymorphism through inheritance work?
A reference to an object in a particular class can also reference an object in any class related by inheritance.
A RFLP paternity test result is shown below. Which alleged father (AF) is the biological father? (diagram)
AF2
Which alleged father's genotype has the paternal allele (see diagram)
AF2
Polymorphism (literal meaning)
Able to assume many forms
SNP is detected by __ or __
sequencing or melt curve analysis
zero
The clone method has ______ parameters.
False
True or False: Java uses late binding with private methods, methods marked final, or static methods.
False
True or False: The final modifier is included before the definition of the method, then the method can be redefined in a derived class.
True
True or False: The type of the variable naming an object determines which method names can be used in an invocation with that calling object.
A woman has been sexually assaulted by an unknown man. Which of the following lab procedures can be used to accurately analyze residual DNA left by the man in an effort to identify him.
Y-STR
Which of the following tests is best for paternal testing?
Y-STR
If B1 is the parent of B2 then can object reference objA be changed from a new B1 to a new B2?
Yes it can because a B2 is-a B1. So this is a polymorphic reference.
Polymorphism
______ refers to the ability to associate many meanings to one method name by means of the late binding mechanism.
Binding
_______ refers to the process of associating a method definition with a method invocation.
Which of the following statements is false? a. An advantage of inheritance over interfaces is that only inheritance provides the is-a relationship. b. Objects of any subclass of a class that implements an interface can also be thought of as objects of that interface type. c. When a method parameter is declared with a subclass or interface type, the method processes the object passed as an argument polymorphically. d. All objects have the methods of class Object.
a. An advantage of inheritance over interfaces is that only inheritance provides the is-a relationship.
Polymorphism enables you to: a. program in the general. b. program in the specific. c. absorb attributes and behavior from previous classes. d. hide information from the user.
a. Program in the general
Which of the following statements is false? a. References to interface types do not have access to method toString. b. Method toString can be invoked implicitly on any object. c. With inheritance, classes and their inherited classes tend to be very similar. d. Dramatically different classes can often meaningfully implement the same interface.
a. References to interface types do not have access to method toString.
All of the following methods are implicitly final except: a. a method in an abstract class. b. a private method. c. a method declared in a final class. d. static method.
a. a method in an abstract class.
Which of the following statements about abstract superclasses is true? a. abstract superclasses may contain data. b. abstract superclasses may not contain implementations of methods. c. abstract superclasses must declare all methods as abstract. d. abstract superclasses must declare all data members not given values as abstract.
a. abstract superclasses may contain data
Polymorphism allows for specifics to be dealt with during: a. execution. b. compilation. c. programming. d. debugging.
a. execution
Every object in Java knows its own class and can access this information through method . a. getClass. b. getInformation. c. objectClass. d. objectInformation.
a. getClass
virtual methods
all methods are virtual unless told otherwise; default in java; dynamically bound
Which of the following statements is false? a. In Java SE 8, an interface may declare default methods—that is, public methods with concrete implementations that specify how an operation should be performed. b. When a class implements an interface, the class receives the interface's default concrete implementations if it does not override them. c. When you enhance an existing interface with default methods—any class that implemented the original interface will break. d. With default methods, you can declare common method implementations in interfaces (rather than abstract classes), which gives you more flexibility in designing your classes.
c. When you enhance an existing interface with default methods- any class that implemented the original interface will break.
A class that implements an interface but does not declare all of the interface's methods must be declared ________. a. public. b. interface. c. abstract. d. final.
c. abstract
A(n) class cannot be instantiated. a. final. b. concrete. c. abstract. d. polymorphic.
c. abstract
Classes and methods are declared final for all but the following reasons: a. final methods allow inlining the code. b. final methods and classes prevent further inheritance. c. final methods are static. d. final methods can improve performance.
c. final methods are static
The UML distinguishes an interface from other classes by placing the word "interface" in above the interface name. a. italics. b. carets. c. guillemets. d. bold.
c. guillemets ' '
Which of the following could be used to declare abstract method method1 in abstract class Class1 (method1 returns an int and takes no arguments)? a. public int method1(); b. public int abstract method1(); c. public abstract int method1(); d. public int nonfinal method1();
c. public abstract int method1();
In Java SE 7 and earlier, an interface may contain: a. private static data and public abstract methods. b. only public abstract methods. c. public static final data and public abstract methods. d. private static data and public final methods.
c. public static final data and abstract methods.
static class
can be used as a convenient container for sets of methods that just operate on input parameters and do not have to get or set any internal instance fields. !!a class that cannot be instantiated
RFLP can be used to distinguish the following except a) homozygous b) heterozygous c) biological father d) chimera e) none of the above
chimera (uses STR)
Which of the following statements is false? a. As of Java SE 8, any interface containing only one method is known as a functional interface. b. There are many functional interfaces throughout the Java APIs. c. Functional interfaces are used extensively with Java SE 8's new lambda capabilities. d. Anonymous methods provide a shorthand notation for creating lambdas.
d. Anonymous methods provide a shorthand notation for creating lambdas.
When a superclass variable refers to a subclass object and a method is called on that object, the proper implementation is determined at execution time. What is the process of determining the correct method to call? a. early binding. b. non-binding. c. on-time binding. d. late binding.
d. Late binding also called dynamic binding.
Which of the following statements is false? a. Prior to Java SE 8, it was common to associate with an interface a class containing static helper methods for working with objects that implemented the interface. b. Class Collections contains many static helper methods for working with objects that implement interfaces Collection, List, Set and more. c. Collections method sort can sort objects of any class that implements interface List. d. With non-static interface methods, helper methods can now be declared directly in interfaces rather than in separate classes.
d. With non-static interface methods, helper methods can now be declared directly in interfaces rather than in separate classes.
Which statement best describes the relationship between superclass and subclass types? a. A subclass reference cannot be assigned to a superclass variable and a superclass reference cannot be assigned to a subclass variable. b. A subclass reference can be assigned to a superclass variable and a superclass reference can be assigned to a subclass variable. c. A superclass reference can be assigned to a subclass variable, but a subclass reference cannot be assigned to a superclass variable. d. A subclass reference can be assigned to a superclass variable, but a superclass reference cannot be assigned to a subclass variable.
d. a subclass reference can be assigned to a superclass variable, but a superclass reference cannot be assigned to a subclass variable.
Consider the abstract superclass below: public abstract class Foo { private int a; public int b; public Foo(int aVal, int bVal) { a = aVal; b = bVal; } public abstract int calculate(); } Any concrete subclass that extends class Foo: a. Must implement a method called calculate. b. Will not be able to access the instance variable a. c. Neither (a) nor (b). d. Both (a) and (b).
d. both a and b
Declaring a method final means: a. it will prepare the object for garbage collection. b. it cannot be accessed from outside its class. c. it cannot be overloaded. d. it cannot be overridden.
d. it cannot be overriden
What kind of polymorphism do most people associate with the word?
subtype polymorphism