HOLIDAY HOMEWORK ASSIGNMENT-5 Q1. What will be the output of the following program segment Class Num { int x; float y; public: void init( ) { x = y =

Similar documents
HOLIDAYS HOMEWORK CLASS : XII. Subject : Computer Science

Q2) Define a class candidate in C++ with following Description: Private Members 4 Number) of type long

vinodsrivastava.com Constructor and Destructor

2016 COMPUTER SCIENCE

I Mid Semester May 2012 : Class XII : Computer Science Max Mark 50 : Time 2 Hrs. 1. a) What is macro in C++? Give example 2

SAMPLE PAPER. Class: XII SUBJECT COMPUTER SCIENCE. Time: 3 Hours MM: 70

COMPUTER SCIENCE (083)

Constructor & Classes Questions

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

Q2 Based on Class Concept and features Total Marks 10. Q2(A) Theory Based on Class Concept Marks :2

CLASS XII GUESS PAPER COMPUTER SCENCE (083)

KENDRIYA VIDYALAYA NO.02 AFS HINDAN G.BAD Holiday Homework Class XII Computer Science

SECTION A [Only for candidates, who opted for C++]

THE NAME OF THE CONSTRUCTOR AND DESTRUCTOR(HAVING (~) BEFORE ITS NAME) FUNCTION MUST BE SAME AS THE NAME OF THE CLASS IN WHICH THEY ARE DECLARED.

LAB 4.1 Relational Operators and the if Statement

Base class or Super class. Subclass or Derived class

CLASS-XI COMPUTER SCIENCE

COMPUTER SCIENCE 2002 (Delhi Board)

void main() { int global=7 ; func( ::global,global) ; cout<<global<<, <<::global<< \n ; func(global,::global) ; cout<<global<<, <<::global<< \n ; }

COMPUTER SCIENCE (083)

Sample Paper 2013 SUB: COMPUTER SCIENCE GRADE XII TIME: 3 Hrs Marks: 70

(d) Rewrite the following program after removing all the syntax error(s), if any. [2] include <iostream.h> void main ( )

KENDRIYA VIDYALAYA SANGATHAN, COMPUTER SCIENCE (THEORY) I PRE-BOARD TIME 3 HRS CLASS XII M. Marks 70

Sample Paper Class XII SUBJECT : COMPUTER SCIENCE

void Add() { cin >> trainnumber; gets(trainname); } void display() { cout<<trainnumber <<":"<<TrainName<<end;

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

KENDRIYA VIDYALAYA NO.1 SAGAR XII-COMPUTER SCIENCE ( ) HOMEWORK SUMMER VACATION


KUWAIT SAHODAYA EXAMINATION FIRST TERM SUBJECT : COMPUTER SCIENCE (083) : CLASS - XII SET - 3 Time : 3 Hours

COMPUTER SCIENCE 1998 (Delhi Board)

Page. No. 1/15 CS201 Introduction to Programmming Solved Subjective Questions From spring 2010 Final Term Papers By vuzs Team

Object Oriented Pragramming (22316)

Come and join us at WebLyceum

CS304 Object Oriented Programming Final Term

(4) Find the syntax error(s), if any, in the following program: #include main() int x[5],*y,z[5]; for(i=0;i<5;i++) x[i]=i; z[i]=i+3; y=z; x=y; (5) Rew

KENDRIYA VIDYALAYA SANGATHAN TINSUKIA REGION PRE BOARD EXAMINATION SUBJECT COMPUTER SCIENCE

Downloaded from

Lecture-5. Miscellaneous topics Templates. W3101: Programming Languages C++ Ramana Isukapalli

public : int min, hour ; T( ) //here constructor is defined inside the class definition, as line function. { sec = min = hour = 0 ; }

3/12/2018. Structures. Programming in C++ Sequential Branching Repeating. Loops (Repetition)

DELHI PUBLIC SCHOOL BOKARO STEEL CITY ASSIGNMENT FOR THE SESSION

Multiple Choice (Questions 1 14) 28 Points Select all correct answers (multiple correct answers are possible)

OBJECT ORIENTED PROGRAMMING. Ms. Ajeta Nandal C.R.Polytechnic,Rohtak

MEMORY ADDRESS _ REPRESENTATION OF BYTES AND ITS ADDRESSES

1- Write a single C++ statement that: A. Calculates the sum of the two integrates 11 and 12 and outputs the sum to the consol.

KE DRIYA VIDYALAYA SA GATHA CHE AI REGIO COMMO PREBOARD EXAMI ATIO COMPUTER SCIE CE. CLASS- XII Time Allowed: 3 hours Max.

Module Operator Overloading and Type Conversion. Table of Contents


University of Toronto

GE U111 Engineering Problem Solving & Computation Lecture 6 February 2, 2004

From Pseudcode Algorithms directly to C++ programs

Basic program The following is a basic program in C++; Basic C++ Source Code Compiler Object Code Linker (with libraries) Executable

COMPUTER SCIENCE Time allowed : 3hours] [Maximum Marks :70


Downloaded from

Homework #3 CS2255 Fall 2012

AN OVERVIEW OF C++ 1

Introduction to Programming I COS1511 School of Computing Revision Notes

ASSIGNMENT CLASS : XII ( ) COMPUTER SCIENCE

Homework Assignment #1

CAMBRIDGE SCHOOL, NOIDA ASSIGNMENT 1, TOPIC: C++ PROGRAMMING CLASS VIII, COMPUTER SCIENCE

Chapter-6 Classes and Objects. stud.execute(); getch();} Output:

