Questions on Strings, Pointers, Unary Operator

Duration: 17 min

This video lesson is available to enrolled students.

Return to /learn/TCS-NQT-PREPARATION/advanced-coding/c-programming-by-yash-sir/c-language-mcqs/asset-questions-on-strings-pointers-unary-operator 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.

This educational video is a comprehensive lecture on C programming, specifically focusing on the concept of pointers and their manipulation. The video begins with a title slide for a C Programming MCQs session, followed by a brief, humorous interlude featuring a stand-up comedy clip about entrance exam results. The main content then transitions to a detailed analysis of a C code snippet from the TCS NQT 2019 exam. The instructor uses a digital blackboard to visually explain the memory layout of a character array `a` containing the letters 'E', 'X', 'A', 'M'. He defines a character pointer `*ppp` that points to the first element of this array. The core of the lesson is the step-by-step evaluation of the `printf` statement, which contains three expressions: `++ppp`, `--ppp`, and `ppp++`. The instructor demonstrates the right-to-left evaluation order and the side effects of pre- and post-increment/decrement operators on the pointer. He illustrates how the pointer's address changes during the evaluation, leading to the final output of the characters 'M', '@', and 'X'. The video concludes with a final summary of the key concepts and a brief appearance of the instructor in a different setting.

Chapters

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

    The video opens with a title slide for a C Programming MCQs session, featuring a glowing blue keyboard and the text 'C PROGRAMMING MCQs' and 'By YASH JAIN'. This is followed by a slide with a large golden 'C' and a green box labeled 'POINTERS' and 'C Programming'. The instructor, visible in a small window, begins the lecture. The scene then transitions to a humorous clip titled 'Entrance Exam Result' featuring comedian Anubhav Singh Bassi, which is used as a comedic interlude before the main lesson begins.

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

    The video returns to the main lecture, with the instructor now presenting a C code snippet on a dark background. The code is from the TCS NQT 2019 exam and defines a character array `a` with the values {'E', 'X', 'A', 'M'} and a character pointer `*ppp` that points to the first element of the array. The instructor explains the memory layout, showing the array `a` with its elements at addresses 100, 101, 102, and 103. He then begins to analyze the `printf` statement, which contains the expressions `++ppp`, `--ppp`, and `ppp++` as arguments.

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

    The instructor uses a digital blackboard to illustrate the evaluation of the `printf` statement. He writes 'Right to left' to indicate the order of evaluation. He explains that the first expression `++ppp` is evaluated first, which is a pre-increment, so the pointer `ppp` is incremented from address 100 to 101, and the value at the new address (101) is 'X'. The second expression `--ppp` is then evaluated, which is a pre-decrement, so the pointer is decremented back to 100, and the value at address 100 is 'E'. The third expression `ppp++` is a post-increment, so the value at the current address (100) is 'E', and then the pointer is incremented to 101.

  4. 10:00 – 15:00 10:00-15:00

    The instructor continues the analysis, explaining that the `printf` function will print the values obtained from the three expressions in the order they were evaluated. The first value is 'X' (from `++ppp`), the second is 'E' (from `--ppp`), and the third is 'E' (from `ppp++`). However, he then corrects this, stating that the evaluation is right to left, so the first argument is `ppp++`, which returns 'E' and then increments the pointer. The second argument is `--ppp`, which decrements the pointer to 100 and returns 'E'. The third argument is `++ppp`, which increments the pointer to 101 and returns 'X'. The final output is 'E', 'E', 'X'. He then re-evaluates, stating the correct order is `++ppp` (returns 'X'), `--ppp` (returns 'E'), and `ppp++` (returns 'E'). The final output is 'X', 'E', 'E'. He then corrects again, stating the correct output is 'M', '@', 'X'.

  5. 15:00 – 17:11 15:00-17:11

    The instructor provides a final summary of the key concepts. He reiterates that the evaluation of the `printf` statement is from right to left. He explains that the first expression `ppp++` is evaluated first, which returns the value at the current address (100, which is 'E') and then increments the pointer to 101. The second expression `--ppp` is evaluated next, which decrements the pointer to 100 and returns the value at that address ('E'). The third expression `++ppp` is evaluated last, which increments the pointer to 101 and returns the value at that address ('X'). The final output is 'E', 'E', 'X'. He then shows the correct answer is 'M', '@', 'X'. The video ends with the instructor in a different setting, wearing a black t-shirt with 'unacademy' on it.

The video provides a clear and structured lesson on C programming pointers, using a real exam question to illustrate complex concepts. The instructor effectively combines a code snippet with a visual, step-by-step explanation on a digital blackboard to demystify the evaluation order of expressions within a `printf` statement. The key learning points are the right-to-left evaluation of function arguments and the side effects of pre- and post-increment/decrement operators on pointers, which are crucial for understanding the final output of the program. The humorous interlude serves as a break, but the core of the video is a focused, technical analysis that is highly beneficial for students preparing for competitive programming exams.

Loading lesson…