You are on page 1of 26

JIET GROUP OF INSTITUTIONS

JODHPUR INSTITUTE OF ENGINEERING & TECHNOLOGY





Mogra, NH-65, Pali Road, J odhpur (Raj) 342002
(Session 2013 - 14)

LABORATORY MANUAL
PROGRAMMING IN C++ LAB (3CS7)
DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING
II. B.Tech (III Semester)

CONTENTS
Contents ....................................................................................................................................................................... 2
Laboratory Culture ........................................................................................................................................................ 3
Dos and Donts for Students: ........................................................................................................................................ 4
Students are supposed to do - ................................................................................................................................... 4
Students are not supposed to do - ............................................................................................................................. 4
Instructions to Students ................................................................................................................................................ 5
Guidelines for the implementation of the Programming in C++Lab for Students ............................................................ 6
Introduction of Object Oriented Programming............................................................................................................... 7
Rajasthan Technical University, Kota ............................................................................................................................. 8
Detailed Syllabus for B.Tech. (Computer Engineering) .................................................................................................... 8
ASSIGNMENT LIST ......................................................................................................................................................... 9
ASSIGNMENT 1 ....................................................................................................................................................... 9
ASSIGNMENT 2 ....................................................................................................................................................... 9
ASSIGNMENT 3 ....................................................................................................................................................... 9
ASSIGNMENT 4 ....................................................................................................................................................... 9
ASSIGNMENT 5 ....................................................................................................................................................... 9
Marking Scheme ..........................................................................................................................................................10
Internal Marks Distribution .......................................................................................................................................10
Marks Distribution for lab assessment ......................................................................................................................10
Individual Program Marking Scheme.........................................................................................................................10
Algorithm for Assignments .......................................................................................................................................11
Assignment 1............................................................................................................................................................11
Assignment 2............................................................................................................................................................13
Assignment 3............................................................................................................................................................15
Assignment 4............................................................................................................................................................16
Assignment 5............................................................................................................................................................17
Viva Voice ....................................................................................................................................................................18
LAB DEPLOYMENT ........................................................................................................................................................26
LABORATORY CULTURE
Every student is assigned a Lab Work of three hours per week and is advised to be in the Lab within
five minutes after the commencement of the period. Attendance is a compulsory factor which carries
certain marks of discipline; therefore students are expected to be regular and attentive in the lab. The
students are also expected to maintain the discipline and decorum of the lab. At the same time a record
has to be maintained by the students regarding their practical work, which they have to submit on the
time of their respective Turns for evaluation. Any violation to these acts will be considered as a mater
of indiscipline. Every student will be allocated a PC and student will work on the same PC throughout
the year. Students have to maintain the laboratory records in which they will write or put the printout
of the programs and their outputs.
DOS AND DONTS FOR STUDENTS:
STUDENTS ARE SUPPOSED TO DO -
1. Be in lab WITHIN 5 minute after the bell goes.
2. Be with their lab notebooks in which they should have are ready with the logic
of the programs to be done.
3. Keep their belongings out of the lab.
4. Work on allocated computer.
5. Seek the permission of the instructor before entering the lab.
6. All written work to be done in lab and gel is counted on the same day.
7. Bring practical files during their respective turn, failing which they would
be treated as difficulties.
STUDENTS ARE NOT SUPPOSED TO DO -
1. Indulge in any activity harmful to the computer.
2. Disturb the settings of the control panel.
3. Leave their system turned on.
4. Use floppy and Pen Drive.
5. Play games and use mobile.
6. Copy the program from others.
7. Come with prior preparation of the programs to be done.
INSTRUCTIONS TO STUDENTS

1. Students shall read the points given below for understanding the theoretical concepts and
practical applications.
2. Listen carefully to the lecture given by teacher about importance of subject, curriculum
philosophy,
learning structure, skills to be developed and procedure method of Continuous assessment,
tentative plan of work in laboratory and total amount of work to be done in a semester.
3. Read the write up of each experiment to be performed, a day in advance.
4. Organize the work in the group and make a record of all programs, algorithms.
5. Understand the purpose of experiment and its practical implications.
6. Write the answers of the viva questions allotted by the teacher during practical hours if
possible or afterwards, but immediately.
7. Student should not hesitate to ask any difficulty faced during conduct of Practical /
exercise.
8. The student shall study all the questions given in the laboratory manual and practice to write the
answers to these questions.










