0% found this document useful (0 votes)
5 views4 pages

Cond STMT Pseudocode

The document contains a series of pseudocode tasks that demonstrate basic programming concepts such as conditional statements (IF, ELSE IF, ELSE) for various scenarios including temperature checks, even/odd number identification, grade evaluation, age group identification, and password checking. Additionally, it includes critical thinking questions that address common logical errors in pseudocode and the importance of covering all possible input cases with appropriate conditions. Each task is structured to provide a clear example of how to implement conditional logic in programming.

Uploaded by

vijayalakshmie
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
5 views4 pages

Cond STMT Pseudocode

The document contains a series of pseudocode tasks that demonstrate basic programming concepts such as conditional statements (IF, ELSE IF, ELSE) for various scenarios including temperature checks, even/odd number identification, grade evaluation, age group identification, and password checking. Additionally, it includes critical thinking questions that address common logical errors in pseudocode and the importance of covering all possible input cases with appropriate conditions. Each task is structured to provide a clear example of how to implement conditional logic in programming.

Uploaded by

vijayalakshmie
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 4

✅ Task 1: Temperature Check (IF)

Question:
Write a pseudocode that checks if the temperature is above 30. If yes, display “It’s hot!”

Answer:

START

INPUT temperature

IF temperature > 30 THEN

DISPLAY "It's hot!"

ENDIF

STOP

✅ Task 2: Check Even or Odd (IF ELSE)

Question:
Write pseudocode to check whether a number is even or odd.

Answer:

START

INPUT number

IF number MOD 2 = 0 THEN

DISPLAY "Even"

ELSE

DISPLAY "Odd"

ENDIF

STOP

✅ Task 3: Grade Evaluation (ELSE IF)

Question:
Write pseudocode to display grades based on marks:

 90 and above → "A"

 75 to 89 → "B"

 50 to 74 → "C"

 Below 50 → "Fail"
Answer:

START

INPUT marks

IF marks >= 90 THEN

DISPLAY "A"

ELSE IF marks >= 75 THEN

DISPLAY "B"

ELSE IF marks >= 50 THEN

DISPLAY "C"

ELSE

DISPLAY "Fail"

ENDIF

STOP

✅ Task 4: Age Group Identifier (ELSE IF)

Question:
Write pseudocode to identify age group:

 Below 13 → "Child"

 13 to 19 → "Teenager"

 20 and above → "Adult"

Answer:

START

INPUT age

IF age < 13 THEN

DISPLAY "Child"

ELSE IF age <= 19 THEN

DISPLAY "Teenager"

ELSE

DISPLAY "Adult"

ENDIF

STOP
✅ Task 5: Password Checker (IF ELSE)

Question:
Write pseudocode to check if the entered password is correct. Assume correct password is 1234.

Answer:

pgsql

CopyEdit

START

INPUT password

IF password = 1234 THEN

DISPLAY "Access Granted"

ELSE

DISPLAY "Access Denied"

ENDIF

STOP

CRITICAL THINKING QUESTIONS

❓ Question 1:

A student writes this pseudocode to check the grade:

F marks >= 50 THEN

DISPLAY "Pass"

ELSE IF marks >= 75 THEN

DISPLAY "Merit"

ELSE

DISPLAY "Fail"

Q: What is wrong with this logic? How would you fix it?
Expected Thinking: Identify ordering issues in conditions.

Sample Answer:
The conditions are in the wrong order. Once marks >= 50 is true, the program will never check if
marks >= 75. It should check the highest condition first:

sql

CopyEdit
IF marks >= 75 THEN

DISPLAY "Merit"

ELSE IF marks >= 50 THEN

DISPLAY "Pass"

ELSE

DISPLAY "Fail"

❓ Question 2:

You are designing a program to check driving eligibility. The rule is:

 18 and above: "Eligible to drive"

 Below 18: "Not eligible"

Q: What would happen if you forget the ELSE part? Why is it important to include both branches?

Sample Answer:
If you forget the ELSE part, the program will only display a message for people who are 18 or older.
It won't show anything for people under 18. Including ELSE ensures all possible inputs are handled.

❓ Question 3:

Consider the pseudocode:

sql

CopyEdit

IF score > 90 THEN

DISPLAY "Excellent"

ELSE IF score > 80 THEN

DISPLAY "Very Good"

ELSE IF score > 70 THEN

DISPLAY "Good"

Q: What will the program display if the score is 65? What is missing here?

Sample Answer:
The program will not display anything if the score is 65, because there is no ELSE condition to
handle scores 70 and below. An ELSE should be added to cover that case.

You might also like