Q1 - Precedence and Associativity

Duration: 3 min

This video lesson is available to enrolled students.

Return to /learn/TCS-NQT-PREPARATION/advanced-coding/programming-in-c/c-by-yash-sir/asset-q1-precedence-and-associativity after enrolling

Inside: a video lesson and guided study material.

Module outline

  1. TCS One Shot Free Videos & Notes: TCS Preparation
  2. Numerical Ability (Foundation Section): Ratio and Proportion (Ratios), Divisibility Rules, Data Interpretation, Mixture and Alligation, Permutation and Combination, Logarithm, Number System, HCF LCM, Sequence and Series (Series), Speed Time and Distance, Percentage, Average, Powers and Exponents (Surds and Indices), Algebra, Probability, Profit and Loss, Simple Interest and Compound Interest, Time and Work, Pipe and Cistern, Mensuration and Geometry, Mental Ability, Age Problems, Statistics, Arithmetic, Partnership, Speed Mathematics and Basic Mathematics
  3. Reasoning Ability (Foundation Section): Series (Number and Letter Series) (Numerical Relations and Reasoning), Coding Decoding, Data Sufficiency, Non Verbal Reasoning (Spatial Aptitude) (Spatial Reasoning) (Visual Reasoning), Syllogisms, Deductive and Inductive Reasoning (Logical Deduction and Induction) (Prepositional Reasoning), Seating Arrangements, Blood Relations, Directions (Direction Test), Analytical Reasoning (Counting Figures Reasoning), Puzzle Solving (Puzzles), Calendar, Clock, Cubes & Dices, Selection Decision Table (Decision Making), Crypt Arithmetic, Venn Diagram, Data Arrangement, Inequality, Analogy, Ranking, Order and Sequence, Logical Sequence Of Words
  4. New Pattern-Verbal Ability (Foundation Section): Sentence Completion (Fill in the blanks), English Writing Ability
  5. Old Pattern-Verbal Ability (Foundation Section): Vocabulary, Noun, Subject Verb Agreement (Verb Noun Agreement), Adjectives, Tenses, Pronoun, Preposition, Articles, Direct and Indirect Speech, Conjunction, Modals, Sentence Re-arrangements (Para Jumbles) (Narrative Sequencing), Sentence Correction (Error Correction), Comprehension / Reading Comprehension / Unseen Passages (Critical Reasoning) (Paragraph Questions), Verbal Analogy (Word Based Analogy), Active Passive Voice (Voice), Determiner, Facts, Inference and Judgements, Adverb, Cloze Test (Cloze Passage), Sentence Construction, Verb
  6. Advanced Quantitative Ability: TCS NQT Advanced Quantitative Ability
  7. Advanced Reasoning Ability: TCS NQT Advanced Reasoning Ability
  8. Advanced Coding: Coding Questions by Yash Sir, C Programming by Yash Sir, Python for Placements by Yash Sir, DSA using Python, Object Oriented Programming (OOPS), Programming in C++, Java
  9. TCS Full Length Mock Test:
  10. TCS Interview & Resume Prep: MR & HR Interview Preparation, TCS Interview Preparation, Mock Interview, Interview Recordings, Resume Preparation, Resume Review
  11. Mega Test:
  12. Grand Test:
AI summary & chapters

AI Summary

An AI-generated summary of this video lecture.

The video is a tutorial on solving a C++ programming problem from a Puma's Rebl Tech coding challenge. The instructor, Yash Jain, presents a C++ code snippet that calculates a complex arithmetic expression involving variables a through f. He then methodically breaks down the expression, applying the rules of operator precedence (parentheses, multiplication, division, addition, subtraction) to solve it step-by-step on a whiteboard. The final result of the calculation is determined to be 10. The video concludes with a demonstration of the code running in an online compiler, which confirms the result by outputting 10.

Chapters

  1. 0:00 – 2:00 00:00-02:00

    The video opens with a C++ code snippet displayed in a dark-themed editor. The code defines variables a=8, b=4, c=2, d=1, e=5, f=20 and contains a single cout statement with a complex arithmetic expression: `a + b - (c + d) * 3 % e + f / 9;`. The instructor, Yash Jain, begins to solve this expression by first substituting the variable values, writing `8 + 4 - (2 + 1) * 3 % 5 + 20 / 9` on a whiteboard. He then proceeds to evaluate the expression step-by-step, starting with the parentheses `(2 + 1)` which equals 3, resulting in `8 + 4 - 3 * 3 % 5 + 20 / 9`. He then evaluates the multiplication `3 * 3` to get 9, leading to `8 + 4 - 9 % 5 + 20 / 9`. The instructor then evaluates the modulus operation `9 % 5`, which is 4, and the division `20 / 9`, which is 2 (due to integer division), resulting in the expression `8 + 4 - 4 + 2`. The on-screen text includes the code link `https://onlinegdb.com/sLZ1jinZN` and the instructor's name and credentials.

  2. 2:00 – 3:13 02:00-03:13

    The instructor continues the step-by-step evaluation of the arithmetic expression on the whiteboard. He simplifies the expression `8 + 4 - 4 + 2` by performing the addition and subtraction from left to right. First, `8 + 4` equals 12, resulting in `12 - 4 + 2`. Then, `12 - 4` equals 8, resulting in `8 + 2`. Finally, `8 + 2` equals 10. The instructor confirms the final answer is 10. The video then transitions to a screen recording of the online GDB compiler, where the same C++ code is executed. The console output clearly shows the result `10`, confirming the manual calculation. The instructor's name, Yash Jain, and his title as a Coding Expert are visible in a circular frame on the right.

The video provides a comprehensive walkthrough of a C++ coding problem, emphasizing the practical application of operator precedence. It begins with a complex expression and systematically breaks it down into manageable steps, demonstrating the correct order of operations (parentheses, multiplication/division/modulus, then addition/subtraction). The instructor's methodical approach, combining manual calculation on a whiteboard with a live code execution in a compiler, reinforces the learning process and validates the final answer, making it a clear and effective tutorial for understanding basic arithmetic in programming.

Loading lesson…