PROGRAMMING IN C AND C++:

Similar documents
Subject: Computer Science

B. V. Patel Institute of Business Management, Computer & Information Technology, UTU 2013

VALLIAMMAI ENGINEERING COLLEGE SRM NAGAR, KATTANGULATHUR

VARIABLE, OPERATOR AND EXPRESSION [SET 1]

VALLIAMMAI ENGINEERING COLLEGE

UNIVERSITY OF ENGINEERING & MANAGEMENT, KOLKATA C ASSIGNMENTS

Algorithms 4. Odd or even Algorithm 5. Greatest among three numbers Algorithm 6. Simple Calculator Algorithm

Questions Bank. 14) State any four advantages of using flow-chart

SRM ARTS AND SCIENCE COLLEGE SRM NAGAR, KATTANKULATHUR

CS 6456 OBJCET ORIENTED PROGRAMMING IV SEMESTER/EEE

I BCS-031 BACHELOR OF COMPUTER APPLICATIONS (BCA) (Revised) Term-End Examination. June, 2015 BCS-031 : PROGRAMMING IN C ++

(i) Describe in detail about the classification of computers with their features and limitations(10)

DR. A.P.J. ABDUL KALAM TECHNICAL UNIVERSITY LUCKNOW. Evaluation Scheme & Syllabus. For. B.Tech. First Year (Programming for Problem Solving)

Subject: PROBLEM SOLVING THROUGH C Time: 3 Hours Max. Marks: 100

Suggestive List of C++ Programs

Aryan College. Fundamental of C Programming. Unit I: Q1. What will be the value of the following expression? (2017) A + 9

UNIT I : OVERVIEW OF COMPUTERS AND C-PROGRAMMING

Syllabus of Diploma Engineering. Computer Engineering. Semester: II. Subject Name: Computer Programming. Subject Code: 09CE1104

CHOICE BASED CREDIT SYSTEM (With effect from )

BCA-105 C Language What is C? History of C

END TERM EXAMINATION

INDIAN SCHOOL MUSCAT COMPUTER SCIENCE(083) CLASS XI

Syllabus for Bachelor of Technology. Computer Engineering. Subject Code: 01CE1303. B.Tech. Year - II

Downloaded from

KLiC C Programming. (KLiC Certificate in C Programming)

Tribhuvan University Institute of Science and Technology 2065

COMPUTER PROGRAMMING LAB

PDS Lab (Assignment 1) Date: 31 st July, 2017 (2-6 pm)

Write a java program to prints the count of odd and even no s entered.

Kadi Sarva Vishwavidyalaya, Gandhinagar

ALIGARH MUSLIM UNIVERSITY Department of Computer Science. JAVA Lab Assignment Course: MCA II nd Semester Academic Session:

Programming for Problem Solving 105A L T P Credit Major Minor Total Time

Scheme G. Sample Test Paper-I. Course Name : Computer Engineering Group Course Code : CO/CD/CM/CW/IF Semester : Second Subject Tile : Programming in C

The Hyderabad Public School, Begumpet, Hyderabad, A.P

Practical List of. MCA IV SEM Session -2010

Get Unique study materials from

CP I LAB MANUAL. Expt No 2 To Check Whether A Year Is A Leap Year Using if-else-if.

Sardar Patel University S Y BSc. Computer Science CS-201 Introduction to Programming Language Effective from July-2002

Problem Solving with C++

Lab Manual. Program Design and File Structures (P): IT-219

TIME: 3 HOURS MARKS: a. Develop a java program to sort an array of N numbers in ascending order. (40)

For Solved Question Papers of UGC-NET/GATE/SET/PGCET in Computer Science, visit

Babaria Institute of Technology Computer Science and Engineering Department Practical List of Object Oriented Programming with C

Reg. No. : Question Paper Code : B.E./B.Tech. DEGREE EXAMINATION, JANUARY First Semester GE 6151 COMPUTER PROGRAMMING

