Find Number of Days in a Month

Duration: 4 min

This video lesson is available to enrolled students.

Return to /learn/HEXAWARE-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 Ability: Speed Mathematics and Basic Mathematics, Percentage, Ratio and Proportion (Ratios), Average, Profit and Loss, Simple Interest and Compound Interest, Time and Work, Pipe and Cistern, Speed Time and Distance, Number System, HCF LCM, Data Interpretation, Age Problems, Mixture and Alligation, Partnership, Algebra, Sequence and Series (Series), Mensuration and Geometry, Arithmetic
  2. Reasoning Ability: Puzzle Solving (Puzzles), Seating Arrangements, Coding Decoding, Blood Relations, Directions (Direction Test), Syllogisms, Data Sufficiency, Ranking, Order and Sequence, Series (Number and Letter Series) (Numerical Relations and Reasoning), Logical Sequence Of Words, Calendar, Clock, Cubes & Dices, Analytical Reasoning (Counting Figures Reasoning), Data Arrangement, Non Verbal Reasoning (Spatial Aptitude) (Spatial Reasoning) (Visual Reasoning), Deductive and Inductive Reasoning (Logical Deduction and Induction) (Prepositional Reasoning)
  3. Verbal Ability: Comprehension / Reading Comprehension / Unseen Passages (Critical Reasoning) (Paragraph Questions), Cloze Test (Cloze Passage), Sentence Re-arrangements (Para Jumbles) (Narrative Sequencing), Vocabulary, Sentence Completion (Fill in the blanks), Active Passive Voice (Voice), Direct and Indirect Speech, Subject Verb Agreement (Verb Noun Agreement), Tenses, Preposition, Articles, Sentence Correction (Error Correction)
  4. Programming Basics (MCQs + Interview): C Programming by Yash Sir, Programming in C++, Java, Python for Placements by Yash Sir
  5. OOPs (MCQs + Interview): Object Oriented Programming (OOPS)
  6. DBMS (MCQs + Interview): Basics of DBMS, ER Diagram, Relational Model & Functional Dependencies, Keys & Integrity Constraints, Normalization (1NF - BCNF), Transaction Management, Decomposition Properties & 4NF, Concurrency Control, Database Recovery, File Organization & Indexing, Relational Algebra, Database Security & Authorization
  7. SQL (MCQs + Interview): SQL
  8. Operating Systems (MCQs + Interview): Introduction to OS, Process Management, CPU Scheduling, Deadlock, Threads & Process Creation, Memory Management, Virtual Memory, Process Synchronization, Disc Scheduling, File Management, Security
  9. Computer Networks (MCQs + Interview): 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
  10. Coding: Coding Questions by Yash Sir
  11. HR Interview: MR & HR Interview Preparation
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…