GUIDELINES FOR THE IMPLEMENTATION OF THE PROGRAMMING IN C++LAB FOR
STUDENTS
1. The faculty should provide the complete plan of the lab which will be followed
throughout the complete semester.
2. The guidelines must be followed strictly.
3. Each student should be evaluated as per his/ her performance in the lab without considering his/
her
previous performance.
4. The programs which are to be coded in C / C++must be coded in either VC++or Eclipse in Linux
OS.
No other IDE or editor will be allowed at any cost. If any other tool is being used then the whole.
responsibility of the act will the lab faculty and will be answerable to HOD.
5. It should be noted down that no student may copy the source code of another student for any
program i.e. plagiarism should not take place.
6. If at any stage, it is found that plagiarism is being done, then both the students (one who will copy
and the one who will let him/ her to do so) will be awarded 0 (zero) marks for that assignment
as well as the marks given in previous assignment will be reduced to half of the given marks.
7. For each program, the student will write the source code, get it checked from the faculty and
should take a printout of the code and get signed from the faculty. Then that print out will be
attached to the lab record and will submit the record to the respective faculty.
8. It should be noted that the lab records will not be given to students in any case. Those will
remain with the faculty member in the lab only. And no student will take the lab record with
him/ her; it should be taken and submitted after the completion of each assignment.




INTRODUCTION OF OBJECT ORIENTED PROGRAMMING
Programming language which serves as the intelligent of any computer systems has evolved
tremendously since it was first developed. Currently, in most electronic Devices ranging from
mobile handset to washing machine even to cars have computer Embedded system and thus
requires some form of programming language to govern the Operation of those devices.

Object-oriented programming (OOP) is a programming paradigm that uses abstraction to Create
models based on the real world. It utilizes several techniques from previously Established
paradigms, including modularity, polymorphism and encapsulation.Even though it originated in
1960s, OOP was not commonly used in mainstream software application development until the
1990s. Today, many popular programming languages such as J ava, J avaScript, C#, C++, Python
support OOP.

OOP may be seen as a collection of cooperating objects, as opposed to a traditional view in which
a program may be seen as a collection of functions, or simple as a list of instructions to the
computer. In OOP, each object is capable of receiving messages, processing data, and sending
messages to other objects. Each object can be viewed as an independent little machine with a
distinct role or responsibility.

OOP is intended to promote greater flexibility and maintainability in programming, and is
widely popular in large-scale software engineering. By virtue of its strong emphasis on
modularity, object oriented code is intended to be simpler to develop and easier to understand
later on, lending itself to more direct analysis, coding, and understanding of complex situations and
procedures than less modular programming methods.













RAJASTHAN TECHNICAL UNIVERSITY, KOTA
DETAILED SYLLABUS FOR B.TECH. (COMPUTER ENGINEERING)
Session 2013 -14 (Main Examination)

Class: III Sem. B.Tech. Evaluation

Branch: Computer Engg. Examination Time = Three (4) Hours
Schedule per Week Maximum Marks = 100
Practical Hrs.: 3 [Sessional/Mid-term (60) & End-term (40)]

3CS7 PROGRAMMING IN C++ (Common to Comp. Engg. & Info. Tech)

S.no List of Experiments
1 To write a simple programfor understanding of C++program structure without any CLASS
declaration. Programmay be based on simple input output, understanding of keyword
using.
2 Write a C++program to demonstrate concept of declaration of class with public & private
member, constructors, object creation using constructors, access restrictions, defining
member functions within and outside a class. Scope resolution operators accessing an
objects data members and functions through different type of object handle name of object,
reference to object, pointer to object, assigning class objects to each other.
3 Program involving multiple classes (without inheritance) to accomplish a task.
Demonstrate composition of class.
4 Demonstration Friend function friend classes and this pointer.
5 Demonstration dynamic memory management using new & delete & static class
members.
6 Demonstration of restrictions an operator overloading, operator functions as function and/
or friend function, overloading stream insertion and stream extraction, operators,
overloading operators etc
7 Demonstrator use of protected members, public & private protected classes, multi-level
inheritance etc.
8 Demonstrating multiple inheritance, virtual functions, virtual base classes, abstract classes

