resourceone.info Science 12th Computer Science Book Volume 2 Pdf

12TH COMPUTER SCIENCE BOOK VOLUME 2 PDF

Friday, May 3, 2019


COMPUTER SCIENCE Higher Secondary - Second Year Volume 2: Object on behalf of the Government of Tamilnadu This book has been printed on 70 GS. 12th commerce book pdf download, 12th accounts book volume 1 pdf, 12th books pdf download, 12th computer science book volume 2, 12th. StdMaths-EMpdf (Size: MB / Downloads: 6,) Computer Science: Volume resourceone.info StdCS-EMpdf (Size: MB / Downloads: 3,) #2. , PM. Nice post bro. +3 Reputed Add Twelfth.


12th Computer Science Book Volume 2 Pdf

Author:JANETTE VANEYCK
Language:English, Spanish, Arabic
Country:Russian Federation
Genre:Lifestyle
Pages:318
Published (Last):03.07.2016
ISBN:437-6-80073-749-5
ePub File Size:27.80 MB
PDF File Size:17.80 MB
Distribution:Free* [*Regsitration Required]
Downloads:21861
Uploaded by: LYNDSEY

12th Computer Science 2 Volume Important 1 Mark Full Download Summary: 42 12th Books Free Download PDF resourceone.info samacheer kalvi. Tamil Nadu 12th Class School Textbooks Online: Studyguideindia provides Class 12th Tamil Nadu state ComputerScience (Tamil Medium) · ComputerScience1 (Tamil Medium) · Indian Economy State Wise School Text Books Download. Tamilnadu 12th New Books Free Download Samacheer Kalvi Textbook pdf There could be volume 1 and volume 2 books for various subjects and groups like maths group, science group, commerce group, physics, Computer Science.

CodeYard: ict-onderwijs in de spirit van Open Source. Jaargang Nummer 4. December Hoon, W. Rutten and M. Barendregt, H. Glauert, J. Kennaway, M. Hartel, L. Hertzberger, M. Scientific Peer Reviewed Publications : ECIS , 15 pages, to appear In: Liu X.

ICSOC Lecture Notes in Computer Science, vol Vreda Pieterse and Marko Van Eekelen. Explaining the most probable explanation. How personality diversity influences team performance in student software engineering teams. In: G. Bonfante and G. Moser Eds. EPTCS , , pp , Vreda Pieterse, Marko van Eekelen. Which are harder?

Soft skills or hard skills? In: M. Dal Lago Eds. Towards a virtual bank for evaluating security aspects with focus on user behavior. Arjan Lamers and Marko van Eekelen.

Celesti and P. Leitner Eds. Springer Verlag, Warsaw, Poland, Volume An exercise assistant for practical networking and IT security courses in higher education. Zvacek, M. Restivo, J. Uhomoibhi, M. Helfert Eds. Computer Supported Education.

Firenze, Italy, ICSE 2 , Measuring dependency freshness in software systems. OSCP — An open protocol for smart charging of electric vehicles. Achilleas Buisman and Marko van Eekelen. Gamification in Educational Software Development. Berlin, Germany. ACM Digital Library.

Vienna Austria. Evaluates the condition , based on which the control is transferred to step 2 5. Or Explain Entry check loops. The basic syntax is: The control exits the loop once the test expression is evaluated to false. Initialises the control variable num to 2 2. Prints the square of the value stored in num 4. Increments num by 1 5. Control is transferred to step 2 6. The control variable is initialized the first time when the control enters the loop for the first time 2.

Test condition is evaluated. The body of the loop is executed only if the condition is TRUE. Hence for ;; loop is called as entry controlled loop. On repetition of the loop, the control variable is incremented and the test condition will be evaluated before the body of the loop is executed.

The loop is terminated when the test condition evaluates to false. The following program illustrates for ;; loop: What is break and continue statement? Under certain situations one desires to terminate the loop , irrespective of the test expression.

