Table of Contents

    Viva Questions - Class 8 - Decision Control Structure

    Viva Questions - Class 8 - Decision Control Structure
    Figure: Viva Questions - Class 8 - Decision Control Structure

    VIVA QUESTIONS — CLASS 8

    Viva Questions — Decision Control Structure

    Be Confident, Be Prepared, Shine in Your Viva! This comprehensive guide contains 20 essential Viva Questions and Answers for your Decision Control Structure oral exam. Read carefully, practice speaking aloud, and you'll ace your viva!

    Introduction

    A Viva Voce is an oral examination where your teacher tests your knowledge through spoken questions. Decision Control Structure viva covers if statements, operators, and best practices — all foundational programming concepts!

    Key to Success: Understand the concepts — don't just memorize. When you understand, you can answer any question with confidence!

    Motivational Tip

    Think of viva as a friendly chat about programming with your teacher. You know this stuff — you just need to speak it out! Take a deep breath, smile, and show your knowledge.

    What is Decision Control Structure?

    A Decision Control Structure is a programming construct that allows a program to make decisions and execute different code based on conditions.

    DECISION FLOW
    ConditionTrue / FalseDifferent Actions

    Key Points to Remember

    Essentials

    • ✅ Makes program smart.
    • ✅ Executes code conditionally.
    • ✅ Uses if, if-else, else-if statements.
    • ✅ Uses comparison operators.
    • ✅ Uses logical operators.
    • ✅ Essential in every program.

    20 Viva Questions and Answers

    Question 1

    1

    What is a decision control statement?

    Fundamental Question

    Answer: A decision control statement is a statement that allows a program to make decisions and execute different code based on conditions.

    Question 2

    2

    What is if statement?

    Definition Question

    Answer: An if statement executes code only if the given condition is true.

    Syntax: if (condition) { statements; }

    Question 3

    3

    What is if-else statement?

    Two-way Decision

    Answer: An if-else statement executes one block of code if the condition is true, and another block if it's false.

    Question 4

    4

    What is nested if?

    Definition Question

    Answer: A nested if is an if statement placed inside another if statement.

    Question 5

    5

    What is else-if ladder?

    Multiple Conditions

    Answer: An else-if ladder is a structure that checks multiple conditions in sequence using else-if blocks.

    Question 6

    6

    What is the syntax of if?

    Syntax Question

    Answer: if (condition) { statements; }
    The condition must be in parentheses, and statements are inside braces.

    Question 7

    7

    What does == operator do?

    Operator Question

    Answer: The == operator compares two values for equality. If both are equal, it returns true; otherwise, false.

    Question 8

    8

    What is the difference between = and ==?

    Comparison Question

    Answer:

    • = is assignment — it assigns a value.
    • == is comparison — it compares two values.

    Question 9

    9

    Name three logical operators.

    Naming Question

    Answer:

    • && — AND
    • || — OR
    • ! — NOT

    Question 10

    10

    What is the use of && operator?

    Logical Operator

    Answer: The && (AND) operator returns true only when both conditions are true.

    Example: if (age >= 18 && hasID)

    Question 11

    11

    What is the use of || operator?

    Logical Operator

    Answer: The || (OR) operator returns true when at least one condition is true.

    Example: if (day.equals("Sat") || day.equals("Sun"))

    Question 12

    12

    What does ! operator do?

    Logical Operator

    Answer: The ! (NOT) operator reverses the condition — TRUE becomes FALSE and vice versa.

    Example: if (!(x == 0)) means "if x is not equal to zero".

    Question 13

    13

    Give one comparison operator.

    Naming Question

    Answer: Common comparison operators are: > (greater than), < (less than), >= (greater than or equal to), <= (less than or equal to), == (equal to), != (not equal to). Give any one!

    Question 14

    14

    What is a Boolean expression?

    Concept Question

    Answer: A Boolean expression is an expression that evaluates to either true or false.

    Example: (x > 5) is a Boolean expression.

    Question 15

    15

    Why do we use braces { } in if?

    Best Practice

    Answer: We use braces to group multiple statements together. Even for a single statement, using braces is a best practice — it prevents bugs when we add more code later.

    Question 16

    16

    Can we use if without else?

    Concept Question

    Answer: Yes, the else block is optional. If only if is used, nothing happens when the condition is false.

    Question 17

    17

    When does else block execute?

    Behavior Question

    Answer: The else block executes only when the if condition is false.

    Question 18

    18

    What is a common error in decision statements?

    Common Mistake

    Answer: The most common error is using = (assignment) instead of == (comparison). For example, if (x = 5) assigns 5 to x instead of comparing!

    Question 19

    19

    Give an example of if-else in real life.

    Real-World Example

    Answer: "If it rains, take an umbrella. Else, don't take one." This is a real-life if-else decision.

    Other examples: "If age is 18 or above, allow to vote. Else, don't allow."

    Question 20

    20

    What is the output when age = 18 and we check age >= 18?

    Application Question

    Answer: The output is TRUE — because 18 is equal to 18, the condition age >= 18 is satisfied.

    Quick Code Examples

    Example 1: if Statement

    if (age >= 18) {
        System.out.println("Adult");
    }

    Example 2: if-else Statement

    if (num > 0) {
        System.out.println("Positive");
    } else {
        System.out.println("Non-positive");
    }

    Example 3: else-if Ladder

    if (marks >= 90) {
        grade = "A";
    } else if (marks >= 75) {
        grade = "B";
    } else {
        grade = "C";
    }

    Example 4: Nested if

    if (age >= 18) {
        if (hasID) {
            System.out.println("Can vote");
        }
    }

    Example 5: Logical Operators

    // AND
    if (age >= 18 && hasID) {
        System.out.println("Eligible");
    }
    
    // OR
    if (day.equals("Sat") || day.equals("Sun")) {
        System.out.println("Weekend");
    }
    
    // NOT
    if (!isRaining) {
        System.out.println("Go out!");
    }

    Viva Preparation Tips

    Before the Viva

    • 💡 Understand concepts, don't just memorize.
    • 🎤 Practice speaking answers aloud.
    • 💬 Give examples for each concept.
    • 💻 Show sample code when asked.
    • 😊 Be confident and smile.
    • 🙋 Ask if you don't understand.
    • 🙏 Thank the teacher after viva.
    • 📚 Review your practical activities.

    During the Viva

    Confidence Tips

    • 😊 Smile and greet politely.
    • 👂 Listen to the full question.
    • 💭 Take a moment to think.
    • 🎤 Speak clearly and confidently.
    • 👀 Maintain eye contact.
    • 🎯 Give short, focused answers.
    • 💻 Give code examples when possible.
    • 🙏 Say "I'm not sure" if unsure — don't guess wildly.
    • 💪 Stay calm if you make a mistake.
    • 🙌 Thank the teacher at the end.

    Common Mistakes to Avoid

    Don't Do These!

    • ❌ Confusing = with ==
    • ❌ Forgetting else block
    • ❌ Missing braces { }
    • ❌ Wrong operator use
    • ❌ Not testing edge cases
    • ❌ Memorizing without understanding
    • ❌ Being too nervous
    • ❌ Not giving examples

    Bonus Viva Questions

    Extra Practice

    • Q. What is a conditional statement? → A statement that executes based on a condition.
    • Q. What is a switch statement? → An alternative to else-if ladder for multi-way branching.
    • Q. What is the modulo operator (%)? → Gives the remainder of division.
    • Q. How do you check if a number is even? → Use `if (num % 2 == 0)`.
    • Q. What is short-circuit evaluation? → In &&, if first is false, second isn't checked.
    • Q. Can if-else be replaced with ternary operator? → Yes, using `? :` syntax.
    • Q. What's the ternary operator? → `condition ? valueIfTrue : valueIfFalse`.
    • Q. What's a truth table? → A table showing all possible outcomes of logical operations.
    • Q. Which is faster: if-else or switch? → Switch is often faster for many conditions.
    • Q. What's a dangling else? → An else that could match multiple ifs (use braces to fix).

    Did You Know?

    Fun Fact

    Decision statements are used everywhere — games, apps, banking systems, weather apps, ATM machines, traffic lights! Every "if this, then that" in software uses decision statements. You're learning something universal!

    Sample Viva Conversation

    Example Scenario

    Teacher: "Good morning! What is a decision control statement?"

    You: "Good morning, ma'am. A decision control statement allows a program to make decisions and execute different code based on conditions."

    Teacher: "Give me an example."

    You: "Yes, ma'am. For example, we can write: if (age >= 18) print('Adult'); This checks if age is 18 or more, and if true, prints Adult."

    Teacher: "Excellent! What's the difference between = and ==?"

    You: "= is assignment, which gives a value to a variable. == is comparison, which checks if two values are equal."

    Teacher: "Well done!"

    FAQs About Viva

    Q1. How long is the viva?

    Typically 5-15 minutes per student, covering key concepts.

    Q2. What if I don't know an answer?

    Say politely: "I'm not sure, ma'am/sir" — don't guess wildly. It's better to be honest than wrong.

    Q3. Should I memorize all the code?

    No! Understand the concepts. If you understand, you can write code on the spot.

    Q4. Can I take my code notes?

    Usually not. Practice writing simple examples from memory.

    Q5. What if the teacher asks a follow-up question?

    Listen carefully and answer to the best of your ability. Take a moment to think.

    Q6. Should I speak in English?

    Yes, generally. But use your first language if you feel stuck for a technical term — the teacher will understand.

    Q7. How do I overcome nervousness?

    Deep breaths, practice with friends, remember the teacher wants you to succeed!

    Q8. What if I make a mistake?

    Stay calm. Correct yourself politely: "Actually, I think it's..." Show you can self-correct.

    Key Takeaways

    • Decision statements make decisions in programs.
    • Types: if, if-else, nested if, else-if ladder.
    • Comparison operators: ==, !=, >, <, >=, <=.
    • Logical operators: && (AND), || (OR), ! (NOT).
    • = is assignment, == is comparison.
    • Use braces { } for grouping statements.
    • else block is optional.
    • Practice speaking answers aloud.
    • Give examples during viva.
    • Be confident and smile!

    Key Takeaway

    Prepare well, be confident, and speak clearly! You will shine in your viva!

    Decision control structures are the foundation of programming. Master them, and you'll be able to write any complex program. Your viva is a chance to show what you've learned — go for it!

    Remember: Learn Today, Lead Tomorrow! Practice Makes Perfect! 🌟

    CODE SMART, THINK CLEAR, WRITE BETTER!

    Best of Luck! Take a deep breath. Smile. Answer confidently. You will do great! 👍😊

    Flowchart → Visual Thinking → Smart Solutions → Better Results! 🚀