Computer Programming

Computer Programming

MASTER OF COMPUTER APPLICATIONS COMPUTER PROGRAMMING MCA612/MCA617 Kiran Gurbani CHANDIGARH UNIVERSITY Institute of Distance and Online Learning Course Development Committee Chairman Prof. (Dr.) R.S. Bawa Vice Chancellor, Chandigarh University, Punjab Advisors Prof. (Dr.) Bharat Bhushan, Director, IGNOU Prof. (Dr.) Majulika Srivastava, Director, CIQA, IGNOU Programme Coordinators & Editing Team Master of Business Administration (MBA) Bachelor of Business Administration (BBA) Co-ordinator - Prof. Pragya Sharma Co-ordinator - Dr. Rupali Arora Master of Computer Applications (MCA) Bachelor of Computer Applications (BCA) Co-ordinator - Dr. Deepti Rani Sindhu Co-ordinator - Dr. Raju Kumar Master of Commerce (M.Com.) Bachelor of Commerce (B.Com.) Co-ordinator - Dr. Shashi Singhal Co-ordinator - Dr. Minakshi Garg Master of Arts (Psychology) Bachelor of Science (Travel & Tourism Management) Co-ordinator - Dr. Samerjeet Kaur Co-ordinator - Dr. Shikha Sharma Master of Arts (English) Bachelor of Arts (General) Co-ordinator - Dr. Ashita Chadha Co-ordinator - Ms. Neeraj Gohlan Master of Arts (Mass Communication and Bachelor of Arts (Mass Communication and Journalism) Journalism) Co-ordinator - Dr. Chanchal Sachdeva Suri Co-ordinator - Dr. Kamaljit Kaur Academic and Administrative Management Prof. (Dr.) Pranveer Singh Satvat Prof. (Dr.) S.S. Sehgal Pro VC (Academic) Registrar Prof. (Dr.) H. Nagaraja Udupa Prof. (Dr.) Shiv Kumar Tripathi Director – (IDOL) Executive Director – USB © No part of this publication should be reproduced, stored in a retrieval system, or transmitted in any form or by any means, electronic, mechanical, photocopying, recording and/or otherwise without the prior written permission of the author and the publisher. SLM SPECIALLY PREPARED FOR CU IDOL STUDENTS Printed and Published by: Himalaya Publishing House Pvt. Ltd., E-mail: [email protected], Website: www.himpub.com For: CHANDIGARH UNIVERSITY Institute of Distance and Online Learning COMPUTER PROGRAMMING PRACTICAL Course Code: MCA617 Credits: 1 Course Objectives: To develop programming logic, use of programming instructions, syntax and program structure. To analyze the foundation of complex programming languages like C++ etc. To practice the techniques for the development and application of problem-solving skills. Syllabus 1 C Basics and Control structure: 1. Write a program that reads two nos. from key board and gives their addition, subtraction, multiplication, division and modulo 2. The distance between two cities (In KM) is input through key board. Write a program to convert and print this distance in meters, feet, inches and centimeters. 3. Write a C program to perform post and pre-increment, post and pre-decrement operations. 4. Write a program which implements the working of all Bit-wise operators 5. Write a program to select and print the largest of the three nos. using Nested-If-Else statement. 6. Write a program to perform arithmetic operations using switch case. 7. Write a program to find sum of all integers greater than 100 & less than 200 and are divisible by 5. 8. Write a C program to implement x x2 x 3 ex 1 , 1! 2! 3! 2. Arrays, Strings, Functions and Structure: 1. Write a program to perform various matrix operations, Addition, Subtraction, Multiplication, Transpose using switch-case statement 2. Programs based on string handling 3. Write a program using function to implement Pascal Triangle 4. Write a program that used user defined function Swap ( ) and interchange the value of two variable. 5. Write a function prime that return 1 if it’s argument is prime and return 0 otherwise 6. Define a structure type, personal, that would contain person name, date of joining and salary. Using this structure, write a program to read this information for one person from the key screen. 7. Define a structure called cricket that will describe the following information: (a) Player name (b) Team name (c) Batting average 3. Pointers and DMA: 1. Write a program using pointer and function to determine the length of string. 2. Write a program using pointer to compare two strings. 3. Write a program using pointer to concatenate two strings. 4. Write a program using pointer to copy one string to another string. 5. Write a program using pointer to read an array if integer and print element in reverse order. 6. Write a program that uses a table of integers whose size will be specified interactively at run time. 7. Write a program to store a character string in block of memory space created by malloc and then modify the same to store a large string. 4. C Pre-Processor and File management: 1. Write a program which reads diameter and height of a cone and calculate its volume using macros. 2. A program to illustrate reading files contents. 3. A program to illustrate the use of fgets( ) 4. A program to illustrate the use of fputc ( ) and fputs( ) Text Books: 1. Balaguruswamy (2017 ).Programming in ANSI C. New Delhi: McGraw-Hill. 2. Kanetkar, Y. (2014), Programming in C ANSI standard. New Delhi: BPB Publications. 3. Gottfried (2005).Programming with C. New York: Tata McGraw-Hill. Reference Books: 1. Harrow K., Jones J. (1996). Problem Solving with C. London: Pearson Education. 2. Jeri R., Hanly, Koffman E.P. (2000). Problem Solving and Program Design in C. 3rd Ed. Boston: Addison Wesley. CONTENTS Unit 1: Introduction to Computer and Programming 1 – 28 Unit 2 Fundamentals of C 29 – 60 Unit 3 Operators and Expressions 61 – 98 Unit 4 Decision and Loop Control structure 99 – 133 Unit 5 Arrays 134 - 144 Unit 6 Strings 145 - 158 Unit 7 Functions 159 - 190 Unit 8 Pointers 191 – 216 Unit 9 Structure 217 – 243 Unit 10 Dynamic Memory Allocation 244 – 259 Unit 11 C Preprocessor 260 – 271 Unit 12 File Management 272 – 302 Practical Unit 1 C Basics and Control Structure 303 – 310 Practical Unit 2 Arrays, Strings, Functions and Structure 311 – 324 Practical Unit 3 Pointers and DMA 325 – 332 Practical Unit 4 C Pre-Processor and File Management 333 – 336 Introduction to Computer and Programming 1 UNIT 1 INTRODUCTION TO COMPUTER AND PROGRAMMING Structure: 1.0 Learning Objectives 1.1 Introduction 1.2 Basic Block Diagrams 1.3 Interconnection between Functional Components 1.4 Algorithm Flowcharts 1.5 Machines and Knowledge about Problem Solving 1.6 Stages of Program Development Process 1.7 Importance of Discipline in Programming 1.8 Summary 1.9 Key Words/Abbreviations 1.10 Learning Activity 1.11 Unit End Questions (MCQ and Descriptive) 1.12 References 1.0 Learning Objectives After studying this unit, you will be able to: Define computer Draw the block diagram of computer Explain functioning of different components of computer Describe algorithm and flowcharts CU IDOL SELF LEARNING MATERIAL (SLM) 2 Computer Programming Describe the machines related to problem solving Discuss the knowledge and concepts of problem solving Explain problem development steps Elaborate the importance of discipline in problem solving 1.1 Introduction Being a modern-day kid you must have used, seen, or read about computers. This is because they are an integral part of our everyday existence. Be it school, banks, shops, railway stations, hospital or your own home, computers are present everywhere, making our work easier and faster for us. As they are such integral parts of our lives, we must know what they are and how they function. Let us start with defining the term computer formally. Types of Computers: Computers can be generally classified by size and power as follows, though there is considerable overlap: Personal computer: A small, single-user computer based on a microprocessor. Workstation: A powerful, single-user computer. A workstation is like a personal computer, but it has a more powerful microprocessor and, in general, a higher-quality monitor. Minicomputer: A multi-user computer capable of supporting up to hundreds of users simultaneously. Mainframe: A powerful multi-user computer capable of supporting many hundreds or thousands of users simultaneously. Supercomputer: An extremely fast computer that can perform hundreds of millions of instructions per second. Supercomputer and Mainframe Supercomputer is a broad term for one of the fastest computers currently available. Supercomputers are very expensive and are employed for specialized applications that require immense amounts of mathematical calculations (number crunching). For example, weather CU IDOL SELF LEARNING MATERIAL (SLM) Introduction to Computer and Programming 3 forecasting requires a supercomputer. Other uses of supercomputers scientific simulations (animated) graphics, fluid dynamic calculations, nuclear energy research, electronic design, and analysis of geological data (e.g., in petrochemical prospecting). Perhaps the best known supercomputer manufacturer is Cray Research. Mainframe was a term originally referring to the cabinet containing the central processor unit or “main frame” of a room-filling Stone Age batch machine. After the emergence of smaller “minicomputer” designs in the early 1970s, the traditional big iron machines were described as “mainframe computers” and eventually just as mainframes. Nowadays a Mainframe is a very large and expensive computer capable of supporting hundreds, or even thousands, of users simultaneously. The chief difference between a supercomputer and a mainframe is that a supercomputer channels all its power into executing a few programs as fast as possible, whereas a mainframe uses its power to execute many programs concurrently. In some ways, mainframes are more powerful than supercomputers

View Full Text

Details

  • File Type
    pdf
  • Upload Time
    -
  • Content Languages
    English
  • Upload User
    Anonymous/Not logged-in
  • File Pages
    344 Page
  • File Size
    -

Download

Channel Download Status
Express Download Enable

Copyright

We respect the copyrights and intellectual property rights of all users. All uploaded documents are either original works of the uploader or authorized works of the rightful owners.

  • Not to be reproduced or distributed without explicit permission.
  • Not used for commercial purposes outside of approved use cases.
  • Not used to infringe on the rights of the original creators.
  • If you believe any content infringes your copyright, please contact us immediately.

Support

For help with questions, suggestions, or problems, please contact us