Lesson Plan. Subject: OBJECT ORIENTED PROGRAMMING USING C++ :15 weeks (From January, 2018 to April,2018)

Computer Programming C++ (wg) CCOs

VALLIAMMAI ENGNIEERING COLLEGE SRM Nagar, Kattankulathur DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING QUESTION BANK

Gujarat University M. Sc. Computer Science [S. F.] Semester-1 Syllabus Gujarat Arts & Science College, Ahmedabad.

(Following Paper ID and Roll No. to be filled by the student in the Answer Book)

Preface... (vii) CHAPTER 1 INTRODUCTION TO COMPUTERS

PITSCO Math Individualized Prescriptive Lessons (IPLs)

C PROGRAMMING LAB MANUAL

YEAR 8 SCHEME OF WORK

PESIT Bangalore South Campus Hosur Road (1km before Electronic City), Bengaluru Department of Basic Science and Humanities

Object Oriented Programming Using C ++ Page No. : 1. ASSIGNMENT SHEET WITHOUT USING OBJECT AND CLASSES

Absolute C++ Walter Savitch

Assignment: 1. (Unit-1 Flowchart and Algorithm)

PROGRAMS. EXCELLENT ACADEMY OF ENGINEERING. Telephone: / NORMAL PROGRAM

List of Practical for Class XII Computer Science

Florida Math 0018 Correlation of the ALEKS course Florida Math 0018 to the Florida Mathematics Competencies - Lower

Introduction to Computers and C++ Programming p. 1 Computer Systems p. 2 Hardware p. 2 Software p. 7 High-Level Languages p. 8 Compilers p.

Object Oriented Programming with c++ Question Bank

C- PROGRAMMING (3:0:0) Sub code : CS1C01/CS2C01 CIE : 50%Marks Hrs/week : 03 SEE : 50%Marks SEE Hrs : 03 Hours Max. Marks: 100 Course Outcomes:

'C' Programming Language

LIST OF EXPERIMENTS. (1) (Office Automation)

CS201 Some Important Definitions

Reg. No. : Question Paper Code : 27157

Middle School Math Course 3 Correlation of the ALEKS course Middle School Math 3 to the Illinois Assessment Framework for Grade 8

Object Oriented Programming 2012

Multiple Choice Questions ( 1 mark)

AHLCON PUBLIC SCHOOL, MAYUR VIHAR I, DELHI ASSIGNMENT CLASS XI Session Chapter 1: Computer Overview

Number Algebra Geometry and Measure Statistics. Aspect 1 Aspect 2 Aspect 3 Aspect 4 Work out the upper. Calculate area of and lower bounds of

Week 0. Net Salary =Earnings- deductions; Read the employee number, Basic Print employee Number, Earnings,Deductions and Net salary.

M4.1-R3: PROGRAMMING AND PROBLEM SOLVING THROUGH C LANGUAGE

Computer Science & Engineering. Second Year

College Readiness (597 topics) Course Name: College Prep Math Spring 2014 Course Code: ARTD4-3N6XJ

HIGER SECONDARY FIRST YEAR COMPUTER SCIENCE

SAURASHTRA UNIVERSITY

Montana City School GRADE 5

Linby Primary School Targets Ladder. Linby Primary School Targets Ladder

Syllabus of C++ Software for Hands-on Learning: This course offers the following modules: Module 1: Getting Started with C++ Programming

DEPARTMENT OF COMPUTER APPLICATIONS SRM INSTITUTE OF SCIENCE AND TECHNOLOGY SRM NAGAR, KATTANKALATHUR

PRE-ALGEBRA PREP. Textbook: The University of Chicago School Mathematics Project. Transition Mathematics, Second Edition, Prentice-Hall, Inc., 2002.

B.V. Patel Institute of Business Management, Computer & Information Technology, Uka Tarsadia University

