Question: The following code excerpts are problematic. For each one, explain what is wrong with the code, which good practice was not applied and how you
The following code excerpts are problematic. For each one, explain what is wrong with the
code, which good practice was not applied and how you would improve the code.
a Result r null;
if something
r some query..;
try
rmethod;
catch Exception e
b $qan SQL query";
$q "another SQL query";
$qn "the nth SQL query";
for $i ; $i ; $i
$qi q$i;
$q $$qi;
query$q;
c for int i ; i ; i
switch i
case :
DoThing;
break;
case :
DoThing;
break;
case :
DoThing;
break;
d String result String aMap.get key ;
if result null
result null;
return result;
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
