Pointer AMAZON & MICROSOFT Questions

Duration: 13 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-pointer-amazon-microsoft-questions 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 lecture on C programming, specifically focusing on multiple-choice questions (MCQs) related to pointers, a fundamental concept in the language. The video begins with an introduction to the topic, followed by a detailed analysis of two distinct MCQs. The first question, from Amazon 2019, presents a C code snippet that declares an integer variable 'a' and a pointer 'ptr'. The instructor explains the memory layout, showing that 'a' holds the value 36, and 'ptr' is a pointer to 'a', meaning it stores the address of 'a'. The code then uses the printf function with the format specifier '%u' to print the address of 'a' (via &a), the value of 'ptr' (which is the address), and the value pointed to by 'ptr' (which is 36). The instructor demonstrates that the output will be the address, the value 36, and the address again, leading to the correct answer being 'Address Value Address'. The second question, from Microsoft 2019, involves a character pointer 'ptr' initialized with a string literal "Microsoft". The code attempts to print the character at the address stored in 'ptr' using the format specifier '%c'. The instructor explains that the expression '*&*ptr' is equivalent to '*ptr', which dereferences the pointer to get the first character of the string, 'M'. The video concludes with a brief outro from the instructor, who is associated with the 'Knowledge Gate' educational platform.

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, visible in a small window, introduces the topic. The scene then transitions to a new slide with a large golden 'C' and a green box labeled 'POINTERS' with gear icons, setting the stage for the lesson on C programming pointers.

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

    The video displays the first MCQ, which is from Amazon 2019. The code shown is: #include <stdio.h> int main() { int a = 36; int *ptr; ptr = &a; printf("%u %u", &a, *ptr); return 0; } The instructor explains the code step-by-step. He highlights that 'a' is an integer with a value of 36, and 'ptr' is a pointer to an integer. He draws a diagram showing 'a' at memory address 100 with value 36, and 'ptr' at address 200, storing the address 100. He explains that &a is the address of 'a' (100), and *ptr is the value at the address stored in ptr (36). The printf function prints these two values, resulting in '100 36'. The options are: a) Address Value Value, b) Value Address, c) Address Address, d) Compilation error. The instructor concludes that the correct answer is not listed, but the output is '100 36'.

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

    The instructor continues to analyze the first MCQ. He clarifies that the output of the printf statement is the address of 'a' (100) and the value of 'a' (36). He then points out that the question asks for the output of the printf statement, which is '100 36'. He reviews the options and notes that option (a) 'Address Value Value' is the closest, but the second value should be the value of 'a', not the address. He then moves to the second MCQ from Microsoft 2019. The code is: #include <stdio.h> int main() { char *ptr = "Microsoft"; printf("%c", *&*ptr); return 0; } He explains that 'ptr' is a pointer to a character, and it is initialized with the address of the first character of the string "Microsoft". He draws a diagram showing the string in memory and the pointer 'ptr' pointing to the first character 'M'. He explains that the expression *&*ptr is equivalent to *ptr, which dereferences the pointer to get the character 'M'. He concludes that the output will be 'M'.

  4. 10:00 – 12:43 10:00-12:43

    The video shows the second MCQ from Microsoft 2019. The code is: #include <stdio.h> int main() { char *ptr = "Microsoft"; printf("%c", *&*ptr); return 0; } The instructor explains that the expression *&*ptr is a complex way of writing *ptr. He draws a diagram showing the string "Microsoft" in memory and the pointer 'ptr' pointing to the first character 'M'. He explains that *ptr dereferences the pointer to get the character 'M'. The printf function then prints this character. The options are: (A) Compiler Error, (B) Garbage Value, (C) Runtime Error, (D) M. The instructor concludes that the correct answer is (D) M. The video ends with the instructor speaking in front of a white background with the 'KG' logo.

The video provides a structured and clear analysis of two C programming MCQs, focusing on the core concept of pointers. It begins with an introduction to the topic, then systematically breaks down each question. For the first question, it demonstrates the relationship between a variable, its address, and a pointer to that variable, using a diagram to illustrate the memory layout. For the second question, it explains the syntax of pointer dereferencing and how a string literal is stored in memory. The instructor uses a consistent method of drawing diagrams and explaining the logic behind the code, making the complex topic of pointers accessible. The progression from a simple integer pointer to a character pointer with a string literal effectively builds the viewer's understanding of pointer usage in C.

Loading lesson…