The continue statement forces the next iteration of the loop to take place, skipping any code following the continue statement in the loop body. What is nested loop. Mention the rules for the formation of nested loop. It is possible to nest loop construct inside the body of another. An outer loop and inner loop cannot have the same control variable, as it will lead to logical errors 2.

The inner loop must be completely nested inside the body of the outer loop. Define functions. Functions are also the executable segments in a program. The starting point for the execution of a program is main. What are the advantages of functions. Reusability of code function fact is executed more than once A function can be shared by other programs by compiling it separately and loading them together.

What is the purpose of using function prototype statement? With function prototyping, a template is always used when declaring and defining a function. When a function is called, the compiler uses the template to ensure that proper arguments are passed, and the return value is treated correctly. Any violation in matching of the arguments or the return types will be treated as errors by compiler, and flagged at the time of compilation.

What is the general syntax of using function prototype statement? Declaration of a function is made through a function prototype.

What is calling a function? A function can be called or invoked from another function by using its name. The function name may include a set of actual parameters, enclosed in parentheses separated by commas. Explain call by value method in function with suitable example.

Explain call by reference method in which the change in formal parameter is reflected back in the actual parameter. This method copies the values of actual parameters parameters associated with callstatement into the formal parameters the parameters associated with function header , thus thefunction creates its own copy of arguments and then uses them.

Hence, changes or modifications that are made to formal parameters are not reflected inthe actual parameters. Call by reference [Mar 08, 11]In this method, the called function arguments - formal parameters become alias to the actualparameters in the calling function.

This means that when the function is working with its ownarguments, it is actually working on the original data. Look at the following depiction: List down the rules for actual parameters. The actual parameters can be passed in the form of constants or variables or expressions to the formal parameters which are of value type.

The actual parameters can be passed only as variables to formal parameters of reference type. Why do you think the prototype int max int, int is valid? In a function declaration, the names of the arguments are dummy variables and therefore they are optional. The variables in the prototype act as place holders. What are default arguments? The default value is given in the form of variable initialization.

The default arguments facilitate the function call statement with partial or no arguments. The default values can be included in the function prototype form right to left, i.

One can assign default values to the formal parameters of a function prototype. Call statement is power b, x.. The default values can be included in the function prototype form right to left, We cannot have a default value for an argument in between the argument list. What are inline functions?

They execute faster but require more memory space.

While this is true, we also know that call statement to a function makes a compiler to jump to the functions and also to jump back to the instruction following the call statement. This forces the compiler to maintain overheads like STACKS that would save certain special instructions pertaining to function call, return and its arguments. This reduces the speed of program execution.

Hence under certain situations specially, when the functions are small fewer number of instructions , the compiler replaces the function call statement by its definition ie. This feature is called as inlining of a function technically called as inline function.

To make a function inline, one has to insert the keyword inline in the function header as shown in the above Program. They are: Local scope 2. Function scope 3. File scope 4. A local variable is defined within a block. The scope of a local variable is the block in which it isdefined.

A local variable cannot be accessed from outside the block of its declaration. Local variables are not known outside their own code block. Local variables exist only while the block of code in which they are declared is executing.

A local variable is created upon entry into its block and destroyed upon exit. Function scope The scope of variables declared within a function is extended to the function block, and all sub-blocks therein. The variable flag of the above program is accessible in the function main only.

The life time of a function scope variable, is the life time of the function block. The scope of formal parameters is function scope. File scope A variable declared above all blocks and functions precisely above main has the scope of a file. The scope of a file scope variable is the entire program. The life time of a file scope variable is the life time of a program. Scope Operator The scope operator reveals the hidden scope of a variable. Now look at the following program.

That is the scope of the function is restricted to the class specified in the function header. Several different classes can use the same function name. What is an array? Write its different types. An array is a collection of variables of the same type that are referenced by a common name.

Arrays are of two types: They are One dimensional and Multi dimensional arrays. Write the syntax of single dimensional array. Give an example. Write a note on memory allocation of single dimensional array. What are strings? OR What do you mean by array of characters? The declaration of strings is same as numeric array. For example, i. What character is used to terminate the character array?