ASSIGNMENT LIST
ASSIGNMENT 1
(i) WAP that display details of a student without using class.
(ii) WAP to implement a class with private, public members.
(iii) WAP to display details and calculate gross salary of three employees using array of
object considering Code, Name, Department, Basic, DA=49% and HRA=15%.
(iv) WAP to calculate the average of marks of three students using pointer to array of
object.
ASSIGNMENT 2
(i) WAP to implement constructor, copy constructor and destructor.
(ii) WAP to generate Fibonacci series by using constructors.
(iii) WAP to implement inline function example.
(iv) WAP to swap values of two data members using friend function.
ASSIGNMENT 3
(i) WAP to calculate area of various polygons using function overloading.
(ii) WAP to implement unary operator overloading.
(iii) WAP to multiply two matrixes overloading multiply operator.
(iv) WAP to define a class TIME, making use of object as function argument. It performs
the addition of time in the hours and minutes format.
ASSIGNMENT 4
(i) WAP to calculate total, percentage of marks of a student using multiple classes.
(ii) WAP to implement single inheritance and calculate area, volume of triangle.
(iii) WAP to implement multilevel inheritance.
(iv) WAP to implement multiple inheritance.
ASSIGNMENT 5
(i) WAP that use static class members (data member and member function).
(ii) WAP to implement virtual function and virtual base class.
(iii) WAP to implement templates.




MARKING SCHEME
Total Marks External Marks for
University Practical
Internal Marks
100 40 60
INTERNAL MARKS DISTRIBUTION
Internal Marks Lab performance Assignment Marks
60 48 12

MARKS DISTRIBUTION FOR LAB ASSESSMENT
S.no Name of Student Discipline (10) Performance(30) Viva (8)



Performance marks distribution:
Written work : 5 marks
Logical performance: 15 marks
Program execution: 10 marks

Discipline marks distribution
Attendance : 5 marks
On time submission: 5 marks
INDIVIDUAL PROGRAM MARKING SCHEME
S.no Name of
Student
Lab
Record
Logical
Performance
Attendance Program
Execution
Viva


ALGORITHM FOR ASSIGNMENTS
ASSIGNMENT 1
Program 1:- i) Create a structure and declare variable roll no , name , first name and
last name and create the variable for access the structure.
struct student
{
Int roll no;
Char name[10];
Char lastname[12];
};
ii. Declare the objects
struct student s;

iii) access the members of structures using object in main function following manner:
s. name;
iv) Compile and Run the program and take the output of the program.

Program 2:- i) Create class of the student and declare the variable in the class.
ii) Declare Public or Private member and also declare the member function
in the in Public or Private member.
For Example: public:
void getdata();
void display();
iii) Close the Class.

iv) Now declare the member function definition outside the class. The syntax
given below:-
return type class name :: member function name( argument declaration)
v) Now create object of the class such as;

Class_name object_name; // Person p;
vi) To access the member function of the class by using dot (.) operator
for example:- object name. Function name(arguments); // p. getdata();
vii) Close the program.

Program 3:- i) Create class of the student and declare the variable in the class.

ii) Declare Public or Private member and also declare the member function
in the in Public or Private member.
For Example:
public:
void getdata();
void display();
iii) Close the Class.
iv) Declare the main function and create the object of the class with array declaration
for Example:- class name object name size of the array;// person p[2];
v) By using for loop and access the member functions. The syntax given below
for( i=0; i<=1; i++)
{
P[i]. getdata();
}
vi) Close the program
Program 4:- i) Create class of the student and declare the variable in the class.
ii) Declare Public or Private member and also declare the member function
in the in Public or Private member.
For Example:
Public:
Void getdata();
Void display();
iii) Close the Class.
iv) Declare the main function and create the object of the class using pointer
to array declaration
for Example:- class name pointer to array object ;// person * p[2];
v) By using for loop to access the member function with pointer to member operator
The syntax given below:-
Object name with size of array pointer to member operator and member function
P[i]->getdata();
vi) Close the program.




