Find Number of Days in a Month

Duration: 4 min

This video lesson is available to enrolled students.

Return to /learn/COCUBES-PREPARATION/coding/coding-questions/coding-question/asset-find-number-of-days-in-a-month after enrolling

Inside: a video lesson and guided study material.

Module outline

  1. Quantitative Aptitude: Number System, Divisibility Rules, HCF LCM, Percentage, Ratio and Proportion (Ratios), Average, Profit and Loss, Simple Interest and Compound Interest, Mixture and Alligation, Partnership, Age Problems, Time and Work, Pipe and Cistern, Speed Time and Distance, Algebra, Arithmetic, Data Interpretation, Sequence and Series (Series), Logarithm, Powers and Exponents (Surds and Indices), Permutation and Combination, Probability, Speed Mathematics and Basic Mathematics, Trigonometry
  2. Logical Reasoning: Coding Decoding, Blood Relations, Directions (Direction Test), Ranking, Order and Sequence, Seating Arrangements, Puzzle Solving (Puzzles), Data Arrangement, Syllogisms, Inequality, Data Sufficiency, Deductive and Inductive Reasoning (Logical Deduction and Induction) (Prepositional Reasoning), Series (Number and Letter Series) (Numerical Relations and Reasoning), Venn Diagram, Logical Sequence Of Words, Calendar, Clock, Cubes & Dices, Non Verbal Reasoning (Spatial Aptitude) (Spatial Reasoning) (Visual Reasoning)
  3. Verbal Ability: Noun, Pronoun, Adjectives, Verb, Adverb, Tenses, Subject Verb Agreement (Verb Noun Agreement), Articles, Preposition, Conjunction, Modals, Determiner, Vocabulary, 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), Active Passive Voice (Voice), Direct and Indirect Speech, Sentence Construction
  4. Data Structures (Domain Test): Introduction to DS, Array, Stack, Queue, Linked List, Tree, Graphs, Hashing
  5. Algorithms (Domain Test):
  6. OOPs (Domain Test): Object Oriented Programming (OOPS)
  7. DBMS (Domain Test): 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
  8. SQL (Domain Test): SQL
  9. Operating Systems (Domain Test): 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
  10. Computer Networks (Domain Test): 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
  11. Coding: Coding Questions by Yash Sir, C Programming by Yash Sir, Programming in C++, Java, Python for Placements by Yash Sir
  12. Written English Test: English Writing Ability
  13. Psychometric Test: Behavioral Assessment (Behavioral Competency Profiling) (Psychometric Test)
AI summary & chapters

AI Summary

An AI-generated summary of this video lecture.

This video is a programming tutorial from Knowledge Gate that teaches how to write a C program to determine the number of days in a given month. The instructor first presents the problem statement, Q10, which requires a user to input a date in dd-mm-yyyy format and output the number of days in that month, with the instruction to ignore leap years. The solution is broken down into a logical approach: parsing the input string to extract the month, using a predefined array of days for each month, and then outputting the result. The instructor then transitions to writing the code, showing the necessary header files, the main function, and the use of the `strtok` function to split the date string by the '-' delimiter. The code is completed by converting the month string to an integer and using it as an index to access the correct number of days from the array. The video concludes with the final code snippet and a brief explanation of the logic.

Chapters

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

    The video begins with the Knowledge Gate logo, followed by a slide introducing the problem, Q10. The problem statement is clearly displayed: 'User enters date in dd-mm-yyyy find out number of days in month (for now please ignore the concept of leap year)'. The input is specified as a date in dd-mm-yyyy format, and the output is the number of days in that month. Two public test cases are provided: for the date 12-03-2006, the output is 31, and for 31-11-1996, the output is 30. The instructor, Yash Jain Sir, is visible in a small window, and the slide includes a 'Placement Expert' graphic and a copyright notice for Knowledge Gate Eduventures. The instructor begins to explain the problem, emphasizing the need to parse the date string to extract the month.

  2. 2:00 – 4:18 02:00-04:18

    The instructor transitions to the coding phase, with a 'Code' label appearing on the screen. He begins writing the C program, starting with the necessary header files: #include <stdio.h> and #include <string.h>. He then defines the main function and initializes an integer array `arr` with the number of days for each month, starting from January (index 0). The array is populated as {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31}. He then writes the code to take user input using `scanf`, store it in a character array `date[11]`, and use `strtok` to split the string by the '-' delimiter to extract the month. He explains that the month string is then converted to an integer using `atoi` and used as an index to access the correct number of days from the array, which is printed as the output. The final code snippet is shown on the screen, and the instructor explains the logic of the program.

The video provides a clear, step-by-step tutorial on solving a common programming problem. It starts with a well-defined problem statement and test cases, then logically breaks down the solution into parsing the input, using a data structure (an array) to store the number of days per month, and finally writing the code to implement this logic. The progression from problem definition to code implementation is methodical and educational, making it a useful resource for learning basic string manipulation and array usage in C.

Loading lesson…