Strings are otherwise called as literals, which are treated as single dimensional array of characters. Write the syntax of gets and getline functions. To treat spaces as part of string literal, then one has to use gets defined in stdio. What are the two methods to display the contents of the string?

There are two methods to display the contents of string. Write a short note on write function. The two parameters required for write function are identifier string characters, and no. Write the syntax and purpose of strlen function. Write the syntax and purpose of strcmp function. Write the syntax and purpose of strcpy function. Explain the string manipulators of strlen , strcpy and strcmp. What is two dimensional array?

For instance, an array marks [3] [4] is a table with 3 rows, and 4 columns. The number of elements in a 2-dimensional array is determined by multiplying the number of rows with number of columns. In this example - The array marks has 12 elements. The subscripts always commence from zero. The subscript for rows is from 0 to 2, and for columns - 0 to 3. How do you declare a two dimensional array? Type array-id [Rows] [Columns]; Example: What are the data types used in two dimensional array?

Explain the memory representation of 2 D arrays. The elements are stored either 1. Write a note on memory allocation of two dimensional array. What is matrix? A matrix is a set of mn numbers arranged in the form of a rectangular array of m rows and n columns. Matrices can be represented through 2-D arrays. What is array of strings?

The size of first index rows determines the number of strings and the size of second index column determines maximum length of each string.

How does an array behave when passed to a function? The actual parameter is passed only by the identifier, ignoring dimension. What is a class? A class is a way to bind the data and its associated functions together. What are the two parts of class specification? Write the general form of class declaration.

What are the three access specifiers of class members? What effect does the visibility label private has on the members of a class? Specifying private visibility label is optional. By default the members will be treated as private if a visibility label is not mentioned.

The members that have been declared as private, can be accessed only from within the class. What effect does the visibility label protected has on the members of a class? The members that have been declared as protected can be accessed from within the class, and the members of the inherited classes.

What effect does the visibility label public has on the members of a class? The members that have been declared as public can be accessed from outside the class. What is encapsulation? What is mean by data hiding? What is data abstraction? Write the characteristics of member function of a class? Members are further classified as Data Members and Member functions.

Data members are the data variables that represent the features or properties of a class. Member functions are the functions that perform specific tasks in a class. Member functions are called as methods, and data members are also called as attributes.

How are the class members accessed? For example, the call statement to the function execute of the class student may be given as: List out four characteristics of member function used in program development. Member functions can access the private data of a class.

The return type of a member function can be of object data type. Member functions can be of static type. Write a note on creating objects. The declaration of an object is similar to that of a variable of any basic type.

Tamilnadu 12th Books Free Download PDF Online tn.nic.in

Objects can also be created by placing their names immediately after the closing brace of the class declaration. Give some valid points about static data members of a class. No other initialization is permitted Only one copy of the member variable is created and is shared by all the other objects of its class type Its scope or visibility is within the class but its lifetime is the lifetime of the program.

What are the different methods of creating objects? In Method 2, the member function display is declared within the class, and defined outside the class. Write a note on array of objects? Write a note on memory allocation of objects. Memory space required for the member variables are only allocated separately for each object. Separate memory allocations for the objects are essential because the member variables will hold different data values for different objects.

Memory for Objects for p1 and p2 is illustrated: Write a short note on Polymorphism. The word polymorphism means many forms poly — many, morph — shapes. The term overloading means a name having two or more distinct meanings. Define function overloading. The ability of the function to process the message or data in more than one form is called as function overloading. Explain function overloading with an example. What are its various rules? The first prototype had one argument, second one 3 arguments and the third one had 2 arguments.

How are functions invoked in function overloading? That is, the compiler will promote integral data promotions and then match the call statement with function prototype. What are integral promotions? Integral promotions are purely compiler oriented. By and large integral promotions are as follows: What are the rules for function overloading?

Each overloaded function must differ either by the number of its formal parameters or their data types 2.

