Examlex

Solved

Consider the Following Paint Method to Answer the Questions Below

question 31

Multiple Choice

Consider the following paint method to answer the questions below:
public void paint(Graphics page)
{
int x, y = 200;
page.setColor(Color.blue) ;
for (x = 100; x < 200; x += 20)
page.fillRect(x, y, 10, y-x) ;
}
-What will the following code do? Assume s is a String, x is an int initialized to 10, page is a Graphics object, and this is part of a paint method for an applet.
Boolean isVowel = false;
String vowels = "aeiou";
For (int j = 0; j < s.length( ) ; j++)
{
For (int k = 0; k < 5; k++)
If (s.charAt(j) == vowels.charAt(k) ) isVowel = True;
If (isVowel) page.drawString(""+s.charAt(j) , 10, 15*x++) ;
Else page.drawString(""+s.charAt(j) , 110, 15*x++) ;
IsVowel = false;
}


Definitions:

Toxemia

A medical condition in pregnant women characterized by high blood pressure, swelling, and protein in the urine, also known as pre-eclampsia.

Thalidomide

A drug originally marketed in the 1950s as a sedative, but later found to cause birth defects when taken by pregnant women, leading to strict controls on its use.

Kaposi's Sarcoma

A type of cancer that forms in the lining of blood and lymph vessels, often associated with weakened immune systems, like in AIDS.

Malaria

A life-threatening disease transmitted to humans through the bite of infected Anopheles mosquitoes, caused by Plasmodium parasites.

Related Questions