Having multiple condition inside a loop

Duration: 14 min

This video lesson is available to enrolled students.

Return to /learn/NIACL-AO-IT-SPECIALIST/c-concepts-mcqs/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. Quantitative Aptitude: Ratio and Proportion (Ratios), Data Interpretation, Mixture and Alligation, Permutation and Combination, Number System, Sequence and Series (Series), Speed Time and Distance, Speed Mathematics and Basic Mathematics, Algebra, Percentage, Profit and Loss, Simple Interest and Compound Interest, Powers and Exponents (Surds and Indices), Time and Work, Mensuration and Geometry, Partnership
  2. Reasoning Ability: Series (Number and Letter Series) (Numerical Relations and Reasoning), Coding Decoding, Data Sufficiency, Seating Arrangements, Deductive and Inductive Reasoning (Logical Deduction and Induction) (Prepositional Reasoning), Directions (Direction Test), Ranking, Order and Sequence, Syllogisms, Blood Relations, Puzzle Solving (Puzzles), Inequality, Machine Input-Output
  3. English Language: Vocabulary, Noun, Subject Verb Agreement (Verb Noun Agreement), Adjectives, 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), Sentence Construction, Pronoun, Preposition, Conjunction, Adverb, Verb, Modals, Articles, Determiner, Interjection
  4. General Awareness: Evolution of Indian Banking (Banking & Financial Awareness), GK- Current Affairs, Static General Knowledge, Indian Economy
  5. C Concepts + MCQs (IT Specialist): C Programming by Yash Sir, C Language Core
  6. Java (IT Specialist): Java
  7. Python (IT Specialist): Python for Placements by Yash Sir, Python Basics
  8. OOPs (IT Specialist): Object Oriented Programming (OOPS)
  9. DBMS (IT Specialist): 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
  10. SQL (IT Specialist): SQL
  11. Software Engineering (IT Specialist): Fundamentals of Software Engineering, Software Requirements and Quality Assurance, Software Design, Estimation and Metrics, Software Testing, Software Maintenance and Configuration Management
  12. Data Structure (IT Specialist): Introduction to DS, Array, Stack, Queue, Linked List, Tree, Graphs, Hashing
  13. Operating System (IT Specialist): 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
  14. Compiler Design (IT Specialist): Intro to Compilers, Lexical Analysis, Grammar & CFG, Syntax Analysis: Top-Down, Syntax Analysis: Bottom-Up, Semantic Analysis & SDT, Intermediate Code Gen, Code Optimization, Run Time Environment
  15. Computer Architecture (IT Specialist): Basics of COA, Floating Point Rep, Cache Memory Organization, Input Output Organisation, Pipelining, Instr Formats & Modes, Control Unit Design, Register Transfer and Microoperations, Multiprocessors, Programming the Basic Computer
  16. Data Communication & Networking (IT Specialist): 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
  17. Descriptive Test (Main Exam): English Writing Ability
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…