Each segment in the for loop can comprise a set of instructions, each instruction should be separated by a comma operator. Can you analyse as to what will be the output of the following segment? What is wrong with the following snippets? What is the impact of the following statements?

Can you reason it out? Under certain situations one desires to terminate the loop , irrespective of the test expression. For example consider the Program - 3. Item found at position.. The loop is terminated when x takes the value as 6, because of break statement. It is possible to nest loop construct inside the body of another.

Look at the following Program - 3. An outer loop and inner loop cannot have the same control variable, as it will lead to logical errors 2.

The inner loop must be completely nested inside the body of the outer loop. A Program written in high level language is called as the Source Code. The source code has to be converted to ma- chine-readable form. The machine-readable form of a program is called as Object file. Compilers create object files from source code.

Compilers are translator programs that create a machine-readable program from the source code. Compiler checks for the grammar of language syntax. An object file is created from an error free source code. The object file is linked with the essential libraries to generate an executable file. This sequence of actions is shown in Fig. If invalid, specify the reasons. Debug the following program. Rewrite the corrected program. Write appropriate declaration statements for the following: To accept choice from user indicating Y-yes and N - no 4.

Point out errors in the following snippets: Program Writing a. Write a program to compute a b where a and b are of real and integer types use while.. Write a program to compute the factorial of a given number. Write a program to generate fibonacci series upto n th term. Fibonacci series is: Write a program to print the following patterns: Functions are also the executable segments in a program. The starting point for the execution of a program is main. In the Program Functions thus encourage: The general syntax showing the various blocks of a function: Declaration of a function is made through a function prototype.

For example look at the Program Number and type of arguments - char name [ ] - is an argument 2. The type of return values in the above example fun does not have any return value, as the data type of the function is void. With function prototyping, a template is always used when declaring and defining a function. When a function is called, the compiler uses the template to ensure that proper arguments are passed, and the return value is treated correctly.

Any violation in matching of the arguments or the return types will be treated as errors by compiler, and flagged at the time of compilation. Why do you think the prototype int max int, int is valid?? In a function declaration, the names of the arguments are dummy variables and therefore they are optional. The variables in the prototype act as place holders. The arguments' names are required in function definition, as the arguments are referenced inside the function. The function name may include a set of actual parameters, enclosed in parentheses separated by commas.

Parameters are the channels through which data flows from the call statement to the function and vice versa. This method copies the values of actual parameters parameters associated with call statement into the formal parameters the parameters associated with function header , thus the function creates its own copy of arguments and then uses them.

Recall the example Program - 4. Hence, in call by value method, the flow of data is always from the call statement to the function definition. When arguments are passed by value, the called function creates new variables of the same data type as the arguments passed to it.

The values of these arguments are copied into the newly created variables. Hence, changes or modifications that are made to formal parameters are not reflected in the actual parameters.

In call by value method, any change in the formal parameter is not reflected back to the actual parameter. This means that when the function is working with its own arguments, it is actually working on the original data.

Recall the example Program 4. Let us now rewrite the function using reference parameters. Values before invoking swap 10 20 Calling swap.. Values are 20 10 The modifications made to formal parameters are reflected in actual parameters, because formal and actual parameters in reference type point to the same storage area. Look at the following depiction: In call by reference method, any change made in the formal parameter is reflected back in the actual parameter.

Hence, change of value in numl is reflected in num2. Rules for actual parameters: The actual parameters can be passed in the form of constants or variables or expressions to the formal parameters which are of value type. For example, For a function prototype: The actual parameters can be passed only as variables to formal parameters of reference type. The output produced is: Since the variable i gets a value 6 in the function, mi is also automatically up- dated to 6, hence, the 'for' loop in main is executed only once.

S The default value is given in the form of variable initialization. Try out the following Program. Hence, times gets the value as The actual parameters are matched with formal parameters on the basis of one- to -one correspondence. Hence, 65 times, 'a' will be printed. The data type of a function is treated as int, if no data type is explicitly mentioned.

COMPUTER SCIENCE for Class 12(XII) - CBSE & NCERT Curriculum

