1 Which of the following are legal Boolean values in pseudoc

1) Which of the following are legal Boolean values in pseudocode?

False

None

0

True

\"False\"

\"True\"

2) In the following pseudocode, what relational operator should be in the blank?

Enter the correct relation in the box below (do not include any spaces).

3) Correctly order the following lines of pseudocode to create a working algorithm.

False

None

0

True

\"False\"

\"True\"

2) In the following pseudocode, what relational operator should be in the blank?

  Display \"Are you happy and you know it? (Y/N)\"  Input happy    If happy ____ \"Y\" Then          Display \"Clap your hands!\"  End If  

Enter the correct relation in the box below (do not include any spaces).

3) Correctly order the following lines of pseudocode to create a working algorithm.

  Else          Set grade = \"F\"  
  Else If score >= 60 Then          Set grade = \"D\"  
  If score >= 90 Then          Set grade = \"A\"  
  Else If score >= 70 Then          Set grade = \"C\"  
  End If  
  Else If score >= 80 Then          Set grade = \"B\"  

Solution

1) Which of the following are legal Boolean values in pseudocode?

Answer: The legal Boolean values used in pseudocode are False and True

2) In the following pseudocode, what relational operator should be in the blank?

Display \"Are you happy and you know it? (Y/N)\"

Input happy

If happy ____ \"Y\" Then

        Display \"Clap your hands!\"

End If

Enter the correct relation in the box below (do not include any spaces).

Answer: The correct relation to be used above is == (double equals known as comparison operator used to check equality). When == is used in the above condition the compiler check if happy is equal to Y, if true it prints Clap your hands!.

3) Correctly order the following lines of pseudocode to create a working algorithm.

Answer:

If score >= 90 Then

        Set grade = \"A\"

Else If score >= 80 Then

        Set grade = \"B\"

Else If score >= 70 Then

        Set grade = \"C\"

Else If score >= 60 Then

        Set grade = \"D\"

Else

        Set grade = \"F\"

End If

Explanation: The general syntax for nested if-statements is

If condition Then

            Statements to be executed

Else If condition

            Statements to be executed

Else If condition

            Statements to be executed

End If

The condition in the If is checked if it is satisfied the rest are skipped and the if is exited else goes to the else if and checks the condition there, if all the conditions in the if and else if are failed the else part is executed.

1) Which of the following are legal Boolean values in pseudocode? False None 0 True \
1) Which of the following are legal Boolean values in pseudocode? False None 0 True \

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site