Home Assignment for Class XII(Summer Vacation) Subject: CS Based on Library Functions ( 1 Mark)

Mock Test Paper-2. CBSE XII : Computer Science. Duration : 3hrs Max Marks : 70

o Counter and sentinel controlled loops o Formatting output o Type casting o Top-down, stepwise refinement

CSC 309/404 Section 901/910 Spring 2017 Midterm Exam Due: May 7 (Sun) 2015, 11:59 pm

Object-Oriented Programming (OOP) Fundamental Principles of OOP

KENDRIYA VIDYALAYA SANGATHAN BHUBANESWAR REGION SECOND PREBOARD EXAMINATION FOR CLASS XII SUBJECT: COMPUTER SCIENCE

CBSE Sample Paper for Computer Science Class XII.

CSCE Practice Midterm. Data Types

Fundamentals of Programming. Lecture 19 Hamed Rasifard

a data type is Types

Kapil Sehgal PGT Computer. Science Ankleshwar Gujarat

Programming Fundamentals II (C++ II) Final Exam June 17 th, Sun, 2007

Lecture 4. 1 Statements: 2 Getting Started with C++: LESSON FOUR

Computer Science 2006 (Delhi)

(a) Differentiate between a call by value and call by reference method.

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

CPE Summer 2015 Exam I (150 pts) June 18, 2015

Roll Number. Common to II Year B.E.CSE & EIE INTERNAL ASSESSMENT TEST - I. Credit 3 R-2017

Multiple Choice (Questions 1 14) 28 Points Select all correct answers (multiple correct answers are possible)

Topics: Material through example 19 (types, operators, expressions, functions, selection, loops, arrays)

CIS*2430 (Fall 2012) Miterm Exam (I) Solutions

COMS W3101 Programming Language: C++ (Fall 2015) Ramana Isukapalli

COM S 213 PRELIM EXAMINATION #2 April 26, 2001

Collected By Anonymous

PROBLEM 1 : (Vocabulary: 12 points) For each of the words/phrases below, circle the denition that is the best description as it pertains in the contex

Variables, Memory and Pointers

Sample Paper COMPUTER SCIENCE (Theory) Class-XII Time Allowed: 3hours Maximum Marks: 70

COMPUTER APPLICATIONS

JB Academy, Faizabad Half Yearly Examination Subject: Computer Science (083) Class XII

CSI33 Data Structures

case control statement (switch case)

Darshan Institute of Engineering & Technology for Diploma Studies

COMS W3101 Programming Language: C++ (Fall 2015) Ramana Isukapalli

OBJECTS. An object is an entity around us, perceivable through our senses. Types of Object: Objects that operate independently.

Lecture 12. We have already used strings. Strings. Hello Class is a string.

UNIT- 3 Introduction to C++

ITL Public School First Term( )

Computer Department. Question (1): State whether each of the following is true or false. Question (2): Select the correct answer from the following:

Transcription:

