Constructor & Classes Questions

Size: px
Start display at page:

Download "Constructor & Classes Questions"

Transcription

1 (1)Answer the questions (i) and (ii) after going through the following program: class Match int Time; Match() //Function 1 Time=0; cout<< Match commences <<end1; void Details() //Function 2 cout<< InterSectionBasketball Match <<end1; Match(int Duration) //Function 3 Time=Duration; cout<< Another Match begins now <<end1; Match(Match &M) //Function 4 Time=M.Duration; cout<< Like Previous Match <<end1; ; (i)which category of constructor - Function 4 belongs to and what is the purpose of using it? (ii)write statements that would call the member Functions 1 and 3 (2)Answer the questions (i) and (ii) after going through the following class: class Seminar int Time; Seminar() //Function 1 Time=30;cout<< Seminar starts now <<end1; void Lecture() //Function 2 cout<< Lectures in the seminar on <<end1; Seminar(int Duration) //Function 3 Time=Duration;cout<< Seminar starts now <<end1; ~Seminar() //Function 4 cout<< Vote of thanks <<end1; ; (i)in Object Oriented Programming, what is Function 4 referred as and when does it get invoked/ called? (ii)in Object Oriented Programming, which concept is illustrated by Function 1 and Function 3 together? Write an example illustrating the calls for these functions. (3)Answer the questions (i) and (ii) after going through the following class: class player int health; int age; player() health=6; age=18 player(int s, int a) health =s; age = a ; player( player &p) ~player() cout<< Memory Deallocate ; ; void main() player p1(7,24); //Constructor1 //Constructor2 //Constructor3 //Destructor //Statement1 player p3 = p1; //Statement3 (i) When p3 object created specify which constructor invoked and why? (ii) Write complete definition for Constructor3? (4) Answer the questions (i) and (ii) after going through the following class : 1

2 class number float M; char str[25]; number( ) //constructor 1 M=0; str= \0 ; number(number &t); //constructor 2 ; i) Write c++ statement such that it invokes constructor 1. ii) Complete the definition for constructor 2. (5)class Text char Paper[20]; int Marks; Test() // Function 1 strcpy(paper, Computer ); Test(char p[]) // Function 2 strcpy(paper, P); Test (int M) // Function 3 strcpy(paper, Computer ); Test(char P[], int M) // Function 4 strcpy(paper, P); ; (i) Which feature of Object Oriented Programming is demonstrate using Function 1, Function 2, Function 3 and Function 4 in the above class Test? (ii) Write statements in C++ that would Function 2 and Function $ of class Test. (6) class Exam int Marks; char Subject[20]; Exam() // Function 1 strcpy(subject, Computer ); Exam(char s[]) // Function 2 strcpy(subject, S); Exam(int M) // Function 3 strcpy(subject, Computer ); 2

3 Exam(char S[], int M) // Function 4 strcpy(subject, S); ; (i) Which statements in C++ that would execute Function 3 and Function 4 of class Exam. (ii) Which feature of Object Oriented Programming is demonstrated using Function 1, Function 2, Function 3, and Function 4 in the above class Exam? (7) class TestMeout ~TestMeout() // Function 1 cout<< Leaving the exam ; TestMeout() // Function 2 cout<< Appearing the exam ; void MyWork()// Function 3 cout<< Attempting the questions ; ; (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? (8) Define a class in C++ with following description: Private Members A data member Flight number of type integer A data member Destination of type string A data member Distance of type float A data member Fuel of type float A member function CALFUEL() to calculate the value of Fuel as per the following criteria Distance Fuel<=1000 and >500 more than 1000 and <= more than 2000 and <=2200 Public Members A function FEEDINFO() to allow user to enter values for Flight Number, Destination, Distance & call function CALFUEL() to calculate the quantity of Fuel A function SHOWINFO() to allow user to view the content of all the data members (9) Define a class TEST in C++ with following description: Private Members TestCode of type integer Description of type string NoCandidate of type integer CenterReqd (number of centers required) of type integer A member function CALCNTR() to calculate and return the number of centers as (NoCandidates/ 100+1) Public Members A function SCHEDULE() to allow user to enter values for TestCode, Description, NoCandidate & call function CALCNTR() to calculate the number of Centres A function DISPTEST() to allow user to view the content of all the data members (10) Define a class named Publisher in C++ with the following descriptions : Private members Id long title 40 char 3

4 author price, stockqty stockvalue valcal() 40 char double double A function to find price*stockqty with double as return type Public members a constructor function to initialize price, stockqty and stockvalue as 0 Enter() function to input the idnumber, title and author Takestock() function to increment stockqty by N(where N is passed as argument to this function) and call the function valcal() to update the stockvalue(). sale() function to decrease the stockqty by N (where N is sale quantity passed to this function as argument) and also call the function valcal() to update the stockvalue outdata() function to display all the data members on the screen. (11) Define a class Employee in C++ with the following specification: Private Members: ename an array of char of size[50] ( represent employee name) deptnamean array of char of size[20] ( represent department name) salary integer ( represent total salary of an employee) bonus float CalBonus() This function calculate the total bonus given to an employee according to following conditions Deptname Bonus Accounts 4 % of salary HR 5% of salary IT 2% of salary Sales 3% of salary Marketing 4% of salary Public Members: Constructor to initialise ename and deptname to NULL and salary and bonus to 0. A function read_info to allow user to enter values for ename, deptname,salary & Call function CalBonus() to calculate the bonus of an employee. A Function disp_info() to allow user to view the content of all the data members. (12)A class TRAVEL with the following descriptions: Private members are : Tcode, no_of_pass, no_of_buses integer (ranging from 0 to 55000) Place string Public members are: A constructor to assign initial values of Tcode as 101, Place as Varanasi, no_of_pass as 5, no_of_buses as 1. A function INDETAILS( ) to input all information except no_of_buses according to the following rules : Number of passengers Number of buses Less than 40 1 Equal to or more than 40 & less than 80 2 Equal to or more than 80 3 A function OUTDETAILS( ) to display all the information. (13) Define a class teacher with the following specifications: Private members of class teacher name 20 characters subject 10 characters basic, hra,da float netpay float calculate() A function computes the net salary and returns it netpay is sum of basic, hra,da with float return type. Public members function of class employee readdata() function to accept the data values and invoke the calculate function displaydata() function prints the data on the screen (14) A class CLOCK has the following members: Data member 4