ASSIGNMENT 2
Program 1:- i) Declare the class with class name.
ii) Declare the the variables and public member variable also declare the member
function
iii) Declare and define the constructor. Now what is constructor/ Destructor
and copy constructor.
Constructors:- A Constructor is a special member function whose task to initialize the
Object of the class. The name of the constructor is same as name of the class.
The syntax is given below:-

Class integer
{
int n,m;

public: integer (void); // Constructor declared
.
}
Integer :: Integer (void)// Constructor definition
Destructor:-It is used to destroy the object that have been created by constructor. The syntax
is given below:-
~ integer()
Copy constructor:- A copy constructor is used to declare and initialize an object from another
object.
For example:- integer (integer &i);
iv) Logic of the Program.
v) Close the program.

Program 2:- i) Declare the class with class name.
ii) Declare the the variables and public member variable and also declare member
function.
iii) Declare and define the constructor same as name of class.
iv) Initialize the variable a=0; b=1;
v) To store the sum of a and b in another variable in c and print the value of c.
vi) assign the value of b into a and c into b.
vii) create the object of the class and access the member function.



Program 3:- i) Declare the class with class name.
ii) Declare the the variables and public member variable and also declare member
function.
iii) Define the inline function. The syntax is given below:-
Inline function header
{Function body
}
iv) Take an example.
Program 4:- i) Declare the class with class name.
ii) Declare the the variables and public member variable and also declare member
function
iii) Declare the friend function. The syntax given below:-
Class ABC
{
.
..

Public:
Friend void XYZ (void);};
iv) now define the friend function .
v) Now access the friend function by using create an object and access dot(.) operator.
vi) Close the program.

Program 5:- :- i) Declare the class with class name.
ii) Declare the the variables and public member variable and also declare member
function
iii) Declare the friend function. The syntax given below:-
Class ABC
{
.
..
Public:
Friend void XYZ (void);};
iv) now define the friend function .
v) Now access the friend function by using create an object and access dot(.) operator
vi) Close the program.



ASSIGNMENT 3
Program 1:- i) Declare the class with class name.
ii) Declare the the variables and public member variable and also declare member
function
iii) The declaration of the Function overloading of any function given below:-
int add( int a, int b);
int add (int a, int b, int c);
iv) Now declare the prototype of the function
v) in the main function pass the value of the variables.
vi) Outside the function name define the function definition and call the function.

vii) Close the program.
Program 2:- i) Declare the class with class name.
ii) Declare the the variables and public member variable and also declare member
function
iii) now defining the unary operator overloading. The syntax given below
return type class name:: operator op(arglist)
{
function body
}
For example:- void space :: operator-()
iv) create object of the class and access the member function by using .operator ( dot).m
v) At the end of the program you would initialize the operator ().
vi) Close the program.

Program 3:- Same procedure of above program.

Program 4:- i) Create a class with name of matrix and declare the size of the array.
ii) Declare the public member and also declare the member function of the class.
iii) Enter the value of the matrix and take value from the user.
iv) Now declare the multiply operator (*) and close the class.
v) Define the multiply operator by using syntax given below:-
Return type class name :: operator op (argument list)
vi) By using dot operator (.) and for loop to access the value of the array.
vii) Create the object of the class and access the member function by using
dot operator(.)
viii) close the program.

ASSIGNMENT 4
Inheritance: - The mechanism of driving a new class from old class is known as inheritance.
There are various types of the inheritance:-
(i) Single inheritance: - A derived class only one base class is called single inheritance.
(ii) Multiple inheritances: - A derived class has more than one base class is called multiple
Inheritance.
(iii) Multilevel inheritance:- The mechanism of deriving a class from another class is called
Multilevel inheritance.
iv) Hierarchical inheritance:- One class inherited by more than one class is called hierarchical.
Base class:- The mechanism of driving a new class from old class known as inheritance,
The old class is known as base class.
Derived class:- The new class derived from old class is known as derived class.
Program 1:- i) Create base class with class name and declare member variable.
ii) Declare the member function and close the class.
iii) now create a derived class . the syntax is given below:-
Class derived class name: visibility mode base class name
{
. // member of derived class
. //member of derived class
};
iv) Define the member function of the class.
v) Create the object of the class and access through the dot operator(.)
vi) Close the program.

