Examlex

Solved

Assuming That a User Enters 45 as the Brightness of a Lamp

question 2

Multiple Choice

Assuming that a user enters 45 as the brightness of a lamp, which of the following hand-trace tables is valid for the given code snippet?
Int brightness = 0;
String description = "";
Scanner in = new Scanner(System.in) ;
System.out.print("Enter your lamp brightness (in watts) : ") ;
Brightness = in.nextInt() ;
If (brightness >= 120)
{
Description = "very bright";
If (brightness >= 100)
{
Description = "bright";
}
}
Else
{
Description = "pleasant";
If (brightness <= 50)
{
Description = "dim";
}
}


Definitions:

Adrenal Glands

Small glands located on top of each kidney that produce hormones such as adrenaline and cortisol, which help control heart rate, blood pressure, and other important bodily functions.

Cortisol

A steroid hormone produced by the adrenal glands, often released in response to stress and a key component in the body's stress response system.

Melatonin

A hormone produced by the pineal gland that helps regulate sleep-wake cycles.

Telomeres

Protective caps at the end of chromosomes that shorten with each cell division, associated with aging.

Related Questions