5 hour of type integer minute of type integer Member function readtime( int h, int m) showtime() //To display data member addtime( time T1, time T2) Write a program to input two different objects FT and ST, print their sum(assuming 24 hours clock time) (15) Define a class report with the following specifications: Private members: adno 4 digit admission member name 20 characters marks an array of 5 floating point values average average marks obtained getavg() to compute the average obtained in five subjects Public members: readinfo() function to accept values for adno, name, marks, and invoke the function getavg(). displayinfo() function to display all data members on the screen you should give function definitions. (16) Consider the following class declaaration and answer the question below: class SmallObj private: int some, more; void err_1() cout<< error ; void Xdata(int d) some=d; more=d++; void Ydata() cout<<some<< <<more; ; (i) Write the name that specifies the above class. (ii) Write the data of the class with their access scope (iii) Write all member functions of the class along with their access scope. (iv) Indicate the member function of the SmallObj that sets data. 5

6 (17) Define a class Travel in C++ with the description given below: Private Members: T_code of type string No_of_Adults of type integer No_of_Children of type integer Distance of type integer TotalFare of type of float Public Members: A constructor to assign initial values as follows: T_code with the word NULL No_of_Adults as 0 No_of_Children as 0 Distance as 0 Total as 0 A function AssignFare() which calculates and assigns the value of the data member TotalFare as follows: For each Adult Fare(Rs) For Distance (Km) 1. >= <1000 & >= <500 For each Child the above Fare will be 50% of the Fare mentioned in the above table. If Distance is 750, No_of_Adults=3 and No_of_Children=2 then TotalFare should be calculated as No_of_Adults*300+No_of_Children*150 i.e. 3*300+2*150=1200 A function EnterTraveK() to input the values of the data members T_code, No_of_Adults, No_of_Children and Distance; and invoke the AssignFare() function A function Show TraveK() which displays the content of all the data members for a Travel (18) Define a class Clothing in C++ with the following descriptions: Private Members: Code of type string Type of type string Size of type integer Material of type string Price of type float A function Calc_Price() which calculates and assigns the value of Price as follows: For the value of of Material as COTTON Type Price(Rs) TROUSER 1500 SHIRT 1200 for Material other than COTTON the above mentioned Price gets reduced by 25% Public Members: A constructor to assign initial values of Code, Type and Material with the word NOT ASSIGNED and Size and Price with 0. A function Enter() to input the values of the data members Code, Type, Size and Material and invoke the CalcPrice() function. A function Show() which displays the content of all the data members for a Clothing. 6

Class and object Holiday Homework

Class and object Holiday Homework Class and object Holiday Homework 1.Define a class student with the following specification: Private members admno integer type sname 20 character eng, math,sci, total float ctotal( ) A function to calculate

More information

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

Q2) Define a class candidate in C++ with following Description: Private Members 4 Number) of type long KVITBP DEHRADUN SUMMER BREAK HOMEWORK, XII COMP SC, LEVEL A Q1) Define a class TEST in C++ with following description: Private Members: TestCode of type integer Description of type string NoCandidate of

More information

INTERNATIONAL INDIAN SCHOOL, RIYADH. Ch 1 C++ Revision tour

INTERNATIONAL INDIAN SCHOOL, RIYADH. Ch 1 C++ Revision tour Grade- XII Computer Science Worksheet Ch 1 C++ Revision tour 1) Explain in brief the purpose of function prototype with the help of a suitable example. 2) What is the benefit of using default parameter/argument

More information

KENDRIYA VIDYALAYA NO-1 ARMAPUR

KENDRIYA VIDYALAYA NO-1 ARMAPUR HOME ASSIGNMENT FOR SUMMER VACATION DAYS LESSONS MLL (MINIMUM LEVEL LEARNING) HOT(HIGH ORDER THINKING) 1 2 3 4 1. Differentiate between call by value & call by reference with suitable examples in reference

More information

KENDRIYA VIDYALAYA TIRUMALAGIRI,SECUNDERABAD UNIT TEST II

KENDRIYA VIDYALAYA TIRUMALAGIRI,SECUNDERABAD UNIT TEST II KENDRIYA VIDYALAYA TIRUMALAGIRI,SECUNDERABAD UNIT TEST II SUB : COMPUTER SCIENCE CLASS : XII TIME : 90 MINS M.M: 40 1.a. Differentiate between default & parameterized constructor with suitable example.

More information

Session Chapter 4: Classess & Object

Session Chapter 4: Classess & Object Session 2017-18 Chapter 4: Classess & Object How does a class enforce data-hiding, abstraction, and encapsulation? What is the significance of access specifiers in a class? How are class and object different

More information

List of Practical for Class XII Computer Science

List of Practical for Class XII Computer Science List of Practical for Class XII Computer Science P.01. Write a complete C++ program to define class Garment with following description: Private members: Code - type string Type - type string Size - type

More information

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

JB Academy, Faizabad Half Yearly Examination Subject: Computer Science (083) Class XII JB Academy, Faizabad Half Yearly Examination - 2017-18 Subject: Computer Science (083) Class XII Time: 3 Hours Max. Marks: 70 Instructions: i) All questions are compulsory and so attempt all. ii) Programming

