Having multiple condition inside a loop

Duration: 14 min

This video lesson is available to enrolled students.

Return to /learn/DELOITTE-NLA/technical-skills-coding/c-programming-by-yash-sir/c-language-mcqs/asset-having-multiple-condition-inside-a-loop after enrolling

Inside: a video lesson and guided study material.

Module outline

  1. Language Skills (English): Vocabulary Verbal Analogy (Word Based Analogy) Noun Pronoun Verb Adjectives Adverb Preposition Articles Conjunction Tenses Modals Subject Verb Agreement (Verb Noun Agreement) Determiner Active Passive Voice (Voice) Direct and Indirect Speech Sentence Correction (Error Correction) Sentence Completion (Fill in the blanks) Sentence Construction Sentence Re-arrangements (Para Jumbles) (Narrative Sequencing) Comprehension / Reading Comprehension / Unseen Passages (Critical Reasoning) (Paragraph Questions) Cloze Test (Cloze Passage)
  2. General Aptitude (Quantitative Ability): Percentage Ratio and Proportion (Ratios) Average Profit and Loss Simple Interest and Compound Interest Time and Work Pipe and Cistern Speed Time and Distance Mixture and Alligation Age Problems Partnership Number System HCF LCM Divisibility Rules Powers and Exponents (Surds and Indices) Algebra Data Interpretation Statistics Sequence and Series (Series) Logarithm Arithmetic
  3. General Aptitude (Reasoning Ability): Series (Number and Letter Series) (Numerical Relations and Reasoning) Coding Decoding Syllogisms Blood Relations Directions (Direction Test) Ranking, Order and Sequence Inequality Logical Sequence Of Words Seating Arrangements Puzzle Solving (Puzzles) Non Verbal Reasoning (Spatial Aptitude) (Spatial Reasoning) (Visual Reasoning) Cubes & Dices Venn Diagram Deductive and Inductive Reasoning (Logical Deduction and Induction) (Prepositional Reasoning) Selection Decision Table (Decision Making) Analytical Reasoning (Counting Figures Reasoning) Clock Calendar Data Sufficiency Analogy
  4. Technical Skills MCQ - Data Structure: Introduction to DS Array Stack Queue Linked List Tree Graphs Hashing
  5. Technical Skills MCQ - Networking: 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 Application Layer Network Security
  6. Technical Skills MCQ - Operating System: Introduction to OS Process Management CPU Scheduling Process Synchronization Deadlock Threads & Process Creation Memory Management Virtual Memory File Management Windows OS Linux OS Security Virtual Machines
  7. Technical Skills MCQ - DBMS: Basics of DBMS ER Diagram Relational Model & Functional Dependencies Keys & Integrity Constraints Normalization (1NF - BCNF) File Organization & Indexing Relational Algebra SQL Transaction Management Concurrency Control Database Recovery Database Security & Authorization NoSQL
  8. Technical Skills MCQ - Software Engineering: Fundamentals of Software Engineering Software Requirements and Quality Assurance Software Design, Estimation and Metrics Software Testing Software Maintenance and Configuration Management
  9. Technical Skills MCQ - Cloud Computing: Cloud Computing and IoT
  10. Technical Skills MCQ - Cyber Security: Cyber and Info Security Security in Mobile and Wireless Computing
  11. Technical Skills (Coding): Coding Questions by Yash Sir C Programming by Yash Sir Programming in C++ Java Python for Placements by Yash Sir Object Oriented Programming (OOPS) DSA by Prashant sir Coding Questions Bank
AI summary & chapters

AI Summary

An AI-generated summary of this video lecture.

This educational video is a lecture on C programming, specifically focusing on multiple-choice questions (MCQs) related to loops, which are a common topic in competitive exams like GATE and TCS NQT. The instructor, Yash Jain, begins with an introduction to the topic, followed by a detailed analysis of a C code snippet that uses a 'for' loop with a 'double' variable. He explains that due to floating-point precision issues, the loop condition `k < 3.0` may never become false, leading to an infinite loop, which is the correct answer. The video then transitions to another MCQ involving a 'while' loop with a comma operator in the condition, which is syntactically incorrect. The instructor demonstrates that the comma operator evaluates to the last expression, making the condition `j < 10`, but the syntax of the 'while' loop is invalid because it lacks a proper condition. The final segment shows a third MCQ from TCS NQT 2019, where the instructor analyzes a 'while' loop with a comma operator in the condition, correctly identifying it as a syntax error. The video uses a digital blackboard for code and explanations, with the instructor providing a clear, step-by-step walkthrough of each problem.

Chapters

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

    The video opens with a title slide for a C programming MCQs lecture by Yash Jain. The slide features a glowing blue keyboard and a small diagram of a presentation screen. The instructor then transitions to a new slide with a large golden 'C' and a laptop displaying 'Loops in C'. The main content area shows a C code snippet with a 'for' loop using a 'double' variable 'k'. The instructor begins to analyze the code, pointing out the loop condition `k < 3.0` and the increment `k++`. He explains that the loop will run infinitely because of floating-point precision issues, where the value of 'k' may never exactly reach 3.0, making the condition always true. The options for the MCQ are listed below the code.

  2. 2:00 – 5:00 02:00-05:00

    The instructor continues to analyze the first MCQ. He writes on the digital blackboard, explaining the loop's behavior. He notes that the loop starts with `k = 0.0` and increments by 1.0 each time. He demonstrates that the loop will run for `k = 0.0, 1.0, 2.0`, but when `k` becomes `3.0`, the condition `k < 3.0` is false, so the loop should terminate. However, he points out that due to floating-point representation, `k` might be `2.999999` or `3.000001`, which could cause the loop to run one more time or never terminate. He concludes that the loop will run infinitely, making option (b) the correct answer. He then moves to the next MCQ, which involves a 'while' loop with a comma operator in the condition.

  3. 5:00 – 10:00 05:00-10:00

    The instructor analyzes the second MCQ, which contains a 'while' loop with the condition `i<5,j<10`. He explains that the comma operator evaluates the left expression, then the right, and returns the value of the right expression. Therefore, the condition becomes `j<10`. However, he points out that the syntax of the 'while' loop is incorrect because the condition is not properly enclosed in parentheses. He writes on the board, showing that the correct syntax should be `while (i<5, j<10)`. He concludes that this is a syntax error, making option (a) the correct answer. He then moves to the third MCQ, which is from TCS NQT 2019.

  4. 10:00 – 14:09 10:00-14:09

    The instructor presents the third MCQ, which is from TCS NQT 2019. The code shows a 'while' loop with the condition `i=5,j<10`. He explains that the comma operator evaluates the left expression `i=5` (which assigns 5 to i) and then the right expression `j<10`, returning the value of the right expression. However, he points out that the syntax is incorrect because the condition is not properly enclosed in parentheses. He writes on the board, showing that the correct syntax should be `while (i=5, j<10)`. He concludes that this is a syntax error, making option (a) the correct answer. The video ends with the instructor summarizing the key points and encouraging students to practice more MCQs.

The video provides a comprehensive analysis of C programming MCQs related to loops, focusing on common pitfalls and syntax errors. The instructor systematically breaks down each problem, using a digital blackboard to illustrate the logic and code execution. The key learning points are the importance of understanding floating-point precision in loop conditions and the correct syntax for using the comma operator within control structures. The progression from a conceptual problem (infinite loop due to precision) to a syntactic problem (incorrect loop condition) effectively demonstrates the range of issues students might encounter in competitive exams.

Loading lesson…