Q2 - Precedence and Associativity

Duration: 2 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-q2-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 Puma's Rebl TAC, presented by a coding expert. The instructor first displays a C++ code snippet that defines five integer variables (a=17, b=5, c=6, d=3, e=5) and a complex arithmetic expression within a cout statement. The core of the lesson involves manually evaluating this expression step-by-step, following the standard order of operations (PEMDAS/BODMAS). The instructor breaks down the expression into parts, calculating the modulo operation (a % 6), the division (b / 2), and the multiplication and subtraction within the parentheses (c * d - 5), then combines the results. The final calculation is shown as (17 % 6) - (5 / 2) + ((6 * 3) - 5) / 5, which simplifies to 5 - 2 + 13 / 5, and finally to 3 + 2, resulting in 5. The video concludes with a screen recording of an online C++ compiler where the program is executed, confirming the output is 5.

Chapters

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

    The video begins with a C++ code snippet displayed on a dark background, which includes the standard library and namespace. The main function initializes five integer variables: a=17, b=5, c=6, d=3, and e=5. The core of the code is a cout statement with a complex arithmetic expression: a % 6 - b / 2 + (c * d - 5) / e. The instructor, visible in a circular frame, starts to solve this expression by hand. He first calculates the modulo operation, writing '17 % 6' and then '5' as the result. He then moves to the division, writing '5 / 2' and calculating it as 2. Next, he evaluates the expression within the parentheses, writing '6 * 3 - 5' and calculating it as 18 - 5, which is 13. The expression is now simplified to 5 - 2 + 13 / 5. He then calculates 13 / 5 as 2, and the final expression becomes 5 - 2 + 2, which he simplifies to 3 + 2, resulting in 5. The instructor's handwritten notes on the right side of the screen clearly show each step of the calculation.

  2. 2:00 – 2:18 02:00-02:18

    The video transitions to a screen recording of an online C++ compiler, showing the same code in a text editor. The instructor runs the program, and the console output appears at the bottom of the screen. The output is '5', which matches the result of the manual calculation. The text 'Program finished with exit code 0' is also visible, confirming the program executed successfully. The instructor's face remains visible in the circular frame on the right, and the video ends with the compiler window showing the correct output.

The video provides a comprehensive walkthrough of a C++ arithmetic expression evaluation problem. It effectively combines a theoretical explanation with a practical verification. The instructor first demonstrates the correct application of operator precedence by breaking down the complex expression into its constituent parts, showing the step-by-step calculation on a whiteboard. This pedagogical approach ensures the viewer understands the logic. The lesson is then validated by running the actual code in a compiler, which produces the same result, reinforcing the correctness of the manual calculation and demonstrating the practical application of the concepts.

Loading lesson…