Look at the following examples: Why is the variable i updated to 6, when count was incremented??? The reason being that the variables count and i refer to the same data in the memory. Reference variables also behave the same way. Using this principle, try and find out as to what will be output of the following program: The function call maxref x,y will return a reference to either a or b depending upon which one is bigger of the two.

Hence, the variable max gets the value of the variable y. What will be the output of the following program? A function returning a reference can appear on the left-hand side of an assignment. In the above example, the variable y gets the value -1 , since the function maxref. While this is true, we also know that call statement to a function makes a compiler to jump to the functions and also to jump back to the instruction following the call statement.

This forces the compiler to maintain overheads like STACKS that would save certain special instructions pertaining to function call, return and its arguments. This reduces the speed of program execution. Hence under certain situations specially, when the functions are small fewer number of instructions , the compiler replaces the function call statement by its definition ie. This feature is called as inlining of a function technically called as inline function.

An inline looks like a normal function in the source file but inserts the function's code directly into the calling program. Inline functions execute faster but require more memory space. Now look at the following example. To make a function inline, one has to insert the keyword inline in the function header as shown in Program 4. Sometimes the compiler will ignore the request and treat it as a normal function and vice versa. They are: Local scope 3. File scope 4. Function scope 4.

The scope of a local variable is the block in which it is defined. A local variable cannot be accessed from outside the block of its declaration. Error in line no. The life time of a local variable is the life time of a block in its state of execution. Local variables die when its block execution is completed. A local variable is created upon entry into its block and destroyed upon exit. Identify local variables, in the Program The life time of a function scope variable, is the life time of the function block.

The scope of formal parameters is function scope. The scope of a file scope variable is the entire program. The life time of a file scope variable is the life time of a program.

Now look at the following program. Have you noticed the reference:: It is used to refer variables declared at file level. This is helpful only under situations where the local and file scope variables have the same name. Exercises 1. Construct function prototypes for descriptions given below: Solution - void procedural - function void ; OR void procedural - function ; b manipulative - function takes one argument of double type and returns int type. Solution - int manipulative -function double ; OR i.

The function has no return type.

Identify errors in the following function prototypes: The variable 'm' is declared with function block, which is not permitted. The actual parameter cannot be passed in the form of a value, as the formal parameter is of reference type 5. What will be the output of the following programs? Program writing For example Factorial of 5 is calculated as1 x2x3x4x5 Write a main function to calculate the factorial n. Write a main to test and execute the function odd-even-check int and also print relevant message.

Write a main to test and execute the function and also print relevant message. Processing a collection of data values by reading the data items individually and then processing each item may be very cumbersome and awkward if data is large. For example, consider the following situations: To determine the largest number in the given set of numbers: In fact, handling large data becomes unwieldy, if one has to adopt the above methods for processing data.

Now look at this: Have you noticed the construct of if statement? An array is a collection of variables of the same type that are referenced by a common name. One dimensional: An array is declared as follows: Each element of the array is accessed by the array name and the position of the element in the array. The statement num-array [5] is invalid, because the valid subscripts are only between The other valid examples of array declaration are: In example [v], the size of the array days [ ] is indirectly indicated as 7.

Can you guess how? Now look at the Program - 5. Examples of array processing: The declaration of strings is same as numeric array. These arrays can be initialized as in the above examples, viz. The instance cin, treats white space or carriage return enter key as terminator for string.

Pradyot , then the value stored in name is K. To treat spaces as part of string literal, then one has to use gets defined in stdio. The two parameters required for write function are identifier string characters, and no. Otherwise value less than 0. For instance, an array marks [3] [4] is a table with 3 rows, and 4 columns. V The number of elements in a 2-dimensional array is determined by multiplying the number of rows with number of columns.

In this example - The array marks has 1 2 elements. V The subscripts always commence from zero. The subscript for rows is from to 2, and for columns - to 3. Type array-id [Rows] [Columns]; Example: The elements are stored either 1.

