Questions on Strings, Pointers, Unary Operator

Duration: 17 min

This video lesson is available to enrolled students.

Return to /learn/ACCENTURE-PREPARATION/coding-assessment-questions/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. Behavioral Assessment (Psychometric): Behavioral Assessment (Behavioral Competency Profiling) (Psychometric Test)
  2. Cognitive Assessment (Game-Based): Gamified / Game Based Aptitude Selection Decision Table (Decision Making) Puzzle Solving (Puzzles) Non Verbal Reasoning (Spatial Aptitude) (Spatial Reasoning) (Visual Reasoning) Analytical Reasoning (Counting Figures Reasoning) Cubes & Dices Coding Decoding Ranking, Order and Sequence Series (Number and Letter Series) (Numerical Relations and Reasoning)
  3. Common Applications & MS Office (Technical Assessment): MS Office by Yash Sir
  4. Pseudo Code (Technical Assessment): Pseudo Codes
  5. Networking, Security & Cloud (Technical Assessment): 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 Emerging Tech Trends
  6. Python (Technical Assessment): Python for Placements by Yash Sir
  7. Java (Technical Assessment): Java
  8. OOPs (Technical Assessment): Object Oriented Programming (OOPS)
  9. Data Structure (Coding Round): Introduction to DS Array Stack Queue Linked List Tree Graphs Hashing
  10. Algorithms (Coding Round): Algorithm Analysis Sorting Algorithms Greedy Algorithms Dynamic Programming Minimum Spanning Trees Shortest Path Algos Time Complexity Analysis Advanced Algorithms
  11. Coding Assessment Questions: C Programming by Yash Sir Coding Questions by Yash Sir Programming in C++
  12. SQL (Coding Round): SQL
  13. JavaScript Frontend (Coding Round): JavaScript
  14. Communication Test (Basic Verbal Ability): Vocabulary Sentence Construction Noun Pronoun Verb Tenses Subject Verb Agreement (Verb Noun Agreement) Articles Preposition Conjunction Adverb Modals Sentence Correction (Error Correction) Sentence Completion (Fill in the blanks) Comprehension / Reading Comprehension / Unseen Passages (Critical Reasoning) (Paragraph Questions) Communication Assessment
  15. HR Interview: MR & HR Interview Preparation
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…