Q9 - Precedence and Associativity

Duration: 3 min

This video lesson is available to enrolled students.

Return to /learn/COGNIZANT-PREPARATION/technical-assessment/programming-in-c/c-by-yash-sir/asset-q9-precedence-and-associativity after enrolling

Inside: a video lesson and guided study material.

Module outline

  1. Communication Round: Vocabulary, Subject Verb Agreement (Verb Noun Agreement), Tenses, Comprehension / Reading Comprehension / Unseen Passages (Critical Reasoning) (Paragraph Questions), Cloze Test (Cloze Passage), Sentence Correction (Error Correction), Sentence Completion (Fill in the blanks), Sentence Re-arrangements (Para Jumbles) (Narrative Sequencing), Direct and Indirect Speech, Active Passive Voice (Voice), Verbal Analogy (Word Based Analogy), Articles, Preposition, Conjunction, Sentence Construction, English Writing Ability, Communication Assessment
  2. Quantitative Aptitude: Ratio and Proportion (Ratios), Divisibility Rules, Data Interpretation, Mixture and Alligation, Permutation and Combination, Logarithm, Number System, HCF LCM, Speed Time and Distance, Percentage, Average, Powers and Exponents (Surds and Indices), Time and Work, Mensuration and Geometry, Age Problems, Pipe and Cistern, Probability, Profit and Loss, Simple Interest and Compound Interest, Algebra
  3. Analytical and Logical Reasoning: Series (Number and Letter Series) (Numerical Relations and Reasoning), Coding Decoding, Data Sufficiency, Non Verbal Reasoning (Spatial Aptitude) (Spatial Reasoning) (Visual Reasoning), Directions (Direction Test), Ranking, Order and Sequence, Deductive and Inductive Reasoning (Logical Deduction and Induction) (Prepositional Reasoning), Selection Decision Table (Decision Making), Logical Sequence Of Words, Puzzle Solving (Puzzles), Syllogisms, Seating Arrangements, Calendar, Clock, Blood Relations, Cubes & Dices, Venn Diagram, Analytical Reasoning (Counting Figures Reasoning)
  4. Cognizant Gaming Aptitude: Gamified / Game Based Aptitude
  5. Java (Cluster 1): Java
  6. ANSI SQL MySQL (Cluster 1,2,3): SQL
  7. HTML, CSS, JavaScript (Cluster 1,3): HTML, CSS, JavaScript
  8. Python (Cluster 2): Python for Placements by Yash Sir
  9. Cloud Fundamentals (Cluster 2): Emerging Tech Trends
  10. C# (Cluster 3): C#
  11. OOPs: Object Oriented Programming (OOPS)
  12. Technical Assessment (Coding): Coding Questions by Yash Sir, C Programming by Yash Sir, Programming in C++, Pseudo Codes
  13. Data Structures: Introduction to DS, Array, Stack, Queue, Linked List, Tree, Graphs, Hashing
  14. DBMS: Basics of DBMS, ER Diagram, Relational Model & Functional Dependencies, Keys & Integrity Constraints, Normalization (1NF - BCNF), Decomposition Properties & 4NF, File Organization & Indexing, Relational Algebra, Relational Calculus, Transaction Management, Concurrency Control, Database Recovery, ORDBMS, Database Security & Authorization, Query Processing & Optimization, Enhanced Data Models, Data Warehousing & Mining, Big Data Systems, NoSQL
  15. Operating Systems: Introduction to OS, Process Management, CPU Scheduling, Process Synchronization, Deadlock, Threads & Process Creation, Memory Management, Virtual Memory, Disc Scheduling, File Management, Windows OS, Linux OS, Security, Distributed Systems, Virtual Machines
  16. Computer Networks: Introduction to CN, Data Communication, DLL: Access Control, DLL: Flow Control, DLL: Error Control, DLL: Framing, Data Link Layer - Ethernet, Net Layer: IPv4 & Proto, Net Layer: IP Addressing, Net Layer:Routing Protocol, Transport Layer Services, TL: Congestion & UDP, Application Layer, Hardware basics, Network Security, Mobile Technology, Cloud Computing and IoT, Cyber and Info Security
AI summary & chapters

AI Summary

An AI-generated summary of this video lecture.

The video presents a programming problem involving the evaluation of a C++ expression, float a = 7 / 22 * (3.14 + 2) * 3 / 5; The instructor first analyzes the expression on a whiteboard, emphasizing the importance of operator precedence and integer division. He demonstrates that the expression 7 / 22 results in 0 due to integer division, which then propagates through the rest of the calculation, leading to a final result of 0.0. To confirm this, he switches to a C++ online compiler, writes the code, and runs it, showing that the output is indeed 0. The lesson highlights a common pitfall in programming where integer division can lead to unexpected results if not handled correctly.

Chapters

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

    The video begins with a question displayed on a whiteboard: 'Q. The expression, float a = 7 / 22 * (3.14 + 2) * 3 / 5; evaluates to:'. The instructor, Yash Jain, a coding expert, starts to solve the problem by analyzing the expression. He writes out the expression and begins to evaluate it step-by-step. He first addresses the division 7 / 22, explaining that since both numbers are integers, this is integer division, which results in 0. He then shows that multiplying 0 by any other number will result in 0, and thus the entire expression evaluates to 0. He writes '0' on the board as the final answer and circles option (4) 0 from the multiple-choice list. He also writes 'PUMA'S REBL TAC' and '1 2 3 4' on the board, which appear to be notes or a mnemonic for the problem.

  2. 2:00 – 2:41 02:00-02:41

    The instructor transitions from the whiteboard to a C++ online compiler to verify his calculation. The screen shows a code editor with the C++ program: #include <iostream> using namespace std; int main() { float a = 7 / 22 * (3.14 + 2) * 3 / 5; cout << a; } He explains that the compiler will execute the code. The program is compiled and run, and the output displayed is 0. This confirms his earlier analysis that the result of the expression is 0.0. The instructor uses this practical demonstration to reinforce the concept that integer division in C++ truncates the decimal part, leading to a result of 0, which then makes the entire expression evaluate to 0.

The video effectively teaches a fundamental concept in C++ programming: the impact of integer division on arithmetic expressions. It follows a clear pedagogical structure, starting with a theoretical analysis on a whiteboard where the instructor breaks down the expression and identifies the key issue (7/22 = 0). This is followed by a practical verification in a live coding environment, which provides concrete evidence for the theoretical explanation. The synthesis of theory and practice reinforces the learning, making it clear that the order of operations and data types are critical in determining the outcome of a calculation.

Loading lesson…