More information

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

KENDRIYA VIDYALAYA NO.02 AFS HINDAN G.BAD Holiday Homework Class XII Computer Science KENDRIYA VIDYALAYA NO.02 AFS HINDAN G.BAD Holiday Homework 2018-19 Class XII Computer Science Topics covered 1) Classes and objects 2) Constructors and destructors 3) Inheritance 4) Review of class XI

More information

KENDRIYA VIDAYALAYA PANGODE MONTHLY TEST AUGUST 2015

KENDRIYA VIDAYALAYA PANGODE MONTHLY TEST AUGUST 2015 KENDRIYA VIDAYALAYA PANGODE MONTHLY TEST AUGUST 2015 CLASS: XII COMPUTER SCIENCE TIME: 1½ hrs TOTAL MARKS: 35 1. How can we make private members inheritable? (1) 2. Find out errors in the following program:-

More information

KENDRIYA VIDYALAYA SANGATHAN TINSUKIA REGION PRE BOARD EXAMINATION SUBJECT COMPUTER SCIENCE

KENDRIYA VIDYALAYA SANGATHAN TINSUKIA REGION PRE BOARD EXAMINATION SUBJECT COMPUTER SCIENCE CLASS- XII MAX MARKS-70 KENDRIYA VIDYALAYA SANGATHAN TINSUKIA REGION PRE BOARD EXAMINATION 01-15 SUBJECT COMPUTER SCIENCE TIME- HOURS Q1 a) What is the Difference between Global Variable and Local Variable?

More information

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 =

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 = 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 (

More information

ASSIGNMENT CLASS : XII ( ) COMPUTER SCIENCE

ASSIGNMENT CLASS : XII ( ) COMPUTER SCIENCE ASSIGNMENT CLASS : XII (2015-16) COMPUTER SCIENCE Short answer typequestions: 1.(a)What is the difference between logical error and runtime error? Give suitable example for the same. (b) What is the difference

More information

THE ASIAN SCHOOL, DEHRADUN HOLIDAY HOMEWORK FOR SUMMER VACATION 2013 FOR CLASS XII

THE ASIAN SCHOOL, DEHRADUN HOLIDAY HOMEWORK FOR SUMMER VACATION 2013 FOR CLASS XII THE ASIAN SCHOOL, DEHRADUN HOLIDAY HOMEWORK FOR SUMMER VACATION 2013 FOR CLASS XII English: Core Read the following chapters and write the review of each:- (a) Flamingo (i) Rattrap (ii) Indigo (b) Vistas

More information

CONSTRUCTOR AND DESTRUCTOR

CONSTRUCTOR AND DESTRUCTOR CONSTRUCTOR AND DESTRUCTOR 1. CONSTRUCTOR A member function with the same name as its class is called Constructor and it is used to initialize the objects of that class type with a legal initial value.

More information

Series SHC COMPUTER SCIENCE. Code No. 91. Roll No.

Series SHC COMPUTER SCIENCE. Code No. 91. Roll No. Roll No. Series SHC Code No. Please check that this question paper contains 11 printed pages. Code number given on the right hand side of the question paper should be written on the title page of the answer-book

More information

KENDRIYA VIDYALAYA ALIGANJ SHIFT-II HOLIDAY HOME WORK XII COMPUTER SCIENCE ARRAY AND STRUCTURES

KENDRIYA VIDYALAYA ALIGANJ SHIFT-II HOLIDAY HOME WORK XII COMPUTER SCIENCE ARRAY AND STRUCTURES KENDRIYA VIDYALAYA ALIGANJ SHIFT-II HOLIDAY HOME WORK- 2018-19 XII COMPUTER SCIENCE ARRAY AND STRUCTURES 1. Write a function which will take a string and returns the word count. Each word is separated

More information

SAMPLE PAPER-2015 CLASS-XII COMPUTER SCIENCE Time allowed: 3 hr. MM: 70

SAMPLE PAPER-2015 CLASS-XII COMPUTER SCIENCE Time allowed: 3 hr. MM: 70 SAMPLE PAPER-2015 CLASS-XII COMPUTER SCIENCE Time allowed: 3 hr. MM: 70 1. (a) While implementing encapsulation, abstraction is also implemented. Comment 2 (b) Name the header file to which the following

More information

COMPUTER SCIENCE 2002 (Delhi Board)

COMPUTER SCIENCE 2002 (Delhi Board) COMPUTER SCIENCE 2002 (Delhi Board) Time allowed: 3 hours Max. Marks: 70 Instructions: (i) All the questions are compulsory. (ii) Programming Language: C++ QUESTION l. (a) What the purpose of a header

More information

Guru Gobind Singh Public School Sector : V/B, Bokaro Steel City

Guru Gobind Singh Public School Sector : V/B, Bokaro Steel City Guru Gobind Singh Public School Sector : V/B, Bokaro Steel City 1. a) Write the types of tokens(keywords and user identifiers) from the following : i) case ii) _delete iii) WHILE iv) 21stName b) Which

More information

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

Q2 Based on Class Concept and features Total Marks 10. Q2(A) Theory Based on Class Concept Marks :2 Q2 Based on Class Concept and features Total Marks 10 Q2(A) Theory Based on Class Concept Marks :2 1. Differentiate between members, which are present within the private visibility mode with those which

More information

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

public : int min, hour ; T( ) //here constructor is defined inside the class definition, as line function. { sec = min = hour = 0 ; } . CONSTRUCTOR If the name of the member function of a class and the name of class are same, then the member function is called constructor. Constructors are used to initialize the object of that class

More information

CLASS XII GUESS PAPER COMPUTER SCENCE (083)

CLASS XII GUESS PAPER COMPUTER SCENCE (083) CLASS XII GUESS PAPER COMPUTER SCENCE (083) TIME: 3 hours MARKS: 70 Q1. Please check that this question paper contains 11 printed pages. Code-snippets in questions may be printed wrong rectify the errors