Course Outlines. Elementary Mathematics (Grades K-5) Kids and Numbers (Recommended for K-1 students)

H192 Midterm 1 Review. Tom Zajdel

ENGINEERING PROBLEM SOLVING WITH C++

Math Content

7 th GRADE PLANNER Mathematics. Lesson Plan # QTR. 3 QTR. 1 QTR. 2 QTR 4. Objective

3 The L oop Control Structure

Object Oriented Programming. Assistant Lecture Omar Al Khayat 2 nd Year

M.C.A DEGREE EXAMINATION,NOVEMBER/DECEMBER 2010 Second Semester MC 9222-OBJECT ORIENTED PROGRAMMING (Regulation 2009)

Time : 3 hours. Full Marks : 75. Own words as far as practicable. The questions are of equal value. Answer any five questions.

Time: 3 HOURS Maximum Marks: 100

22316 Course Title : Object Oriented Programming using C++ Max. Marks : 70 Time: 3 Hrs.

Shapes leading to CAD system project

Performance Level Descriptors. Mathematics

Click on the topic to go to the page

APS Sixth Grade Math District Benchmark Assessment NM Math Standards Alignment

Name: Teacher: Form: LEARNER JOURNAL. Set: Mathematics. Module 2 END OF YEAR TARGET: GCSE TARGET:

Transcription:

PROGRAMMING IN C AND C++: Week 1 1. Introductions 2. Using Dos commands, make a directory: C:\users\YearOfJoining\Sectionx\USERNAME\CS101 3. Getting started with Visual C++. 4. Write a program to print a message Hello World Week 2 (Basic Techniques) 1. Write a program to print a message Hello World 2. Write a program to swap the contents of two variables. 3. Write a program to find the sum, difference, product, quotient and remainder of two input numbers. 1. Define identifier, variable, constant, keywords. 2. List few Keywords. 3. How do you declare a variable? 4. Write the syntax of printf() and scanf() functions. Week 3 (Arithmetic Operators) 1. Write a program to compute the area and circumference of a circle given its radius through keyboard.

2. Temperature of a city is input through the keyboard. Write a program to convert the temperature given in Fahrenheit degrees to Centigrade degrees. C = (5/9) x (F-32) 3. Given Principal Amount, Number of years and Interest rate, Calculate Simple interest and Compound interest. S.I = P * N * R / 100 C.I = P(1+(R/100)) n 4. Write a program to calculate the area and perimeter of a triangle given the length of three sides. (Area = square root of (s(s-a)(s-b)(s-c)), where s=(a+b+c)/2 and Perimeter = (a+b+c)) 5. If an integer number is input through the keyboard, write a program to extract its unit s digit. 6. Ramesh s basic salary is input through the keyboard. His dearness allowance is 40% of basic salary; house rent allowance is 20 % of basic salary. Write a program to calculate his gross salary. 7. Given a four digit number, write a program to print the number in reverse. 1. What are the different operators available in C? 2. What do you understand from unary and binary operators? 3. List any 5 mathematical functions available in C. Week 4 (Control Structures-if/else) 1. Any integer is input through the keyboard. Write a program to find out whether it is an odd or even number. 2. Write code for the flowchart given below. Assume that the variables x and y are integers and z is a float.

X > 0 X > 0 Y = X - 1 Y > 0 Z = 2 * X Z = Y Z = X Y = X + 1 Z = Z + 1 Print X, Y, Z 3. Given 3 integer numbers, write a program to find the greatest, smallest of them. (use if/else) 4. Write a program to find the greatest and smallest of three given numbers using conditional operator. 5. Write a program to find the given integer number is perfect square or not. 6. Write a program to compute the real roots of a quadratic equation ax²+bx+c=0 The roots are given by the equations X1 = -b + b²-4ac 2a X2 = -b - b²-4ac 2a The program should request for the values of the constants a,b and c and print the values of x1 and x2. Use the following rules: (a) No solution, if both a and b are zero

