4 Operators And Expression

C Programming · Unit 4 · 4 hrs

Operators and Expression

Exam-focused notes for Operators and Expression (C Programming, CSC115): what the TU syllabus asks and how it has actually been tested, with 5 solved past questions from this unit.

What this unit covers

  • Arithmetic operator
  • Relational operator
  • Logical or Boolean operator
  • Assignment Operator
  • Ternary operator
  • Bitwise operator
  • Increment or Decrement operator
  • Conditional operator
  • Special Operators (sizeof and comma)
  • Evaluation of Expression
  • Operator Precedence and Associativity

Arithmetic operator

208110 marks

List different types of operators.Explain any four of them[2+8]

An operator is a symbol that specifies an operation to be performed on operands. C includes the following types of operators: 1. Arithmetic Operator 2. Assignment Operator 3. Increment and Decrement Operator 4. Relational Operator 5. Logical Operator 6. Con...

Full solved answer →
20805 marks

List different types of operators and explain any three of them. [5]

An operator specifies an operation to be performed on an operand. The variables and constants can be joined by various operators to form expressions. An operand is a data item on which an operator acts. --- C includes the following types of operators: 1. Ar...

Full solved answer →
20795 marks

How do you swap the values of two integers without using the third temporary variable? Justify with the example. [5]

Normally, swapping two variables requires a third temporary variable. However, we can swap two integers without a temporary variable using either: 1. Arithmetic operators (Addition and Subtraction) 2. Bitwise XOR operator --- Step Operation a b ------------...

Full solved answer →

Logical or Boolean operator

20755 marks

Discuss different logical operations in details. [5]

Logical operators are used to combine two or more conditions (relational expressions) and return a true (1) or false (0) result. They are primarily used in decision-making statements like if, while, and for. --- C provides three logical operators: Operator ...

Full solved answer →

Increment or Decrement operator

20745 marks

Discuss increment and decrement operator with example. [5]

C has two useful operators: increment (++) and decrement (--). These are unary operators because they operate on only a single operand. - The increment operator (++) increments the value of a variable by 1. - The decrement operator (--) decrements the value...

Full solved answer →