In row-major order. The actual parameter is passed only by the identifier, ignoring dimensions. Array parameters by default behave like a reference parameter, as the array identifier unlike other identifiers, represents the base address of the array. Hence, it results in sending an address to the formal parameter like reference parameters. O O O O Assume data entered in accept function is 1 ,2,3,4 Why do you think the array num is not updated with the values 1 ,2,3,4?

In this example, the parameter passed to void accept is element by element. Hence, it is treated as value parameter and not reference parameter. Only the array identifier represents the base address of an array Now, rewrite the above program with the change - void accept int a. On execution, if the same test data 1 ,2,3,4 is given, then the output displayed will be 1 2 3 4 5. Matrices can be represented through 2-D arrays. Program 5. The size of first index rows determines the number of strings and the size of second index column determines maximum length of each string.

A specific character or an element is accessed as day-names [0] [5], i. Why do the following snippets show errors? But the number of elements is one less than the size of the array. Here, the identifier Adoes not have a value.

The correct statements are: One can assign only component by component. Manipulation of arrays is possible only by specific direction to its elements or components, i. Hence, the statements should be as: What would be the contents of the array after initialization? END Solution: Write a program to declare and initialize an array called as int- array, that stores number 1 0,20,30,40 and Display the sum of all the elements of int-array. Write a program to declare an array of integers that can hold 1 values.

Read the elements of the array from the user, and also display the contents in the reverse order. Write a program to read a sentence into an identifier called as word from the user. Using while loop and switch statements, display the count of vowels present in the given sentence. Display the diagonal elements along with the sum of diagonal elements. Write a program to read values for two matrices, viz. Write program code to create sum-matrix [4] [4] that stores the sum of elements of matrix A and matrix B.

Its significance is highlighted by the fact that Bjarne Stroustrup initially gave the name 'C with Classes '.

A class is a new way of creating and implementing a user defined data type. Classes provide a method for packing together data of different types. For Example: The class data type can be further extended by defining its associated functions. These functions are also called as methods, as they define the various operations in terms of accepting and manipulating data that can be performed on the data.

A class specification has two parts: I compute! By default the members will be treated as private if a visibility label is not mentioned S The members that have been declared as private, can be accessed only from within the class s The members that have been declared as protected can be accessed from within the class, and the members of the inherited classes.

The members and functions declared under private are not accessible by members outside the class, this is referred to as data hiding. Instruments allowing only selected access of components to objects and to members of other classes is called as Data Abstraction.

Or rather Data abstraction is achieved through data hiding. Data hiding is the key feature of object oriented programming OOPS private Accessible by only its own members and certain special functions called as friend functions protected Accessible by members of inherited classes public Access allowed by other members in addition to class member and objects 6.

Members are further classified as Data Members and Member functions. Data members are the data variables that represent the features or properties of a class. Member functions are the functions that perform specific tasks in a class. Member functions are called as methods, and data members are also called as attributes. Now look at the Table 6. Classes include special member functions called as constructors and destructors. These will be dealt in Chapter - 8 Constructors and Destructors.

Once a class has been declared, variables of that type can be declared, 'stud' is a variable of type student , student is a data type of class.

The declaration of an object is similar to that of a variable of any basic type. Objects can also be created by placing their names immediately after the closing brace of the class declaration.

For example, the call statement to the function execute of the class student may be given as: In the example class student, the data members name, marksl , marks2, rollno, totaljmarks are accessed only by the member functions accept , display , compute. The objects declared outside the class cannot access members or functions defined under private or protected. The member functions declared under public can be accessed by the objects of that class.

The call statement stud. Where as the statements: Program This class wraps three integer variables, and its related member function to accept data, and perform addition. Since the variable sum is defined under public visibility mode, the object is accessing it.

In Method 2, the member function display is declared within the class, and defined outside the class. Methods of a class can be defined in both ways. The members defined within the class behave like inline functions.

That is the scope of the function is restricted to the class specified in the function header. The member function have some special characteristics that are often used in the program development. S Several different classes can use the same function name.

