Practice Set 6 (Tuple , Dictionary) Q11-20

Duration: 12 min

This video lesson is available to enrolled students.

Return to /learn/DSSSB-TGT-COMPUTER-SCIENCE-COMPLETE-COURSE/python-language/collections-strings/dictionaries/asset-practice-set-6-tuple-dictionary-q11-20 after enrolling

Inside: a video lesson and guided study material.

Module outline

  1. About Course: About the Course
  2. Section A: General Awareness: Polity, Physics, Biology, Chemistry, Static General Knowledge, History, Geography, Indian Economy, GK- Current Affairs, Evolution of Indian Banking (Banking & Financial Awareness), Environment
  3. Section A: General Intelligence & Reasoning ability: Series (Number and Letter Series) (Numerical Relations and Reasoning), Coding Decoding, Data Sufficiency, Non Verbal Reasoning (Spatial Aptitude) (Spatial Reasoning) (Visual Reasoning), Analytical Reasoning (Counting Figures Reasoning), Blood Relations, Syllogisms, Deductive and Inductive Reasoning (Logical Deduction and Induction) (Prepositional Reasoning), Seating Arrangements, Directions (Direction Test), Puzzle Solving (Puzzles), Calendar, Clock, Cubes & Dices, Selection Decision Table (Decision Making), Logical Sequence Of Words, Crypt Arithmetic, Venn Diagram, Data Arrangement, Inequality, Analogy, Ranking, Order and Sequence, TCS NQT Advanced Reasoning Ability
  4. Section A: Arithmetical & Numerical Ability: 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, Profit and Loss, Simple Interest and Compound Interest, Time and Work, Pipe and Cistern, Mensuration and Geometry, Powers and Exponents (Surds and Indices), Algebra, Probability, Mental Ability, Age Problems, Partnership, Statistics, Arithmetic, Speed Mathematics and Basic Mathematics, Miscellaneous
  5. Section A: English Language & Comprehension: Vocabulary, Subject Verb Agreement (Verb Noun Agreement), Adjectives, Tenses, Comprehension / Reading Comprehension / Unseen Passages (Critical Reasoning) (Paragraph Questions), Articles, Sentence Construction, Preposition, Direct and Indirect Speech, Sentence Completion (Fill in the blanks), Sentence Re-arrangements (Para Jumbles) (Narrative Sequencing), Modals, Active Passive Voice (Voice), Sentence Correction (Error Correction), Adverb, Conjunction, Cloze Test (Cloze Passage)
  6. Section A: Hindi Language & Comprehension: भाषा, लिपि, ध्वनि, वर्ण, अक्षर, स्वर, व्यंजन, मात्रा और संयुक्ताक्षर, वर्तनी, वर्ण-विन्यास, अनुस्वार, अनुनासिक, चंद्रबिंदु और ‘र’ के रूप, शब्द, पद और शब्द-भेद, संज्ञा और सर्वनाम, विशेषण और क्रिया, लिंग, वचन, पुरुष और कारक, काल, वाच्य, वाक्य और वाक्य-भेद, संधि, समास, विलोम शब्द, पर्यायवाची शब्द, सामान्य अशुद्धियाँ, अनेक शब्दों के लिए एक शब्द, मुहावरे और लोकोक्तियाँ, अपठित गद्यांश और अपठित पद्यांश, Multi-Topic Content (Cross-Concept Material), वर्णमाला
  7. Section B: Programming, Data Structures, OOP & Java: C Fundamentals, Control Flow, Functions, Arrays & Pointers, Storage Classes, Structures & Enums, DMA, Macros, Scoping & File Handling, Introduction to DS, Array, Stack, Queue, Linked List, Tree, Graphs, Hashing, Java, OOPS with C++, Language Design, Intro to Compilers, Visual Basics, Syntax Analysis: Bottom-Up, Object Oriented Technology
  8. Section B: Computer Networks, TCP/IP & Network Security: Introduction to CN, Data Communication, DLL: Flow Control, DLL: Access Control, DLL: Error Control, Data Link Layer - Ethernet, Net Layer: IPv4 & Proto, Net Layer: IP Addressing, Transport Layer Services, TL: Congestion & UDP, Application Layer, Hardware basics, Network Access Technologies, Network Security, Society, Law & Ethics, Mobile Computing, Net Layer:Routing Protocol, Cyber Safety and Security
  9. Section B: Teaching Methodology: Child Development, Concept of Pedagogy, Theories, Inclusive Education, Experiential Pedagogy, Assessment & Evaluation, Curriculum Framework & Reforms, National Education Policy (NEP) 2020, Psychology, Teaching-Learning Process, Personality Development, Teaching Methods & Strategies, Learning and Motivation, Learners & Learning Process, Factors Affecting Teaching, Methods of Teaching, Nature, Objectives & Characteristics of Teaching, Teaching-Learning Aids & ICT Integration, Classroom Management & Communication, Evaluation, Assessment & Measurement, Curriculum & School Environment, Inclusive Education & Special Needs, Professional Development & Ethics
  10. Section B: Digital Electronics / Boolean Logic: Digital Systems & Boolean Basics, Logic Gates & Hardware, Boolean Expression, Boolean Minimization, Combinational Circuit, Sequential Circuits, Number System, Number Representation, Analog-Digital Conversion
  11. Section B: Operating Systems & Linux: Introduction to OS, Process Management, CPU Scheduling, Process Synchronization, Threads & Process Creation, Deadlock, Memory Management, Virtual Memory, File Management, Disc Scheduling, Unix OS, Linux OS, Distributed Systems, Windows OS
  12. Section B: Data Base Management System: Basics of DBMS, ER Diagram, Relational Model & Functional Dependencies, Keys & Integrity Constraints, Normalization (1NF - BCNF), Decomposition Properties & 4NF, Relational Algebra, SQL, File Organization & Indexing, Transaction Management, Concurrency Control, Database Security & Authorization, Database Recovery, Data Warehousing & Mining
  13. Section B: Internet & Web Technologies: Website, Browser & Services, Internet Fundamentals, Web Design & Development, Protocols & Services, Web Publishing & Hosting, Server Side & Security, HTML Basics, CSS, Emerging Technologies, JavaScript-Basics, .Net Programming, Electronic Data Interchange and E-Commerce, XML
  14. Section B: Computer Fundamentals, IT Basics & Architecture: Basics of COA, Cache Memory Organization, Input Output Organisation, Register Transfer and Microoperations, Control Unit Design, Programming the Basic Computer, Terms & Abbreviations, MS Office Applications, Instr Formats & Modes, Floating Point Rep
  15. Section B: Python Language: Introduction to Python, Tokens, Variables, Data Types, I/O, Operators & Expressions, Control Flow & Looping, Collections & Strings, Functions & Modules, File Handling & Data Analysis
  16. Section B: Software Engineering: Fundamentals of Software Engineering, Software Requirements and Quality Assurance, Software Design, Estimation and Metrics, Software Testing, Software Maintenance and Configuration Management, extras, Fundamentals of Systems and Information Systems
  17. Section B: Design & Analysis of Algorithms: Algorithm Analysis, Time Complexity Analysis, Sorting Algorithms, Greedy Algorithms, Dynamic Programming, Minimum Spanning Trees, Shortest Path Algos, Advanced Algorithms
  18. Section B: Mathematics: Linear Algebra, Calculus, Trigonometry, Vectors, Set Theory, Functions, Relations, Propositional and Predicate Logic, Research Process Steps, Graph Theory
  19. Section B: Computer Graphics, Multimedia & Mobile Computing: Basics of Computer Graphics, 2-D Geometrical Transforms and Viewing, 3-D Object Representation, Geometric Transformations and Viewing, Multimedia
  20. Section B: Emerging Trends: Emerging Tech Trends, Knowledge Representation, Natural Language Processing
  21. DSSSB Previous Year Paper:
  22. Business Studies and Management: Business Communication, Business Organization and Management, Financial Accounting, Business Economics, Management Information System (MIS), Knowledge Management & New Economy