More information

DELHI PUBLIC SCHOOL BOKARO STEEL CITY ASSIGNMENT FOR THE SESSION

DELHI PUBLIC SCHOOL BOKARO STEEL CITY ASSIGNMENT FOR THE SESSION DELHI PUBLIC SCHOOL BOKARO STEEL CITY ASSIGNMENT FOR THE SESSION 2017 2018 Class: XII Subject : Computer Science Assignment No. 3 1. a) What is this pointer? Explain with example. b) Name the header file

More information

INDIAN SCHOOL MUSCAT FIRST TERM EXAMINATION

INDIAN SCHOOL MUSCAT FIRST TERM EXAMINATION Roll Number SET 1 INDIAN SCHOOL MUSCAT FIRST TERM EXAMINATION COMPUTER SCIENCE CLASS: XII Sub. Code: 08 Time Allotted: Hr 09.05.018 Max. Marks: 70 GENERAL INSTRUCTIONS: 1. All questions are compulsory..

More information

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

Home Assignment for Class XII(Summer Vacation) Subject: CS Based on Library Functions ( 1 Mark) Home Assignment for Class XII(Summer Vacation) Subject: CS Based on Library Functions ( 1 Mark) Q1. Write the names of the header files to which the following belong: (i) isdigit() (vi) setw() (ii) strcmp()

More information

4 Marks Questions Programming in C++ 1. Define a class Serial in C++ with the following specifications: Private members of class Serial Serialcode integer Title 20 characters Duration float Noofepisodes

More information

Computer Science, Class XII ( ) (Autumn Break-2015) (Holiday H.W) Chapter No.4 to 6, 11 to 13

Computer Science, Class XII ( ) (Autumn Break-2015) (Holiday H.W) Chapter No.4 to 6, 11 to 13 (Autumn Break-2015) (Holiday H.W) Chapter No.4 to 6, 11 to 13 1. How does a class enforce data hiding, abstraction and encapsulation? Give a suitable example using a C++ code to illustrate the same. 2.

More information

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

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 I Mid Semester May 01 : Class XII : Computer Science Max Mark 50 : Time Hrs 1. a) What is macro in C++? Give example b) Give the Header file for the following functions:- i) gets ( ) ii) tolower( ) 1 c)

More information

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

Chapter-6 Classes and Objects. stud.execute(); getch();} Output: Chapter-6 Classes and Objects Examples: 1.Specifying a class: class student char name[30]; int rollno,mark1,mark2,total_marks; void accept() cout>name>>rollno>>mark1>>mark2;

More information

Informatics Practices - Assignments. A Practical Workbook

Informatics Practices - Assignments. A Practical Workbook Informatics Practices - Assignments (based on JAVA & SQL) A Practical Workbook Class XII 1 Assignments based on JAVA 1. Create a java Desktop application to find the largest number among the three floating

More information

3.Constructors and Destructors. Develop cpp program to implement constructor and destructor.

3.Constructors and Destructors. Develop cpp program to implement constructor and destructor. 3.Constructors and Destructors Develop cpp program to implement constructor and destructor. Constructors A constructor is a special member function whose task is to initialize the objects of its class.

More information

Code No. 083 Time allowed: 3 hours Maximum Marks: 70 Instructions: (i) All questions are compulsory. (ii) Programming language: C++

Code No. 083 Time allowed: 3 hours Maximum Marks: 70 Instructions: (i) All questions are compulsory. (ii) Programming language: C++ Sample Paper Class XII Subject Computer Science Please check that this question paper contains 7 printed pages. Code number given on the right hand side of the question paper should be written on the title

More information

Exam Duration: 2hrs and 30min Software Design

Exam Duration: 2hrs and 30min Software Design Exam Duration: 2hrs and 30min. 433-254 Software Design Section A Multiple Choice (This sample paper has less questions than the exam paper The exam paper will have 25 Multiple Choice questions.) 1. Which

More information

DELHI PUBLIC SCHOOL, RUBY PARK, KOLKATA CLASS XII SUBJECT: COMPUTER SCIENCE QUESTION BANK FILE HANDLING:-

DELHI PUBLIC SCHOOL, RUBY PARK, KOLKATA CLASS XII SUBJECT: COMPUTER SCIENCE QUESTION BANK FILE HANDLING:- DELHI PUBLIC SCHOOL, RUBY PARK, KOLKATA CLASS XII SUBJECT: COMPUTER SCIENCE QUESTION BANK FILE HANDLING:- 1. Write a function in C++ to count and display the number of lines not starting with alphabet

More information

COMMON PRE-BOARD EXAMINATION COMPUTER SCIENCE

COMMON PRE-BOARD EXAMINATION COMPUTER SCIENCE SET Subject Code: 08 COMMON PRE-BOARD EXAMINATION 07-08 COMPUTER SCIENCE CLASS XII Time Allowed: hours Maximum Marks: 70 General Instructions: Please check that this question paper contains 9 printed pages.

More information

A506 / C201 Computer Programming II Placement Exam Sample Questions. For each of the following, choose the most appropriate answer (2pts each).

A506 / C201 Computer Programming II Placement Exam Sample Questions. For each of the following, choose the most appropriate answer (2pts each). A506 / C201 Computer Programming II Placement Exam Sample Questions For each of the following, choose the most appropriate answer (2pts each). 1. Which of the following functions is causing a temporary

More information

COMPUTER SCIENCE (Theory) - Class XII Marking Scheme

COMPUTER SCIENCE (Theory) - Class XII Marking Scheme COMPUTER SCIENCE (Theory) - Class XII Marking Scheme 1 a) Call by value l It is a used to create a temporary copy of data coming from actual parameter.the changes done in the function in the formal parameter