(b) There is only one root, if a=0(x=-c/b) (c) There are no real roots, if b2-4ac is negative (d) Otherwise there are two real roots (b²-4ac >= 0) Test your program with appropriate data so that all logical paths are working as per your design. Incorporate appropriate output messages. 7. Write a program to display whether the year is leap year or not. Given the year by the user.(we say that a year is a leap year if it is evenly divisible by 400 or if it is evenly divisible by 4 but not by 100). 1. What are the different control structures in C? 2. Explain the syntax of if statement. 3. Write the syntax of conditional operator. Week 5 (Switch, Looping techniques) 1. Write a program to accept a month number and display no. of days in the month Using switch. 2. Using switch statement, write a program to simulate a simple calculator which is used to carry basic operations like addition, subtraction, multiplication and division. The input will be given in infix form. i.e operand1 operator operand2. (eg: 4 + 5, 10-4, 12 * 4, 3 / 5) 3. Write a program to print the multiplication table of a number entered by the user. The table should be displayed in the following form: 14 x 1 = 14 14 x 2 = 28.. 14*10=140 4. Write a program to find if the number given is a prime or not.

5.If a number is input through the keyboard, write a program to check if the given is palindrome or not. A number is said to be palindrome, if it and its reverse are the same. For example 23132 is a palindrome, as it is same when it is read from right to left as well as from left to right. 6.Write a program to print the following patterns 1 * * * * * 2 2 * * * * 3 3 3 * * * 4 4 4 4 * * 5 5 5 5 5 * 1. Write the syntax of switch statement? 2. Explain the working of switch statement. 3. What is the use of break? 4. Explain the logical operators. 5. Explain the syntax of for, while, do while statements. Week 6 (Looping techniques: for, while, do-while) 1. Write a program to find whether a number is an Armstrong number or not. A number is said to be Armstrong number if the sum of the cubes of the digits of the number is equal to the number itself, eg. 153 = 1^3 + 5^3 + 3^3 = 1 + 125 + 127. 2. Write a program to convert a binary number to decimal number. 3. Write a program to convert a decimal number to binary number. 4. Write a program to print Fibonacci series up to n terms. 5. Write a program to print sinx values using series expansion given number of terms(n) and the angle in degrees(x)(verify the series expansion value with the library function sin(x) value). In the given series we observe that 1 st term=x, 2 nd term=-x³/3! Can be written as (-x²*x)/3! i.e.,(-x²*1 st term)/2*(2+1)...(n+1)th term can be written as (-x²*nth term)/2n(2n+1)

6. Write a program to print Cosx values using series expansion given number of terms(n) and the angle in degrees(x)(verify the series expansion value with the library function cos(x) value). In the given series we observe that 1 st term=1, 2 nd term=-x²/2! Can be written as (-x²*1)/2! i.e.,(-x²*1 st term)/2*(2-1)...(n+1)th term can be written as (-x²*nth term)/2n(2n-1) 7. Write a program to count the occurrence of characters and special characters like \n, \t, white spaces in the given text input. 1. Write the syntax of for, do-while and while and explain the working of each one. 2. What is iteration? 3. What do you mean by looping? 4. What is the difference between break and continue? 5. What is the need of continue? Week 7 (Functions) 1. Write a program that reads three integers and then prints them in order read and reversed. Use three functions, one to read the data, one to print them in the order read and one to print them in the reverse order. (void functions and no arguments)

Write a program to find if the number given is a prime or not. 2. Write a program that creates the following pattern, given the height (no. of rows): If height = 6: * *** ***** ******* ********* *********** (Void function with argument) 3. Write two functions a. To count the number of digits in a given integer and returns the count to the main function. (eg: The integer 376 has 3 digits) b. Write a function to find the sum of all the digits in a given integer and return the sum to the main function. eg:(376 = 3 + 7 + 6 = 16) (function returning a value and taking argument) 4. Write a program to calculate npr = n! / (n-r)! Use factorial function to calculate n! and (n-r)! 1. What is a function? What is the use of function? Give its syntax. 2. What are the different types of functions? 3. List few header files. 4. What is function prototype? 5. What are the different parameter passing techniques? 6. What is the difference between library function & user defined function?