AI summary & chapters

AI Summary

An AI-generated summary of this video lecture.

This video is a comprehensive Python programming tutorial that systematically works through a series of multiple-choice questions from a practice sheet. The instructor, standing in front of a digital screen, explains the logic and output of each code snippet, focusing on core Python concepts. The session begins with Question 11, which involves a dictionary and the `sum()` function with a generator expression, where the instructor calculates the sum of the first elements of each tuple in the dictionary's values. The tutorial progresses to Question 12, analyzing a nested tuple and demonstrating how to access its elements. Question 13 covers a dictionary comprehension that modifies values based on a condition. Question 14 explores tuple creation with a conditional list comprehension and then uses slicing to access an element. Question 15 demonstrates a loop over dictionary keys and a conditional update of a value. Question 16 involves a dictionary comprehension with a filter condition. Question 17 tests tuple unpacking and a comparison. Question 18 evaluates a `for` loop with a `continue` statement. Question 19 uses the `chr()` function to create a dictionary and then sums its values. Finally, Question 20 demonstrates a `for` loop with a `continue` statement and the `print()` function with the `end` parameter. The instructor uses on-screen annotations to break down the code step-by-step, making the logic clear for the viewer.

Chapters

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

    The video starts with Question 11, which presents a dictionary `d = {'a': (1,2), 'b': (3,4)}`. The code `print(sum(v[0]+v[1] for v in d.values()))` is analyzed. The instructor explains that `d.values()` returns a view of the dictionary's values, which are the tuples `(1,2)` and `(3,4)`. The generator expression `v[0]+v[1] for v in d.values()` calculates the sum of the elements in each tuple: `1+2=3` and `3+4=7`. The `sum()` function then adds these results together, `3+7=10`. The instructor writes `1+2+3+4 = 10` on the screen to confirm the calculation, and the correct answer is identified as (a) 10.

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

    The instructor moves to Question 12, which features a nested tuple `t = (1, (2, (3,4)))`. The code `print(t[1][0])` is explained. The instructor breaks down the indexing: `t[1]` accesses the second element of the outer tuple, which is `(2, (3,4))`. Then, `[0]` accesses the first element of this inner tuple, which is `2`. The instructor writes `t = (1, (2, (3,4)))` and `t[1][0] = 2` on the screen. The correct answer is (b) 2. The video then transitions to Question 13, which shows a dictionary `d = {'a':1, 'b':2, 'c':3}`. The code `for k in d: d[k] = d[k]**2 if d[k]%2!=0 else d[k]` is analyzed. The instructor explains that the loop iterates over the keys, and the value is squared if it's odd, otherwise it remains unchanged. The final dictionary is `{a:1, b:2, c:9}`. The correct answer is (a) {a:1, b:2, c:9}. The video then moves to Question 14, which shows `t = tuple(i for i in range(5) if i not in (2,4))`. The instructor explains that this creates a tuple of numbers from 0 to 4, excluding 2 and 4, resulting in `t = (0,1,3)`. The code `print(t[::-1][1])` is then analyzed. `t[::-1]` reverses the tuple to `(3,1,0)`, and `[1]` accesses the second element, which is `1`. The correct answer is (b) 1.

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

    The instructor continues with Question 15, which shows a dictionary `d = {'x':1, 'y':2, 'z':3}`. The code `for k in list(d.keys()): if k<'y': d[k*2] = d[k]*3` is analyzed. The instructor explains that the loop iterates over the keys `x`, `y`, `z`. The condition `k<'y'` is true for `x` but false for `y` and `z`. For `k='x'`, the code creates a new key `x*2` (which is `xx`) and assigns it the value `d['x']*3 = 1*3 = 3`. The final dictionary is `{'x':1, 'y':2, 'z':3, 'xx':3}`. The `print(sorted(d.keys()))` statement then prints the sorted keys, which are `['x', 'y', 'z', 'xx']`. The correct answer is (a) ['x', 'y', 'z', 'xx']. The video then moves to Question 16, which shows `d = {1:'a', 2:'b', 3:'c'}`. The code `print([v/k for k,v in d.items() if k!=2])` is analyzed. The instructor explains that the list comprehension iterates over the items, and for each key-value pair where the key is not 2, it calculates `v/k`. For `k=1, v='a'`, it's `'a'/1 = 'a'`. For `k=3, v='c'`, it's `'c'/3 = 'c'`. The result is `['a', 'c']`. The correct answer is (a) ['a', 'c']. The video then moves to Question 17, which shows `t = (10,20,30)` and `a,b,c = t`. The code `print(a+b==c)` is analyzed. The instructor explains that `a=10`, `b=20`, `c=30`, so `a+b=30`, which is equal to `c`. The output is `True`. The correct answer is (a) True.

  4. 10:00 – 11:52 10:00-11:52

    The instructor moves to Question 18, which shows `t = (1,2,3,4,5)` and `print(all(i<6 for i in t))`. The instructor explains that the `all()` function returns `True` if all elements in the iterable are true. The generator expression `i<6 for i in t` checks if each number in the tuple is less than 6. Since all numbers (1,2,3,4,5) are less than 6, the expression is `True` for all, so `all()` returns `True`. The correct answer is (a) True. The video then moves to Question 19, which shows `d = {chr(65+i):i for i in range(4)}`. The instructor explains that `chr(65+i)` generates the characters 'A', 'B', 'C', 'D' for `i=0,1,2,3`. The dictionary is `{'A':0, 'B':1, 'C':2, 'D':3}`. The code `print(sum(d.values()))` then sums the values: `0+1+2+3=6`. The correct answer is (a) 6. Finally, the video shows Question 20, which shows `d = {'a':1, 'b':2, 'c':3}`. The code `for k,v in d.items(): if v%2==0: continue; print(k,end='')` is analyzed. The instructor explains that the loop iterates over the items. The `continue` statement skips the rest of the loop body for even values. For `k='a', v=1` (odd), it prints 'a'. For `k='b', v=2` (even), it skips. For `k='c', v=3` (odd), it prints 'c'. The `end=''` parameter prevents a newline, so the output is 'ac'. The correct answer is (a) 'ac'.

This video provides a structured and methodical walkthrough of a Python practice test, focusing on fundamental data structures and control flow. The instructor systematically deconstructs each question, starting with the syntax and then explaining the logical flow and expected output. The core concepts covered include dictionary and tuple operations, list and dictionary comprehensions, conditional logic, and the use of built-in functions like `sum()`, `all()`, and `chr()`. The progression from simple data access to more complex operations like comprehensions and conditional updates demonstrates a clear pedagogical approach, making it an effective resource for students to understand and practice Python programming concepts.

Loading lesson…