More information

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

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 Sample Test Paper-I Marks : 25 Time:1 Hrs. Q1. Attempt any THREE 09 Marks a) State four relational operators with meaning. b) State the use of break statement. c) What is constant? Give any two examples.

More information

cout<< \n Enter values for a and b... ; cin>>a>>b;

cout<< \n Enter values for a and b... ; cin>>a>>b; CHAPTER 8 CONSTRUCTORS AND DESTRUCTORS 8.1 Introduction When an instance of a class comes into scope, a special function called the constructor gets executed. The constructor function initializes the class

More information

CS201 Some Important Definitions

CS201 Some Important Definitions CS201 Some Important Definitions For Viva Preparation 1. What is a program? A program is a precise sequence of steps to solve a particular problem. 2. What is a class? We write a C++ program using data

More information

CHAPTER 9 INHERITANCE. 9.1 Introduction

CHAPTER 9 INHERITANCE. 9.1 Introduction CHAPTER 9 INHERITANCE 9.1 Introduction Inheritance is the most powerful feature of an object oriented programming language. It is a process of creating new classes called derived classes, from the existing

More information

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

Programming Fundamentals II (C++ II) Final Exam June 17 th, Sun, 2007 Programming Fundamentals II (C++ II) Final Exam June 17 th, Sun, 2007 NAME:...Number:... Question 1 Define class section that has the following attributes: coursename, coursenumber as integer, credithours

More information

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

COMS W3101 Programming Language: C++ (Fall 2015) Ramana Isukapalli COMS W3101 Programming Language: C++ (Fall 2015) ramana@cs.columbia.edu Lecture-2 Overview of C continued C character arrays Functions Structures Pointers C++ string class C++ Design, difference with C

More information

COMPUTER SCIENCE C++(083) ASSIGNMENT BOOKLET CLASS XII. Academic Session:

COMPUTER SCIENCE C++(083) ASSIGNMENT BOOKLET CLASS XII. Academic Session: COMPUTER SCIENCE C++(083) ASSIGNMENT BOOKLET CLASS XII Academic Session: 2017-18 Computer Science Class XII (C++) Page 1 INDEX Class XII S.No. Topic Page # 1. Month wise breakup of syllabus 3 2. Concepts

More information

Common Misunderstandings from Exam 1 Material

Common Misunderstandings from Exam 1 Material Common Misunderstandings from Exam 1 Material Kyle Dewey Stack and Heap Allocation with Pointers char c = c ; char* p1 = malloc(sizeof(char)); char** p2 = &p1; Where is c allocated? Where is p1 itself

More information

AUTUMN BREAK HOLIDAY HOMEWORK

AUTUMN BREAK HOLIDAY HOMEWORK AUTUMN BREAK HOLIDAY HOMEWORK 2018-19 Subject Computer Class 3 Q1. Write about the Keyboard and its use? Q2. Define what is CPU? Q3 Write about the MS Paint? Q4. What is the use of Enter and Del keys?

More information

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

COMS W3101 Programming Language: C++ (Fall 2015) Ramana Isukapalli COMS W3101 Programming Language: C++ (Fall 2015) ramana@cs.columbia.edu Lecture-2 Overview of C continued C character arrays Functions Structures Pointers C++ string class C++ Design, difference with C

More information

Kapil Sehgal PGT Computer. Science Ankleshwar Gujarat

Kapil Sehgal PGT Computer. Science Ankleshwar Gujarat Classes Chapter 4 Classes and Objects Data Hiding and Encapsulation Function in a Class Using Objects Static Class members Classes Class represents a group of Similar objects A class is a way to bind the

More information

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

SECTION A [Only for candidates, who opted for C++] PRINCE PUBLIC SCHOOL HALF YEARLY EXAMINATION (2018-19) SAMPLE PAPER-1 COMPUTER SCIENCE XII TIME ALLOWED: 3 HOURS MAXIMUM MARKS: 70 General Instructions 1. This question paper conations 4 questions. 2.

More information

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

COMS W3101 Programming Language: C++ (Fall 2016) Ramana Isukapalli COMS W3101 Programming Language: C++ (Fall 2016) ramana@cs.columbia.edu Lecture-2 Overview of C C++ Functions Structures Pointers Design, difference with C Concepts of Object oriented Programming Concept

More information

91/1 COMPUTER SCIENCE. Series SHC/1. dksm ua- jksy ua- Code No. Roll No. Candidates must write the Code on the title page of the answer-book.

91/1 COMPUTER SCIENCE. Series SHC/1. dksm ua- jksy ua- Code No. Roll No. Candidates must write the Code on the title page of the answer-book. Series SHC/1 Roll No. jksy ua- Code No. dksm ua- Candidates must write the Code on the title page of the answer-book. Please check that this question paper contains 12 printed pages. Code number given

More information

KENDRIYA VIDYALAYA SANGATHAN ERNAKULAM REGION FIRST PRE-BOARD EXAMINATION COMPUTER SCIENCE

KENDRIYA VIDYALAYA SANGATHAN ERNAKULAM REGION FIRST PRE-BOARD EXAMINATION COMPUTER SCIENCE KENDRIYA VIDYALAYA SANGATHAN ERNAKULAM REGION FIRST PRE-BOARD EXAMINATION 2014-15 COMPUTER SCIENCE Time allowed: 3 hours Maximum Marks : 70 Instructions: (i) All questions are compulsory. (ii) Programming

More information

Autumn Break 2017 Exam Oriented Assignment Class-XII B, Computer Science

Autumn Break 2017 Exam Oriented Assignment Class-XII B, Computer Science Autumn Break 2017 Exam Oriented Assignment Class-XII B, Computer Science S.No. 1 Name of Chapter/Topic CLASSES AND OBJECTS HOT Questions 1. What do you understand by member function? 2. Differentiate between

