Tricky TCS Previous Year Pseudo Code Problem on FOR LOOP
Duration: 6 min
This video lesson is available to enrolled students.
Inside: a video lesson and guided study material.
Module outline
- Quantitative Ability: Percentage, Profit and Loss, Ratio and Proportion (Ratios), Average, Time and Work, Speed Time and Distance, Simple Interest and Compound Interest, Age Problems, Number System, Divisibility Rules, HCF LCM, Algebra, Permutation and Combination, Probability, Data Interpretation, Logarithm, Sequence and Series (Series), Powers and Exponents (Surds and Indices), Speed Mathematics and Basic Mathematics
- Logical Reasoning: Seating Arrangements, Puzzle Solving (Puzzles), Data Arrangement, Coding Decoding, Blood Relations, Directions (Direction Test), Ranking, Order and Sequence, Data Sufficiency, Venn Diagram, Inequality, Series (Number and Letter Series) (Numerical Relations and Reasoning), Logical Sequence Of Words, Deductive and Inductive Reasoning (Logical Deduction and Induction) (Prepositional Reasoning), Selection Decision Table (Decision Making), Analogy, Non Verbal Reasoning (Spatial Aptitude) (Spatial Reasoning) (Visual Reasoning)
- Verbal Ability: Comprehension / Reading Comprehension / Unseen Passages (Critical Reasoning) (Paragraph Questions), Subject Verb Agreement (Verb Noun Agreement), Tenses, Articles, Preposition, Conjunction, Modals, Active Passive Voice (Voice), Direct and Indirect Speech, Vocabulary, Sentence Re-arrangements (Para Jumbles) (Narrative Sequencing), Sentence Completion (Fill in the blanks), Sentence Correction (Error Correction), Cloze Test (Cloze Passage), Facts, Inference and Judgements
- Programming Fundamentals (Technical): C Fundamentals
- Data Structures (Technical): Introduction to DS, Array, Stack, Queue, Linked List, Tree, Graphs, Hashing
- Algorithms (Technical): Algorithm Analysis, Sorting Algorithms, Greedy Algorithms, Dynamic Programming, Minimum Spanning Trees, Shortest Path Algos, Time Complexity Analysis, Advanced Algorithms
- OOPs (Technical): Object Oriented Programming (OOPS)
- DBMS (Technical): 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
- SQL (Technical): SQL
- Operating Systems (Technical): 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
- Computer Networks (Technical): 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, Cloud Computing and IoT, Cyber and Info Security
- Software Engineering (Technical): Fundamentals of Software Engineering, Software Requirements and Quality Assurance, Software Design, Estimation and Metrics, Software Testing, Software Maintenance and Configuration Management
- Coding/Automata Round: Coding Questions by Yash Sir, C Programming by Yash Sir, Programming in C++, Java, Python for Placements by Yash Sir, Pseudo Codes
- Personality / Behavioral Assessment: Behavioral Assessment (Behavioral Competency Profiling) (Psychometric Test)
- Writing Assessment: English Writing Ability
AI summary & chapters
AI Summary
An AI-generated summary of this video lecture.
This educational video is a lecture on pseudocode, specifically focusing on a multiple-choice question (MCQ) from the TCS Multiple Times exam. The instructor, Yash Jain, presents a piece of pseudocode involving a for loop with a decrementing variable and a print statement. The core of the lesson is a step-by-step analysis of the code's behavior, where the instructor uses a blackboard to simulate the loop's execution, showing the value of the variable 'n' changing from 3 to 1, then to -1, and so on, demonstrating an infinite loop. The video also includes a practical demonstration using an online C compiler to show the actual output, which is a continuous stream of numbers. The video concludes with a brief appearance of the instructor in a different setting, wearing a shirt with the 'unacademy' logo.
Chapters
0:00 – 2:00 00:00-02:00
The video opens with a title slide for a lecture on 'PSEUDO CODE MCQs' by Yash Jain. The instructor introduces a multiple-choice question from the TCS Multiple Times exam, which presents a pseudocode snippet. The code is displayed on a black background and reads: 'Integer n n=3; n!=0; n-- Print n n = n - 1 end For'. The instructor states the task is to 'Predict behaviour/output of the above pseudo code code'. The slide also contains a copyright notice for Knowledge Gate Eduventures and a URL for their online platform.
2:00 – 5:00 02:00-05:00
The instructor begins to analyze the pseudocode. He explains that the loop starts with n=3 and continues as long as n is not equal to 0. He demonstrates the first iteration, showing that n is printed as 3, then n is decremented to 2. He continues this process, writing the values 1 and -1 on the blackboard, indicating the loop will continue. He points out that since the loop condition is n!=0 and n is being decremented, it will never reach 0, leading to an infinite loop. He then transitions to a practical demonstration, opening an online C compiler where he types the equivalent C code. He runs the code, and the output console shows a continuous stream of numbers, confirming the infinite loop behavior.
5:00 – 6:08 05:00-06:08
The video returns to the blackboard for a final summary of the analysis. The instructor circles the loop condition 'n!=0' and the decrement operation 'n--', emphasizing that because the loop decrements by 1, it will skip over 0 and continue indefinitely. He writes 'Infinite' on the board to denote the loop's behavior. The video then cuts to a different scene where the instructor is standing in front of a white background with the 'KGYT' logo, wearing a black t-shirt with the 'unacademy' logo, and appears to be concluding the session.
The video provides a comprehensive analysis of a pseudocode MCQ, combining theoretical explanation with a practical demonstration. The instructor first presents the problem, then uses a step-by-step simulation on a blackboard to illustrate the loop's execution, highlighting the critical detail that the loop will run infinitely because the variable 'n' decrements past 0. This theoretical analysis is then validated by running the equivalent C code in an online compiler, which produces the expected infinite output. The lesson effectively teaches students to carefully analyze loop conditions and variable updates to predict program behavior, especially for edge cases like infinite loops.