Week 8 (Functions: Recursion) 1. Write a recursive function to find the factorial of a given number. 2. Write a recursive function to print the given Fibonacci term. (Eg: 3 rd term is 2, 5 th term = 3, 8 th term = 21) 3. Write a recursive function to count the number of digits in a given integer. 4. Write a recursive function to find the sum of digits in a given integer. 5. Write a recursive function to find the GCD/HCF of 2 given integers. 6. Write a program to demonstrate different storage classes. (auto, register, static, global, local) 1. List all the storage classes. 2. Difference between local variable and global variable. 3. Difference between static and auto variable. 4. What is recursive function? 5. What is the difference between recursion and iteration? Week 9 (Arrays) 1. Given n integers, write a program to accept the numbers into array, i. Print the numbers in the given order. ii. Print them in the reverse order. iii. Find their sum and average of all the elements and display them. iv. Print the largest element in the array. v. Print the smallest element in the array. 2. Write a program to sort n numbers in an array in ascending order using Selection sort algorithm. 3. Write a program to sort n numbers in an array in ascending order using Bubble sort algorithm.

4. Write a program to search a given element in a given list of integer elements using Linear Search algorithm. 1. What is an array? Declare an array of 20 float values. 2. Declare and initialise all the elements in an integer array to zeros. 3. Explain Selection sort and Bubble sort algorithms. 4. Explain Linear Search algorithm. Week 10 (Arrays) 1. Write a program to search a given element in a given list of integer elements using Binary Search algorithm. 2. Write a program to read in a given matrix and to print out the same. 3. Using functions write a program to (i) to read (ii) write (iii) add (iv) multiply two given matrices. 1. Explain Binary Search algorithm. 2. How do you pass an array to function? 3. How do you store a matrix of order 3 x 4? 4. How do you declare a string to store 30 characters? 5. What is a multi-dimensional array? Declare a 3-d array. 6. How many elements are there in array arr: int arr [2] [3] [4]; 7. In an array of n integers, Array index starts with and ends with.

Week 11 (String Manipulations) 1. Write a program to find the length of a given string (Do not use strlen function) 2. Write a program to copy the contents of a given string into another string (Do not use strcpy function) 3. Write a program to reverse a given string and check whether a given string is a palindrome. Week 12 (Pointers) 1. Using function and pointers write a program to swap two integer variables. 2. Using function and pointers write a program to find the sum of all the elements of an array. 3. Using Functions and Pointers, write a program to (i) to read (ii) write (iii) add (iv) multiply two given matrices. 1. What is a pointer? 2. What are pointer operators? 3. What are the arithmetic operations that are allowed and not allowed on pointer variables? 4. What is the relationship between a 1D-array & a pointer? 5. What is the relationship between a 2D-array & a pointer? 6. Using pointer notation how is the element a[3][4] in int a[5][5] accessed?

Week 13 (Structures) 1. Write a program to generate address labels using structures. 2. A complex number is of the form a+ib, where a is the real part and b is the imaginary part. Define a structure with real part and imaginary part of a complex no as its member data. Write a program to perform the following operations over two complex numbers. a. Addition b. Subtraction 1. What is a structure? Give the syntax. 2. What is the difference between an array & a structure? 3. What is the difference between a structure & a union? 4. Declare a structure for i) rational number ii) employee record. 5. How do you pass a structure to a function? Week 14(File operations) 1. Write a program to i. Create a file with student details ii. Read and Display its contents. 2. Write a program to i. Create a text file ii. Copy the created file into another file. iii. Compare the contents of both the files. 1. What are the different file operations in C? 2. Explain the syntax of fopen, fprintf, fscanf functions. 3. What are command line arguments? 4. What are pre-processor commands?

