Answer: True
Explanation:
The statement that assert statements are a tool programmers employ in order to help them debug their code more efficiently is true.
They help in debugging as they evaluate whether a statement is either true or false. When it's false, the assert statement will indicate an error which shows that there is a bug that need to be fixed.
The earliest age to collect is 62
Answer: 6. False
7. True
8. True
9. True
10. False
Explanation:
6. This is false. Cnidarians are aquatic animals that can be found in marine environments. They aren't wormlike. Examples are corals and jelly fish.
7. Snails, clams, oysters, squid and octopuses are mollusks. They're invertebrates and usually live in water.
8. True. Invertebrates are the animals that don't have backbone unlike the vertebrates that has backbone. Examples of invertebrates are snail, earthworm etc.
9. True. The Arthropods are known to be the largest group in the animal kingdom. They include insects, millipedes, crabs, lobsters, spiders, mites, centipedes, etc.
10. False. The crustacean doesn't have one pair of leg per segment.
Logic gates take boolean input(s) and returns boolean output(s).
OR gate:
Two inputs, output is true if at least one input is 1.
AND gate:
Two inputs, output is true if both inputs are 1.
NOT gate:
One input, output is the reversed bit; 0 -> 1, 1 -> 0.
NAND gate:
Essentially a "Not AND" gate. The reverse of the AND gate.
NOR gate:
Essentially a "Not OR" gate. The reverse of the OR gate.
XOR gate:
Similar to an OR gate, outputs 1 if only one input is one.
These can be understood a lot better by looking at their respected truth tables.
Answer:
import java.io.*;
public class Main
{
public static void main(String[] args) throws IOException {
BufferedReader bufferObject=new BufferedReader(new InputStreamReader(System.in));
String stringObject=bufferObject.readLine();
while(!stringObject.equals("99:99AM")){
System.out.println(convertedTime(stringObject));
stringObject=bufferObject.readLine();
}
}
public static String convertedTime(String stringObject){
String s=stringObject.substring(stringObject.length()-2);
String[] timeObject=stringObject.substring(0,5).split(":");
if(s.equals("AM")){
if(timeObject[0].equals("12")) return "00"+timeObject[1];
else return timeObject[0]+timeObject[1];
}
else{
if(timeObject[0].equals("12")) return "12"+timeObject[1];
else{
int hours=Integer.valueOf(timeObject[0]);
timeObject[0]=String.valueOf(12+hours);
return timeObject[0]+timeObject[1];
}
}
}
}
Explanation:
- Inside the main method run a while loop until stringObject is not equal to the string "99:99AM".
- Call the convertedTime method and display the results.
- Use the same hours and minutes except for 12th hour If the time is in AM.
- Use "00" instead of 12, if it is 12th hour.
- Add hours to 12, if the time is in PM and don't change anything in case of 12.