Order PDF of any content from our website with a little minor Fee to donate for hard work. Online MCQs are fully free but PDF books are paid. For details: contact whatsapp +923028700085 Important notes based PDF Books are available in very little price, starting from 500/-PKR; Order Now: contact whatsapp +923028700085

VU Past Papers CS201- Midterm Solved Questions on Operators and Decision Making

Q#1: What is the difference between the assignment operator (=) and the equal to operator (==) in C language?
Answer: The assignment operator = is used to assign a value to a variable, while the equality operator == is used to compare two values in a condition. If = is mistakenly used instead of == in a condition (e.g., if (x = 2)), it assigns the value 2 to x instead of comparing it, which can cause a logical error.


Q#2: Explain the purpose of flow charts in programming and how they aid in program design.
Answer: A flowchart is a graphical representation of a program’s logic using symbols and arrows. It helps programmers understand the sequence of steps in a program, design the program structure, and identify logical errors before writing the actual code.


Q#3: How does the if/else structure work in C programming, and how does it handle different conditions?
Answer: The if/else structure is used for decision making in C. If the condition in the if statement is true, the statements inside the if block are executed. If the condition is false, the statements inside the else block are executed.


Q#4: Explain the usage of logical operators (&& and ||) in C programming with relational operators. Provide an example.
Answer: Logical operators && (AND) and || (OR) are used with relational operators to combine multiple conditions.

  • && returns true only if both conditions are true.
  • || returns true if at least one condition is true.

Example:
if (age > 18 && height > 6) means both conditions must be true.

Contents Copyrights Reserved By T4Tutorials