Program 2:- i) Create base class with class name and declare member variable.
ii) Declare the member function and close the class.
iii) Now derived class with multilevel inheritance is declared as follows:-
class derived class name : visibility mode base class name
class B: Public A// B derives from A
iv) Define the member function of the class.
v) Access the member function of the by using dot operator (.)
vi) Close the program.

Program 3:- i) Create base class with class name and declare member variable.
ii) Declare the member function and close the class.

iii) Now derived class with multiple inheritances is declared as follows:-
Class derived class name: visibility base class name1, base class name2;
{

.// body of derived class
.// body of derived class
};
ASSIGNMENT 5
Program 1:- Static data member:- A static member variable has certain characteristics:-
(i) It is initialized to zero when first object of its class is created.
(ii) Only one copy of that member is created for the entire class and is shared by
all the objects of that class.
(iii) It is visible only with in the class.
(i) Create the class with class name.
(ii) Declare static data member and declare the variable of the class.
(iii) Declare the member function of the class and close the class.
(iv) Define the static data member of the class. The syntax is given below:-
Return type class name: static data member variable name
(v) Create the object of the class.
(vi) access the member function of the class by using dot operator(.)
(vii) Close the program.
Virtual base class: - The duplication of inherited member due to these
multiple path can be avoided by making the common base class as
virtual base class while declaring the direct or intermediate base class.
The syntax below:-
Class with name// super base class
{
..
..
};
Class B1: virtual public A
{
..
.
};

Program 2:- i) Declare class with class name
ii) declare member variable and also member function
iii) close the class.
iv) now derive the class and virtually inherited the base class.
v) now derive another class and virtually inherited the base class.
vi) the resultant class publicly inherited by the derived class.
vii) create the object of the class.
viii) access the member function of the class using dot operator(.)
ix) close the program.
VIVA VOICE
Q1. What is the program design method we learned in order to write Object Oriented
Programs?
1) Declare - Define - Use 2) Public functions and private variables
3) Top - Down programming 4) Bottom - Up programming
Q2. Which is a logical abstract base class for a class called "footballPlayer"?
1) Salary 2) Sport
3) Athlete 4) Team.
Q3. A recursive function would result in infinite recursion, if the following were left out:
1) Base case 2) Recursive call
3) Subtraction 4) Local variable declarations
Q4. Can two classes contain member functions with the same name?
1) No. 2) Yes, but only if the two classes have the same name.
3) Yes, but only if the main program does not declare both kinds.
4) Yes, this is always allowed
Q5. A derived class
1) Inherits data members and member functions from base class.
2) Inherits constructors and destructor.
3) Object can access protected members with the dot operator.
4) Inherits data members and member functions from base class as well as Inherits constructors and
destructor.
Q6. _________is a relationship
1) Polymorphism 2) Inheritance
3) Overloading 4) None of these options
Q7. Abstract class cannot have ________-.
1) Zero instance. 2) Multiple instance.
3) Both Zero instance & Multiple instance. 4) None of these options
Q8. ______ means that both the data and the methods which may access it are defined together
in the same unit.
1) Data hiding. 2) Encapsulation
3) Data Binding 4) None of these options
Q9. Suppose that the Test class does not have an overloaded assignment operator. What
happens when an assignment a=b; is given for two Test objects a and b?
1) The automatic assignment operator is used 2) The copy constructor is used
3) Compiler error 4) Run-time error
Q10. Which of the following are good reasons to use an object oriented language.
1) You can define your own data types
2) An object oriented program can be taught to correct its own errors
3) It is easier to conceptualize an object oriented program
4) You can define your own data types and It is easier to conceptualize an object oriented
program
Q11. What is a Constructor?
1) A function called when an instance of a class is initialized.
2) A function that is called when an instance of a class is deleted.
3) A special function to change the value of dynamically allocated memory.
4) A function that is called in order to change the value of a variable.
Q12. A class is_____
1) Data Type 2) Abstract Type
3) User Defined Type 4) All of these options
Q13. Reusability can be achieved through.
1) Inheritance. 2) Composition.
3) Association. 4) All of these options
Q14. What is inheritance?
1) It is same as encapsulation. 2) Aggregation of information.
3) Generalization and specialization. 4) All of these options.
Q15. A derived class
1) Inherits data members and member functions from base class.
2) Inherits constructors and destructor.
3) Object can access protected members with the dot operator.
4) Inherits data members and member functions from base class as well as Inherits constructors and
destructor.
Q16. What is a base class?
1) An abstract class that is at the top of the inheritance hierarchy.
2) A class with a pure virtual function in it.
3) A class that inherits from another class
4) A class that is inherited by another class, and thus is included in that class.
Q17. Interface is also known as _________.
1) Virtual class. 2) Dependent class.
3) Pure Abstract Class. 4) None of these options
Q18. What is the correct value to return to the operating system upon the successful completion of a
program?
A. -1 B. 1 C. 0 D. Programs do not return a value.

