Governors State University Secure Programming Worksheet
Description
QUESTION 1A method that receives an ___, ___ input argument must beware that other methods or threads might concurrently modify the input object.Trusted, finalUntrusted, finalTrusted, nonfinal Untrusted, nonfinal3 points QUESTION 2Methods that receive arguments across a trust boundary must perform ——– of their arguments for safety and security reasons.Callee validationCaller Validationperformance validationdefense validation3 points QUESTION 3What may cause modifying a superclass without considering the effect on subclasses?potentially unsafe operations.may cause the errorcan be subject to erratic behavior, resulting in inconsistent data state and mismanaged control flow.can be subject to normal behavior, resulting in consistent data state and mismanaged control flow.2 points QUESTION 4Which of the following methods has several useful cryptographic applicationsMediuminteger.modPow()BigInteger.modPow()SmallInteger.modPow()TallInteger.modPow()3 points QUESTION 5Defensive programming is largely discredited within the programming community, in part.for reasons of validationfor reasons of interfacefor reasons of performancefor reasons of defensive3 points QUESTION 6Why is Normal practice required to validate only one side of each interface of the validation method?*a. b. Testing of arguments by both the bounds and the validation is a style of defensive programmingTesting of arguments by both the caller and the callee is a style of defensive programmingTesting of arguments by both the caller and the callee is a style of Offensive programmingTesting of arguments by both the bounds and the validation is a style of defensive programmingTesting of arguments by both the bounds and the validation is a style of Offensive programming3 points QUESTION 7Which of the following class is used by a noncompliant code thejava.math.BigInteger classjava.draw.BigInteger classjava.draw.Biginteger classjava.math.SmallInteger3 points QUESTION 8One valid use of the cardinality method is to determine?a.how many objects in the collection are not nullb.how many variavles in the collection are nullc.how many objects in the collection have char.d.how many objects in the collection are null.3 points QUESTION 9——— of arguments can result in faster codeCaller validationCaller interferencecaller performancecaller defensive3 points QUESTION 10Null pointers musta.Never be dereferenced.b.Always be dereferenced.c.Sometime be deference.d.None of the above3 points QUESTION 11When developers modify a superclass, the developer must ensure that changes in the superclass preserve all the program invariants on which the ___ depend.Base classesSQLSuperclassesSubclasses2 points QUESTION 12If cloning or copying a mutable object is infeasible or expensive, one alternative is to create a __________________.final classReturnRef class UnmodifiableDateView classMutableClass3 points QUESTION 13This compliant solution generifies the________ method, eliminating any possible type violations.getVakue()getDate()addToList()clone()3 points QUESTION 14Defensive programming is largely discredited within the programming community, in part. for reasons of validationfor reasons of interfacefor reasons of performancefor reasons of defensive3 points QUESTION 15What method uses compliant solution to perform value comparisons of wrapped objects.String []Wrapped{}ArrayList<Integer>()equals() 2 points QUESTION 16Conversely, ——— validation of arguments ————- the validation code in a single location, reducing the size of the codecallee and encapsulatescallee and capsulatesperformance encapsulatesPerformance and encapsulate3 points QUESTION 17Invariant. Subclasses that are developed without awareness of the superclass implementation can be subject to ___ behavior, resulting in inconsistent data state and ___ control flow.Erratic, managedPredictable, managedErratic, mismanagedPredictable, mismanaged3 points QUESTION 18Defensive programming is largely discredited within the programming community, in part. for reasons of validationfor reasons of interfacefor reasons of performancefor reasons of defensive3 points QUESTION 19Which of the following methods has several useful cryptographic applicationsMediuminteger.modPow()BigInteger.modPow()TallInteger.modPow()SmallInteger.modPow()3 points QUESTION 20Which compliant solution uses the class to avoid precision loss, It then performs a numeric comparison, which passes as expected. Floting-pointMAX_VALUEBigDecimalrange-checks2 points QUESTION 21——— of arguments can result in faster code Caller validationCaller interferencecaller performancecaller defensive3 points QUESTION 22______________of casts that can lose precision is straightforward. Sound determination of whether those casts correctly reflect the intent of the programmer is infeasible in the general caseConversionAutomatic detectionConverting Wider type2 points QUESTION 23Operations on objects of type AtomicInteger suffer from the same over?ow issues as ?x valuesOther integer typey valuesOther Char types3 points QUESTION 24_______can return values to communicate failure or success or to update local objects or fields.a.Domainb.Variablec.Pointersd.Methods2 points QUESTION 25What may cause modifying a superclass without considering the effect on subclasses?potentially unsafe operations.can be subject to erratic behavior, resulting in inconsistent data state and mismanaged control flow.a subclass that extends a superclassmay cause the error2 points QUESTION 26Why is Normal practice required to validate only one side of each interface of the validation method?Testing of arguments by both the caller and the callee is a style of defensive programmingTesting of arguments by both the bounds and the validation is a style of defensive programmingAnalysis of arguments by both the caller and the callee is a style of defensive programmingAnalysis of arguments by both the bounds and the callee is a style of defensive programming3 points QUESTION 27The _____ operator is a logical right shift; it fills the leftmost bits with zeroes, regardlessof the number’s original sign.>>=<<//>>>=3 points QUESTION 28Why double to float Conversion compliant solution performs range checks on both i and j before proceeding with the conversions?Because both values are out of the valid range for a float, this code will not throw an ArithmeticException.Because both values are out of the valid range for a float, this code will always throw an ArithmeticException.Because cast a numeric valueBecause automated detection narrowing integral types2 points QUESTION 29Use ___ accessor methods to expose class members that are to be accessed outside of the package in which their class is declaredDynamicstrictfpWrapperstartup3 points QUESTION 30_________________ of all uses of the reference equality operators on boxedprimitive objects is straightforward. Determining the correctness of such uses is infeasibleRelated Guidelines Equivalence operatorsAutomated Detection in the general case.2 points QUESTION 31——— of arguments can result in faster codeCaller validationCaller interferencecaller performancecaller defensive3 points QUESTION 32Testing of arguments by both the —- and the—— is a style of defensive programming that is largely discredited within the programming community, in part for reasons of performanceRedeundant and validationbounds and boundaryRedeundant and validationcaller and callee 3 points QUESTION 33because the ——- may be aware of invariants that prevent invalid values from being passed.callervalidationInterfacedefense3 points QUESTION 34Denormalized numbers are acceptable when:Denormalized numbers are acceptable when: suitable numerical analysis don’t demonstrates that the computed values meet all accuracy behavioral requirements appropriate to the application.Unsuitable numerical analysis demonstrates that the computed values meet all accuracy 3 points QUESTION 35What type represents 16-bit unsigned integers representing UTF-16 code unitsIntShortChar2 points QUESTION 36Failure to perform ________________can lead to integer overflows, which cancause unexpected program control flow or unanticipated program behavior.appropriate range checkingarithmetic operationsmore detailsAuto determination3 points QUESTION 37Methods like ——— should validate arguments that are both untrusted and unvalidated when those arguments may propagate from a public method via its arguments.PublicprivateprotectedLocal3 points QUESTION 38In Java, a division or modulo by zero can result in:a.) program terminationb.) denial of servicec.) an errord.) all of the abovenormalize()The compliant solution (AtomicInteger) uses which method?SpeedCompareAndSet()3 points QUESTION 39Testing of arguments is a style of defensive programming that is largely discredited within the programming community, in part for which of the following reasons of performance.incorrect and calculationsbounds and boundaryRedeundant and validationcaller and callee3 points QUESTION 40A fundamental principle of __________ design is that a subclass that extends a superclass must preserve the invariants provided by the superclass.privatemutablestatic object-oriented3 points
Have a similar assignment? "Place an order for your assignment and have exceptional work written by our team of experts, guaranteeing you A results."