C++ Week 15 (Introduction to C++: Inline, Function Overloading, Class) 1. Write a program to find the sum and average of two given numbers. 2. Write the following inline functions and call them from main (). 1. To find the square of a given number. 2. To find the cube of a given number. 3. Using Function Overloading, write a program to calculate the volume of cube, cylinder, and rectangular box using Function overloading. 4. Write a program that creates a class Rectangle with 2 data members (length and breadth), 2 constructors, and the following member functions a. Default constructor which initializes length and breadth to 0(zero). b. Parameterized Constructor that takes two arguments, length and breadth. c. Copy COnstructor d. Sets length and breadth. e. Calculate the area. f. Calculate the perimeter. 1. What is an inline function? 2. What is function overloading? 3. What is a reference variable? Give its syntax. 4. What are default arguments? 5. What is a class? Give the syntax. 6. What is an object? How do you create an object? 7. What is a constructor, destructor? 8. When are constructor & destructor called? 9. What are the different types of constructors? 10. What is a copy constructor?

WEEK-16(CLASSES): 1. Write a program to create a student class to store the details of the student (Name, Roll no, Marks in 5 subjects) Data members: (a) Name (b) Roll no (c) Marks in 5 subjects Member functions: (a) To enter the information. (b) To display the information. (c) To calculate the total marks obtained by the student and display it. (d) To calculate the percentage and display it. (e) Destructor. 2. Write a program to implement a matrix class to store the elements of a matrix and to add and multiply the matrices. Data members: (a) Rows. (b) Columns. (c) A 2D matrix. Member functions: (a) To read matrix. (b) To print the matrix. (c) To add two matrices and return the sum as an object. (d) To multiply the matrices and return the product as an object. Week 17 Class Bank Account - Demonstrates the use of static data member.

Create a class BankAccount with 1) account number, name, balance as data members. 2) Use a static data member interestrate to store the interest rate for each saver. 3) Provide the following member functions: 1. Constructor that initializes the data members. 2. Showbalance that displays the current balance of the saver. 3. Deposit function to deposit the amount entered by the user and update the balance. 4. Withdraw function to withdraw the amount entered by the user and update the balance. 5. Interest function to calculate the interest. (InterestAmount = balance * interestrate) 6. Modify intrest rate function to modify the interestrate. Instantiate two different objects (Ramu and Ravi) of class BankAccount with balances of Rs.3000 and Rs.5000 respectively. Initialize the interest rate to 8 percent. Then calculate monthly interest and print the new balances for each saver. Now modify the interest rate to 9 percent, calculate the monthly interest again and print the new balances for each saver. 1. What is a static data member? How is it different from a normal data member? Week 18(operator overloading): 1. Implement a complex class with the following: Member functions: (a) Constructor to initialize the real and imaginary parts of the complex number. (b) Display the complex number. (c) Overload operator +

Extra credit: (d) Using friend function Overload operator Using friend function overload operator << 1. What is a friend? 2. What are the advantages of friend function? 3. What is operator overloading? 4. What are the operators that cannot be overloaded? 5. Can operator overloading be implemented using friend function? 6. What is this pointer? 7. What is dynamic binding? 8. What are new and delete operators? WEEK-19(INHERITANCE AND FUNCTION TEMPLATE): 1. Implement the shape hierarchy based on the figure. Shape Rectangle Triangle Cuboid 2. Write a program to find the maximum and minimum numbers in a given list of 3 numbers using template function.

Viva Questions 1. What is polymorphism? 2. What is an abstract class? 3. What is a virtual function? 4. What is a pure virtual function? 5. Can a constructor be virtual? Can a destructor be virtual? 6. What is a function template? Give the syntax. 7. What is a class template? Give the syntax. 8. What is dynamic binding? 3. Write a program to count the number of words in the given text.