More information

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

SAMPLE PAPER. Class: XII SUBJECT COMPUTER SCIENCE. Time: 3 Hours MM: 70 SAMPLE PAPER Class - XII SUBJECT COMPUTER SCIENCE Subject: Computer Sc. Class: XII Time: 3 Hours MM: 70 1. (a) Differentiate between a global variable and a local variable. (b) Name the Header file(s)

More information

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

I BCS-031 BACHELOR OF COMPUTER APPLICATIONS (BCA) (Revised) Term-End Examination. June, 2015 BCS-031 : PROGRAMMING IN C ++ No. of Printed Pages : 3 I BCS-031 BACHELOR OF COMPUTER APPLICATIONS (BCA) (Revised) Term-End Examination 05723. June, 2015 BCS-031 : PROGRAMMING IN C ++ Time : 3 hours Maximum Marks : 100 (Weightage 75%)

More information

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

Babaria Institute of Technology Computer Science and Engineering Department Practical List of Object Oriented Programming with C Practical -1 Babaria Institute of Technology LEARN CONCEPTS OF OOP 1. Explain Object Oriented Paradigm with figure. 2. Explain basic Concepts of OOP with example a. Class b. Object c. Data Encapsulation

More information

Question 1 Consider the following structure used to keep employee records:

Question 1 Consider the following structure used to keep employee records: Question 1 Consider the following structure used to keep employee records: struct Employee string firstname; string lastname; float salary; } Turn the employee record into a class type rather than a structure

More information

Come and join us at WebLyceum

Come and join us at WebLyceum Come and join us at WebLyceum For Past Papers, Quiz, Assignments, GDBs, Video Lectures etc Go to http://www.weblyceum.com and click Register In Case of any Problem Contact Administrators Rana Muhammad

More information

C++ 8. Constructors and Destructors

C++ 8. Constructors and Destructors 8. Constructors and Destructors C++ 1. When an instance of a class comes into scope, the function that executed is. a) Destructors b) Constructors c) Inline d) Friend 2. When a class object goes out of

More information

6.096 Introduction to C++ January (IAP) 2009

6.096 Introduction to C++ January (IAP) 2009 MIT OpenCourseWare http://ocw.mit.edu 6.096 Introduction to C++ January (IAP) 2009 For information about citing these materials or our Terms of Use, visit: http://ocw.mit.edu/terms. Welcome to 6.096 Lecture

More information

Time: 3 HOURS Maximum Marks: 100

Time: 3 HOURS Maximum Marks: 100 ANNA UNIVERSITY:CHENNAI 600 025 M.E/M.Tech. DEGREE EXAMINATIONS, NOV./DEC. 2014 Regulations 2013 Third Semester B.E. Computer Science and Engineering CS6311: PROGRAMMING AND DATA STRUCTURES LABORATORY

More information

University of Palestine. Mid Exam Total Grade: 100

University of Palestine. Mid Exam Total Grade: 100 First Question No. of Branches (5) A) Choose the correct answer: 1. If we type: system.out.println( a ); in the main() method, what will be the result? int a=12; //in the global space... void f() { int

More information

Padasalai.Net Half Yearly Exam Model Question Paper

Padasalai.Net Half Yearly Exam Model Question Paper et et Padasalai.Net Half Yearly Exam 2018 - Model Question Paper COMPUTER SCIENCE XII STANDARD Time: 2.30 Hrs] [Max Marks: 70 Part I Choose the correct answer: 15 1 = 15 et et 1. is used to create Text

More information

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

(a) Differentiate between a call by value and call by reference method. ATOMIC ENERGY CENTRAL SCHOOL NO- RAWATBHATA Half Yearly Examination 05 Model Paper Class XII Subject Computer Science Time Allowed: hours Maximum Marks: 70 Note. (i) All questions are compulsory. (ii)

More information

Computer Science[083]

Computer Science[083] Computer Science[083] All questions compulsory Programming language C++ Maximum Marks 100 Time Allotted 3 Hours Question I [a] Differentiate between call by value & call by reference with suitable examples

More information

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

KUWAIT SAHODAYA EXAMINATION FIRST TERM SUBJECT : COMPUTER SCIENCE (083) : CLASS - XII SET - 3 Time : 3 Hours KUWAIT SAHODAYA EXAMINATION FIRST TERM 08-09 SUBJECT : COMPUTER SCIENCE (08) : CLASS - XII SET - Time : Hours MM=70 Instructions- (Based on the model of CBSE Exams). a) Find and write the output of the

More information

Lecture 15a Persistent Memory & Shared Pointers

Lecture 15a Persistent Memory & Shared Pointers Lecture 15a Persistent Memory & Shared Pointers Dec. 5 th, 2017 Jack Applin, Guest Lecturer 2017-12-04 CS253 Fall 2017 Jack Applin & Bruce Draper 1 Announcements PA9 is due today Recitation : extra help

More information

2016 COMPUTER SCIENCE

2016 COMPUTER SCIENCE Total number of printed pages: 5 Total marks : 70 2016 COMPUTER SCIENCE Time : 3 hours General instructions: i) Approximately 15 minutes is allotted to read the question paper and revise the answers. ii)

More information

CS 251 Practice Final Exam R. Brown May 1, 2015 SHOW YOUR WORK No work may mean no credit Point totals will be adjusted to a 120 point scale later

CS 251 Practice Final Exam R. Brown May 1, 2015 SHOW YOUR WORK No work may mean no credit Point totals will be adjusted to a 120 point scale later Name CS 251 Practice Final Exam R. Brown May 1, 2015 SHOW YOUR WORK No work may mean no credit Point totals will be adjusted to a 120 point scale later I pledge my honor that I have neither given nor received

More information