The 'membership' label will resolve their scope S Member functions can access the private data of a class. A non- member function cannot do so. Objects can also be passed as arguments S The return type of a member function can be of object data type s Member functions can be of static type 6. Since all the objects belonging to that class use the same member function, no separate space is allocated for member functions when the objects are created.

Memory space required for the member variables are only allocated separately for each object. Separate memory allocations for the objects are essential because the member variables will hold different data values for different objects Look at the following class declaration: Memory for Objects for p1 and p2 is illustrated: Enter values 10 20 The sum of two numbers This is addition 1 Enter values 5 7 The sum of two numbers.

This is addition 2 Enter values 9 8 The sum of two numbers This is addition 3 The count is incremented whenever the sum of the two numbers was calculated. Since the function accept was invoked three times, count was incremented thrice and hence the value is 3. As only one copy of count is shared by all the three objects, the value of count is set to 3. This is shown in Fig. The term overloading means a name having two or more distinct meanings. Thus an 'overloaded function' refers to a function having more than one distinct meaning.

The prototypes are: Yes, each function prototype differs by their number of arguments. The first prototype had one argument, second one 3 arguments and the third one had 2 arguments. In the example we have dealt , all the three functions has float type arguments. It need not necessarily be this way. Arguments for each prototype can be of different data type. Secondly the number of arguments for each function prototype may also differ. The following prototypes for function overloading is invalid.

Can you tell why is it so? Function Prototype voidfun intx ; voidfun charch ; voidfun inty ; voidfun doubled ; Invalid prototype voidfun intx ; voidfun inty ; Both the prototypes have same number and type of arguments.

Hence it is invalid. How are functions invoked in function overloading? That is, the compiler will promote integral data promotions and then match the call statement with function prototype.

SECOND YEAR (STD XII)

For example, in the above example program -1 we have float area float radius with area r where the parameter Y should be of float type.

So, by this strategy the area r will be mapped to area float radius. Integral promotions are purely compiler oriented. By and large integral promotions are as follows: Function call statement Output displayed area 5. That is, the parameter list differ either by number or types. Now look at the following statement: The user is forced to use strcat function to concatenate strings.

It may be viewed as: S Operator functions must be either member functions or friend functions. Friend functions is beyond the scope of this book S The new definition that is provided to an operator does not overrule the original definition of the operator.

In the same program one can also perform addition of numbers in the usual way. The compiler applies user defined definition based on the style of call statement. The process of overloading involves: The following examples demonstrate the ease of using operators with user defined data types - objects.

Program - 7. Identify the operator that is overloaded. Write out the prototype of the overloaded member function. What types of operands are used for the overloaded operator? Write out the statement that invokes the overloaded member function. Rules for overloading operators: There are certain restrictions and limitations in overloading operators.

New operators cannot be created. Write a program that uses function overloading to do the following tasks a. Write function definitions using function overloading to a.

What is the advantage of operator overloading? List out the steps involved to define an overloaded operator. List out the operators that cannot be overloaded.

A complex number has two data members - real part and imaginary part. Complete the following definition and also write a main function to perform addition of the complexjiumbers objects d and c2.

The constructor function initializes the class object. When a class object goes out of scope, a special function called the destructor gets executed. The constructor function name and the destructor have the same name as the class tag. Both the functions return nothing. They are not associated with any data type.

The output of the program will be as follows: Constructor of class - simple.. Program - 8. The constructor add is a constructor without parameters non parameterized.

It is called as default constructor.

More traditionally default constructors are referred to compiler generated constructors i.The member functions are created and placed in the memory space only when they are defined as a part of the class specification. Lecture Notes in Computer Science Volume Account number - long int Name - char[15] Opening balance -float; Account type - char Functions: The position numbering commences from zero.

In this example - The array marks has 1 2 elements. Examples of array processing: Type definition allows users to define such user defined data type identifier. Can you guess how? Explaining the most probable explanation. Sjaak Smetsers and Marko van Eekelen.