HOLIDAY HOMEWORK ASSIGNMENT-5 Q1. What will be the output of the following program segment Class Num { int x; float y; void init( ) { x = y = 0; void read(int i, float j) { x = i; y = j; void Display ( ) { cout << x << x << endl; cout << y << y<< endl; ; void main ( ) { X obj 1, obj2; obj1.init( ) ; obj2.init( ) ; obj1.read(15, 11.21); obj1.display( ); obj2.display( ); Q2. Identify the errors in the following program code- class myclass { int a,b; void set (int i,int j ) { a = i ; b = j; void show ( ) { cout <<a<<b<<endl ; ; class yourclass { int a,b; void set (int i, int j ) { a = i ; b = j ; void show ( ) { cout << a << b <<endl; ; void main ( ) { myclass obj 1; yourclass obj 2; obj1.set(10,4) ; obj2=obj1; obj1.show( ); obj 2.show( );

Q3 What is wrong in the following class declaration--- class { private : char name [ 20], int age ; void Read( ); Public void Display ( ); void main() { employee e; employee.display( ); e.read( ); Q4. Answer the questions (i) and (ii) after going through the following program- # include<string.h> class Bazar { char Type[20] ; char product[20] ; int qty; float price ; Bazar( ) // Function 1. { strcpy(type, Electronic ) ; strcpy(product, calculator ) ; qty=10; price=225 ; void Disp( ) // Function 2 {cout <<Type << <<product << : < < qty << @ << price << endl ; ; void main ( ) { Bazar B ; B.Disp( ) ; Q(i) Will statement 1 initialize all the data members for object B with the values given in the Function 1?(YES or No). Justify your answer suggesting the corrections to be made in the above code. Q(ii). What shall be the possible output when the program gets executed? Q5. Find the syntax errors, if any---- class ABC { int x=10; float y ; ABC ( ) {y=5 ; ~ ( ) { void main() { ABC a1, a2 ; 2

Q6. Answer the questions (i) and (ii) after going through the following programclass Science { char Topic [20]; int weightage ; Science( ) // Function 1 { strcpy (Topic, Optics ) ; weightage = 30 ; cout << Topic Activated ; ~ Science( ) // Function 2 { cout << Topic Deactivated ; ; (i) Name the specific features of class shown by Function 1 and Function 2 in the above example. (ii) How would Function 1 and Function 2 gets executed? Q7. Rewrite the following program after removing the syntactical errors (if any). Underline each correction. # include [iostream.h] class Member { int Mno ; float Fees ; PUBLIC: void Register( ) { cin>>mno>> Fees ; void Display { cout <<Mno<< : <<Fees << endl ; ; void main ( ) { Member M ; Register ( ) ; M.Display ( ); Q8. Find the output of the following program segment- class student { private : static int count ; int rollno,marks ; void enter( int r, int m) { rollno = r ; marks = m ; count + + ; void show( ) { cout << Roll number << rollno <<endl ; cout << Marks << marks << endl ; static void showcount ( ) { cout << count = << count << endl ; ; int student::count = 0 ; void main( ) { student obj1, obj2, obj3 ; obj1.enter(1001, 99) ; student::showcount(); obj2.enter(1002,88); student::showcount(); 3

obj3.enter(1003,100);student::showcount(); obj1.show();obj2.show();obj3.show(); Q9. What s wrong with this? class C { int x = 0 ; ; Q10. Given the following C++ code, answer the question (i) & (ii) class TestMeOut { ~ TestMeOut() // Function 1 { cout << Leaving the examinination hall <<endl; TestMeOut() // Function 2 { cout << Appearing for examination << endl ; void MyWork ( ) //Function 3 { cout << Attempting Questions << endl ; ; (i) In object oriented programming, what is function 1 referred as and when does it get invoked/called? (ii)in object oriented programming, what is function 2 referred as and when does it get invoked/called? Q11.Answer the question (i) and (ii) after going through the following program- # include <string.h> class AirIndia { char flightno[5] ; int noofpassenger ; AirIndia() // Function 1 { strcpy(flightno, ) ; noofpassenger = 0 ; AirIndia (char str, int n) //Function 2 { strcpy(flightno, str) ; noofpassenger = n ; void Input () // Function 3 { cin >> flight no; cin >>noofpassenger ; ~AirIndia () // Function 4 { cout << counter closed << endl : ; (i) In object oriented programming, which concept is illustrated by Function 1 and Function 2 together? Write the statement to call these functions. (ii) What is the scope of two data members of the class AirIndia? What does the scope of data members depend upon? Q12.Answer the question (i) and (ii) after going through the following class Class Interview { int month ; Interview (int y) { month = y ; // constructor 1 Interview (Interview & t); // constructor 2 4

; (i) create an object, such that it invokes constructor 1 (ii) Write complete definition for constructor 2. Q13. Consider the following and answer the questions given belowclass University { int NOC ; // Number of Colleges protected: char Uname [25] ; // University Name University() ; char State [25] ; void EnterData() ; void DisplayData( ) ; ; class College : public University { int NOD ; // Number of Departments char Cname[25] ; // College Name protected : void Affiliation ( ) ; College( ) ; void Enrol(int, int) ; void Show ( ) ; ; class Department:public College { char Dname[25] ; // department int Nof; // No. of faculty members. Department( ) ; void Display( ) ; void Input( ) ; ; (i) Which class s constructor will be called first at the time of declaration of an object of class Department? (ii) How many bytes does an object belonging to class department require? (iii)name the member functions, which are accessible from the objects of class Department. (iv) Name the data members, which are accessible from the objects of class College. Q14. Define a class PLAY in C++ with the following specifications private members play code integer play title 25 character duration float noofscenes integer public members A constructor function to initialize duration as 45 and no of scenes as 5. NewPlay( ) function to accept values for playcode & playtitle. Moreinfo( ) function to assign the values of duration and no of scenes with the help of corresponding values passed as parameters to this function. Showplay ( ) function to dislpay all the data members on the screen. Q15. Consider the following class declaration and answer the questions below- 5

Class Abc { private : int x,y ; void err_1( ) { cout << error ; void Xdata (int d) { x = d ; y = d++ ; void Ydata ( ) { cout <<x<<y ; ; a) Write the name that specifies the above class. b) Write the data of the class with their access scope. c) Write all member functions of the class along with their access scope. d) Indicate the member function of the class Abc that sets the data. Q16. Define a class complex for a set of overloaded function called multiply ( ) that perform-- (i) multiplication between complex number and complex number, returning complex number. (ii) between complex number and floating point number returning complex number. (iii) between floating point number & floating point number returning floating point number. ( HINT : i) complex multiply(complex, complex) ; ii) complex multiply(complex,float) ; OR complex multiply(float, complex) ; iii) float multiply(float, float) ; Q17. In the following program, if the value of N given by the user is 15, what maximum and minimum values the program could possible display? # include <stdlib.h> void main() { int N, Guessme ; randomize( ) ; cin >> N ; Guessme = random (N) + 10 ; cout << Guessme <<endl; Q18. In the following program, if the value of N given by the user is 20 what maximum and minimum values the program could possibly display? # include <stdlib.h> void main( ) { int N,Guessnum ; randomize ( ) ; cin >> N ; Guessnum = random (N-10) + 10 ; cout << Guessnum << endl; 6

Q19. Answer the questions (i) & (ii) after going through the following class --- class seminar { int Time ; seminar ( ) // Function 1 { Time = 30 ; cout << seminar starts now << endl; void Lecture ( ) // Function 2 { cout << Lecture in the seminar << endl; seminar (int Duration ) // Function 3 { Time = Duration ; cout << seminar starts now << endl ; ~ Seminar ( ) // Function 4 { cout << vote of thanks << endl ; ; Q(i) In object oriented programming, what is Function 4 referred as and when does it get invoked/called? Q(ii) In object oriented programming, which concept is illustrated by Function 1 and Function 3 together? Q20. Declare a class myfolder with the following specification--- private members Filenames - an array of strings of size [10] [25] ( to represent all the names of files inside myfolder). Availspace - long ( to represent total number of bytes available in myfolder). Usedspace - long ( to represent total number of bytes used in myfolder). Public members Newfileentry() A function to accept values of Filenames, Availspace, and Usedspace from user. Retavailspace() - A fnction that returns the value of total Kilobytes available( 1 Kb=1024 bytes). Showfiles( ) --- a function that displays the names of all the files in Myfolder. Q21. Define a class with complete function definition COMPETITION in C++ with the following specifications Private members event_no ----- integer description ----- char(30) score ----- integer qualified ----- char(1) public members input ( ) ---- to take input for event_no, description and score. award ( ) ---- to award qualified as y if score is more than the cut off score passed as int to the function else award N. show ( ) ---- to display all details. 7

8