Q19. What is the only function all C++programs must contain?
A. start() B. system() C. main() D. program()
Q20. What punctuation is used to signal the beginning and end of code blocks?
A. { } B. ->and <- C. BEGIN and END D. ( and )
Q21. What punctuation ends most lines of C++code?
A. . (dot) B. ; (semi-colon) C. : (colon) D. ' (single quote)
Q22. Which of the following is a correct comment?
A. */ Comments */ B. ** Comment ** C. /* Comment */ D. { Comment Q23.
Which of the following is not a correct variable type?
A. float B. real C. int D. double
Q24. Which of the following is the correct operator to compare two variables?
A. := B. = C. equal D. ==
Q25. Which of the following is true?
A. 1 B. 66 C. .1 D. -1 E. All of the above
Q26. Which of the following is the boolean operator for logical-and?
A. & B. && C. | D. |&
Q27. Evaluate !(1 && !(0 || 1)).
A. True B. False C. Unevaluatable
Q28. Object Oriented Programming
(A) makes programs more reliable. (B) simulates real life.
(C) uses a lot of intimidating vocabulary, which is not as bad as it sounds.
(D) is all of the above.
Q29. What is the value of num at the conclusion of the following program segment?
char qwerty = 'B';
int num = 100;
switch(qwerty) {
case 'A':
num ++;
case 'B':
num += 2;

case 'C':
num += 3;
case 'D':
num += 4;}
(A) 100 (B) 102 (C) 109 (D) Error message
Q30. An object is
(A) one instance of a class. (B) another word for a class.
(C) a class with static methods. (D) a method that accesses class attributes.
Q31. Calling an object method requires using
(A) a class identifier followed by a dot and a method identifier.
(B) a method identifier followed by a dot and a class identifier.
(C) an object identifier followed by a dot and a method identifier.
(D) a method identifier followed by a dot and an object identifier.
Q32. When is a constructor called?
(A) Each time the constructor identifier is used in a program statement
(B) During the instantiation of a new object
(C) During the construction of a new class
(D) At the beginning of any program execution
Q33. What is an overloaded constructor?
(A) A constructor with too many program statements.
(B) A second constructor with the same constructor heading as the first constructor.
(C) A second constructor with a different identifier than the first constructor.
(D) A second or other multiple constructor with a different signature than any other constructor.
Q34.Access to private data or private methods is
(A) restricted to methods of the same class.
(B) restricted to methods of other classes.
(C) available to methods of the same class and other classes.
(D) not an issue because the program will not compile.
Q35. A default constructor
(A) is a no-parameter method, which is called automatically during the instantiation of a new object.
(B) is a parameter method, which is called automatically during the instantiation of a new object.
(C) is a no-parameter method. (D) is a parameter method.
Q36. A parameter constructor
(A) is a no-parameter method, which is called automatically during the instantiation of a new object.
(B) is a parameter method, which is called automatically during the instantiation of a new object.
(C) is a no-parameter method.
(D) is a parameter method.
Q37.Inheritance is the process of
(A) using classes in the established standard J ava Language library.
(B) using features from an existing class.
(C) combining data and the methods, which process the data, inside the same module.
(D) dividing a program into multiple related files for each class in the program.
Q38. A class, which can use all the features of an established class, is
(A) a static class. (B) a superclass.
(C) a subclass. (D) overloaded.
Q39. An established class, whose members can all be used by a newly declared class, is
(A) a static class. (B) a superclass.
(C) a subclass. (D) overloaded.
Q40. Which identifier shows up both in the superclass and the subclass?
(A) The superclass identifier (B) The subclass identifier
(C) The class identifier containing the main method (D) The constructor identifier
Q41. A subclass has access to the data attributes of a superclass
(A) if the superclass data is declared protected.
(B) if the superclass data is declared private or protected.
(C) in all cases due to inheritance.
(D) only if the primary program class is declared public
Q42. How is information passed from the subclass constructor to the superclass constructor?
(A) The superclass constructor is automatically called before the subclass constructor.
(B) Use the super keyword followed by a parameter list for the superclass.
(C) Use the super keyword followed by the superclass identifier.
(D) Use the new operator inside the subclass constructor to instantiate the superclass.
Q43.. If a subclass has the same method identifier as a superclass method,
(A) a compile error message will result. (B) a logic error will result.
(C) the superclass method will be used. (D) the subclass method will be used.
Q44. A class
(A) is a user-defined data type.
(B) combines both data and the methods that act upon the data in the same module.
(C) is one instance of a more general data type.
(D) is both A and B.
Q45. An object
(A) is a user-defined data type.(B) combines both data and the methods that act upon the data.
(C) is one instance of a more general data type. (D) is both A and B.
Q46. The data in a class are also called
(A) attributes. (B) instance variables.
(C) fields. (D) all of the above.
Q47. Methods are
(A) action modules that process data. (B) class variables that store information.
(C) instances of a class. (D) none of the above.
Q48. Instantiation is the moment that
(A) memory is allocated for a specific object of a class.
(B) memory is allocated for a specific object, which is a member of a class.
(C) a program is ready for execution.
(D) a program compiles correctly.
Q49. Object Oriented Programming is characterized by using
(A) encapsulation. (B) inheritance.
(C) polymorphism. (D) all of the above.
Q50. A constructor is
(A) a method with the same identifier as the class identifier.
(B) neither a void method nor a return method.
(C) called during the instantiation of a new object.
(D) all of the above.
Q51. The scope of an object is the
(A) size of the memory allocated for an object.
(B) total number of data attributes used by an object.
(C) range of accessing member methods.
(D) period during which an object is defined and allocates memory to store values.
Q52. When simple data types are used for parameter passing,
(A) the actual current value of the simple data type's variable is copied.
(B) the initial value of the simple data type's variable is copied.
(C) the memory reference where the variable values are stored is copied.
(D) a new object of the data type is instantiated.
Q53. When objects are used for parameter passing,
(A) the current values of the data attributes of the object are copied.
(B) the initial values of the object instantiation information are copied.
(C) the memory reference where the object information is stored is copied.
(D) a new object of the same class as the parameter object is instantiated.
Q54. Information hiding is the concept of
(A) declaring all significant data as private.
(B) storing information in private data fields.
(C) thinking about programming features without concern about the implementation of these
features.
(D) testing a program without using any actual data

LAB DEPLOYMENT
S.NO. ASSIGNMENT DURATION PLANNED DATE DELIVERED DATE
TOTAL
MARKS
1 ASSIGNMENT 1 WEEK 1 4
2 ASSIGNMENT 1 WEEK2 4
3 ASSIGNMENT 2 WEEK3 4
4 ASSIGNMENT 2 WEEK4 4
5 ASSIGNMENT 3 WEEK5 4
6 ASSIGNMENT 3 WEEK6 4
7 ASSIGNMENT 4 WEEK7 8
8 ASSIGNMENT 5 WEEK8 8
9 PROJECT WEEK9-12 20

You might also like