In Java, all variables must be declared before they can be used. The basic form of a variable declaration is shown here:

In Java, all variables must be declared before they can be used. The basic form of a variable declaration is shown here: PART 4 Variable Types In Java, all variables must be declared before they can be used. The basic form of a variable declaration is shown here: type identifier [ = value][, identifier [= value]...] ; To

More information

Chapter 3 Classes. Activity The class as a file drawer of methods. Activity Referencing static methods

Chapter 3 Classes. Activity The class as a file drawer of methods. Activity Referencing static methods Chapter 3 Classes Lesson page 3-1. Classes Activity 3-1-1 The class as a file drawer of methods Question 1. The form of a class definition is: public class {

More information

Rani Durgavati Vishwavidyalaya Jabalpur (M.P.) (UICSA) Master of Computer Application (MCA) Practical List of. MCA III SEM Session -2010

Rani Durgavati Vishwavidyalaya Jabalpur (M.P.) (UICSA) Master of Computer Application (MCA) Practical List of. MCA III SEM Session -2010 Rani Durgavati Vishwavidyalaya Jabalpur (M.P.) (UICSA) Master of Computer Application (MCA) Practical List of MCA III SEM Session -2010 MCA-301 - Object Oriented Programming in C++ 1. WAP to generate Fibonacci

More information

FAKIR MOHAN UNIVERSITY. B. Sc (Computer Science)

FAKIR MOHAN UNIVERSITY. B. Sc (Computer Science) FAKIR MOHAN UNIVERSITY B. Sc (Computer Science) SEMESTER-I, COMP SC.(H)-CC-I (TH.): PROGRAMMING USING C Time 3 hrs. F.M. 100 [ 60( Sem) +15 (Int.) + 25 (Pr.)] Credits: -04(Th.) +02(Pr.) Lectures 60 [ 40(Th.)

More information

CLASS XII COMPUTER SCIENCE(083) TimeAllowed : 3 HrsMax Marks : 70

CLASS XII COMPUTER SCIENCE(083) TimeAllowed : 3 HrsMax Marks : 70 1 CLASS XII COMPUTER SCIENCE(083) TimeAllowed : 3 HrsMax Marks : 70 General Instructions- (i) All questions are compulsory (ii) Programming Language: C++ 1. (a) Differentiate between call-by-value and

More information

KENDRIYA VIDYALAYA GOMTINAGAR, LUCKNOW (SHIFT-II) DAY-WISE ASSIGNMENT FOR WINTER BREAK CLASS XII SUBJECT : COMPUTER SCIENCE

KENDRIYA VIDYALAYA GOMTINAGAR, LUCKNOW (SHIFT-II) DAY-WISE ASSIGNMENT FOR WINTER BREAK CLASS XII SUBJECT : COMPUTER SCIENCE KENDRIYA VIDYALAYA GOMTINAGAR, LUCKNOW (SHIFT-II) DAY-WISE ASSIGNMENT FOR WINTER BREAK 2015-16 CLASS XII SUBJECT : COMPUTER SCIENCE Instructions : Revise the topic (if required) and then solve the related

More information

Example : class Student { int rollno; float marks; public: student( ) //Constructor { rollno=0; marks=0.0; } //other public members };

Example : class Student { int rollno; float marks; public: student( ) //Constructor { rollno=0; marks=0.0; } //other public members }; Constructors A Member function with the same name as its classis called Constructor and it is used to initilize the objects of that class type with a legal value. A Constructor is a special member function

More information

Software design and Implementation 1/6. Software Design and Implementation. Sample Final Exam

Software design and Implementation 1/6. Software Design and Implementation. Sample Final Exam Software design and Implementation 1/6 Software Design and Implementation Sample Final Exam 18.11.2004 Conditions: Closed book Duration: 120 min Name: Student ID: 1. /20 2. /20 3. /20 4. /20 5. /20 Total

More information

Homework Assignment #1

Homework Assignment #1 CISC 2200 Data Structure Fall, 2016 Homework Assignment #1 1 The mistery of lossing one cent. Please refer to the lab1 instruction for an example floating value ($2.34), and how the cents part extracted

More information

CS201- Introduction to Programming Current Quizzes

CS201- Introduction to Programming Current Quizzes CS201- Introduction to Programming Current Quizzes Q.1 char name [] = Hello World ; In the above statement, a memory of characters will be allocated 13 11 12 (Ans) Q.2 A function is a block of statements

More information

SRE VIDYASAAGAR HIGHER SECONDARY SCHOOL

SRE VIDYASAAGAR HIGHER SECONDARY SCHOOL SRE VIDYASAAGAR HIGHER SECONDARY SCHOOL Sub : Computer Science Full Portion Exam Max. Mark : 150 Class : XII - EM Time : 3.00 Hrs PART - I I. Choose the correct answer. 75 x 1 = 75 1. In Save As dialog

More information

CS 31 Discussion 1A, Week 8. Zengwen Yuan (zyuan [at] cs.ucla.edu) Humanities A65, Friday 10:00 11:50 a.m.

CS 31 Discussion 1A, Week 8. Zengwen Yuan (zyuan [at] cs.ucla.edu) Humanities A65, Friday 10:00 11:50 a.m. CS 31 Discussion 1A, Week 8 Zengwen Yuan (zyuan [at] cs.ucla.edu) Humanities A65, Friday 10:00 11:50 a.m. Today s focus Pointer Structure Clarifications Pointer A pointer is the memory address of a variable.

More information

CS 162, Lecture 25: Exam II Review. 30 May 2018

CS 162, Lecture 25: Exam II Review. 30 May 2018 CS 162, Lecture 25: Exam II Review 30 May 2018 True or False Pointers to a base class may be assigned the address of a derived class object. In C++ polymorphism is very difficult to achieve unless you

More information

Classes and Objects. Instructor: 小黑

Classes and Objects. Instructor: 小黑 Classes and Objects Instructor: 小黑 Files and Streams in C : 1 #include 2 3 4 int main( void ) { 5 char input[ 5 ]; 6 7 FILE *cfptr; 8 9 if (( cfptr = fopen( a.txt", r )) == NULL ) { 10 printf(

More information

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

Multiple Choice (Questions 1 14) 28 Points Select all correct answers (multiple correct answers are possible) Name Closed notes, book and neighbor. If you have any questions ask them. Notes: Segment of code necessary C++ statements to perform the action described not a complete program Program a complete C++ program

More information

Classes and Pointers: Some Peculiarities

Classes and Pointers: Some Peculiarities Classes and Pointers: Some Peculiarities Dr. Mardé Helbig Dr. Mardé Helbig, COS 110 1 Issues with Destructor ~ void print Which method is the constructor? How is the constructor different from other methods?

More information

Chapter-11 POINTERS. Important 3 Marks. Introduction: Memory Utilization of Pointer: Pointer:

Chapter-11 POINTERS. Important 3 Marks. Introduction: Memory Utilization of Pointer: Pointer: Chapter-11 POINTERS Introduction: Pointers are a powerful concept in C++ and have the following advantages. i. It is possible to write efficient programs. ii. Memory is utilized properly. iii. Dynamically

More information

2 2

2 2 1 2 2 3 3 C:\Temp\Templates 4 5 Use This Main Program 6 # include "Utilities.hpp" # include "Student.hpp" Copy/Paste Main void MySwap (int Value1, int Value2); int main(int argc, char * argv[]) { int A

More information

INDIAN SCHOOL DARSAIT DEPARTMENT OF ICT

INDIAN SCHOOL DARSAIT DEPARTMENT OF ICT INDIAN SCHOOL DARSAIT DEPARTMENT OF ICT Subject: Computer Science Topic: Constructor & Destructor Worksheet No.:5 Resource Person(s):Roilet Noronha Answer the questions after going through the following

More information

INHERITANCE PART 2. Constructors and Destructors under. Multiple Inheritance. Common Programming Errors. CSC 330 OO Software Design 1

INHERITANCE PART 2. Constructors and Destructors under. Multiple Inheritance. Common Programming Errors. CSC 330 OO Software Design 1 INHERITANCE PART 2 Constructors and Destructors under Inheritance Multiple Inheritance private and protected Inheritance Common Programming Errors CSC 330 OO Software Design 1 What cannot be inherited?

More information

COMPUTER SCIENCE 1998 (Delhi Board)

COMPUTER SCIENCE 1998 (Delhi Board) COMPUTER SCIENCE 1998 (Delhi Board) Time allowed: 3 hours Max. Marks: 70 Instructions: (i) All the questions are compulsory. (ii) Programming Language: C++ QUESTION l. (a) Define the following terms: (i)

More information

vinodsrivastava.com Constructor and Destructor

vinodsrivastava.com Constructor and Destructor vinodsrivastava.com Constructor and Destructor Constructor : it is a special member function of class with the following unique features 1. It has the same name as the name of the class they belongs to

More information

Final exam. Final exam will be 12 problems, drop any 2. Cumulative up to and including week 14 (emphasis on weeks 9-14: classes & pointers)

Final exam. Final exam will be 12 problems, drop any 2. Cumulative up to and including week 14 (emphasis on weeks 9-14: classes & pointers) Review Final exam Final exam will be 12 problems, drop any 2 Cumulative up to and including week 14 (emphasis on weeks 9-14: classes & pointers) 2 hours exam time, so 12 min per problem (midterm 2 had

More information

Conversions and Overloading : Overloading

Conversions and Overloading : Overloading Conversions and Overloading : First. Java allows certain implicit conversations of a value of one type to a value of another type. Implicit conversations involve only the primitive types. For example,

More information

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

Sample Paper 2013 SUB: COMPUTER SCIENCE GRADE XII TIME: 3 Hrs Marks: 70 Sample Paper 2013 SUB: COMPUTER SCIENCE GRADE XII TIME: 3 Hrs Marks: 70 INSTRUCTIONS: All the questions are compulsory. i. Presentation of answers should be neat and to the point. iii. Write down the serial

More information

King Abdulaziz University Faculty of Computing and Information Technology Computer Science Department

King Abdulaziz University Faculty of Computing and Information Technology Computer Science Department King Abdulaziz University Faculty of Computing and Information Technology Computer Science Department CPCS203, 1 st Term 2013 Program 2: KAU Air Booking System (Objects & Classes) Assigned: Wednesday,

More information

Introduction to Programming Using Java (98-388)

Introduction to Programming Using Java (98-388) Introduction to Programming Using Java (98-388) Understand Java fundamentals Describe the use of main in a Java application Signature of main, why it is static; how to consume an instance of your own class;

More information

University of Toronto

University of Toronto University of Toronto Faculty of Applied Science and Engineering Midterm November, 2010 ECE244 --- Programming Fundamentals Examiners: Tarek Abdelrahman, Michael Gentili, and Michael Stumm Instructions:

More information

Multiple Choice (Questions 1 13) 26 Points Select all correct answers (multiple correct answers are possible)

Multiple Choice (Questions 1 13) 26 Points Select all correct answers (multiple correct answers are possible) Name Closed notes, book and neighbor. If you have any questions ask them. Notes: Segment of code necessary C++ statements to perform the action described not a complete program Program a complete C++ program

More information

Review for Test 1 (Chapter 1-5)

Review for Test 1 (Chapter 1-5) Review for Test 1 (Chapter 1-5) 1. Software development 1. Pre-conditions and Post-conditions 2. Running time analysis Big O Timing loops and nested loops 1) Write the simplest big-o expression to describe

More information