Instructions:
- The marks are indicated in the right-hand margin.
- There are NINE questions in this paper.
- Attempt FIVE questions in all.
- Question No. 1 is compulsory.
Questions
Choose the correct option (any seven) :
The compiler identifies a virtual function to be pure
For a method to be an interface between the outside world and a class, it must be declared
C++ encourages structuring a software as a collection of components that are
The fields in a structure and class of a C program and C++ program respectively are by default
Overloading is otherwise called as
A constructor is called whenever
class Dog : public X, public Y is an example of
When a class serves as base class for many derived classes, the situation is called
The use of the break statement in a switch statement is
Write a C++ program and class, with access specifiers, called 'student' having the following :
Data members : name (char type), marks 1, marks 2, marks 3 (integer type)
Functions : calc_total(); disp();
The program asks the user to enter name and marks. Then calc_total() calculates the total marks and disp() displays name and total marks on screen in different lines.
Explain encapsulation with the help of an example. How it facilitates data abstraction?
Create a Message class with a constructor that takes a single string with a default value. Create a private member string, and in the constructor simply assign the argument string to your internal string. Create two overloaded member functions called print(): one that takes no arguments and simply prints the message stored in the object, and one that takes a string argument, which it prints in addition to the internal message. Does it make sense to use this approach instead of the one used for the constructor?
Write a small program to show the difference between calling a virtual function inside a normal member function and calling a virtual function inside a constructor. The program should show that the two calls produce different results.
With an example for generating Fibonacci series, explain how a function is invoked using pointers.
Assume that there is a class Derv that is derived from a base class Base. Write the declarator for a derived-class constructor that takes one argument and passes this argument along to the constructor in the base class.
Write short notes on the following :
Overloading
Overriding
C++ STL
Constructor
Instructions:
- The marks are indicated in the right-hand margin.
- There are NINE questions in this paper.
- Attempt FIVE questions in all.
- Question No. 1 is compulsory.
- Choose the correct option (any seven) :
Which of the following is a valid declaration of an object of class Box?
Which operator is used to invert all the digits in a binary representation of a number?
Which of these cannot be declared static?
Which polymorphism concept is applied to inheritance relationship in Java programming?
Which of the following operators can operate on a Boolean variable?
- &&
- --
- ?:
- +=
Which of these is a process of converting a simple data type into a class?
Which of these methods of thread class is used to suspend a thread for a period of time?
Which of these functions is called to display the output of an applet?
Which of the following is the advantage of using PreparedStatement in Java?
Which of the following is a method of JDBC batch process?
Q.2
What are the drawbacks of procedural languages? Explain the need of object-oriented programming with suitable program.
What are the wrapper classes? Write a Java program to find the GCD of two numbers.
Q.3
Write an iterative Java program to reverse digits of a number.
Write a Java program to check whether a given number is a happy number or unhappy number. Happy number : Starting with any positive integer, replace the number by the sum of the squares of its digits and repeat the process until the number equals 1, or it loops endlessly in a cycle which does not include 1. Unhappy number : A number that is not happy. The first few unhappy numbers are 2, 3, 4, 5, 6, 8, 9, 11, 12, 14, 15, 16, 17, 18, 20.
Q.4
With suitable code segments, illustrate various uses of 'super' keyword.
Write a Java program to demonstrate working of Arrays.equals() for user-defined objects.
Q.5
What is constructor? Write a Java program to find the area of the circle using constructor.
Write a Java program to find the maximum occurring character in a string. The given string is "test string".
Q.6
What is JVM? Write the functionality of each component with the help of block diagram. [Note: Question text reconstructed/partially unreadable]
Discuss about polymorphism. Explain run-time polymorphism with a program.
Q.7
Write the differences between method overloading and method overriding with suitable example of each.
Write a Java program to demonstrate example of hierarchical inheritance to get square and cube of a number.
Q.8
Design an abstract class named Vegetable with three subclasses named Potato, Brinjal and Tomato. Use appropriate data members and member functions to display the output of each vegetable. [Note: Question text reconstructed/partially unreadable]
Q.9
Write a JDBC program to update the amount balance in an account after every withdrawal. Assume the necessary database table.
Write an Applet to draw a smiley picture that accepts user name as a parameter and displays 'welcome' message.
Instructions:
- The marks are indicated in the right-hand margin.
- There are NINE questions in this paper.
- Attempt FIVE questions in all.
- Question No. 1 is compulsory.
Questions
Choose the correct option of the following (any seven) :
Which of the following types of class allows only one object of it to be created?
Which of the following statements is correct?
Which of the following statements is correct?
Which of the following approaches is adapted by C++?
Which of the following is not type of class?
What is default access specifier for data members or member functions declared within a class without any specifier in C++?
Which is known as generic class?
What is scope of a class nested inside another class?
Which syntax for class definition is wrong?
Which among the following best describes the inheritance?
What do you understand by object-oriented programming? What are the advantages of programming using object-oriented approach?
What are the different data types in C++? Explain that C++ is an object-oriented language.
What is a class? Also write an example (syntax) to define a class in C++. Differentiate between a class and an object.
What is inheritance? What are the different types of inheritance in C++? Explain with suitable diagram.
Write short notes with examples on each of the following with respect to C++ :
Data abstraction
Overriding
Encapsulation
Virtual function
Constructor and destructor
What do you mean by polymorphism? What are the static and dynamic polymorphism techniques?
Define Exception Handling. What are the uses of keywords try, throw and catch? Explain with an example by writing a C++ program.
What is Access Modifier in C++? Define each type and also differentiate between these.
Instructions:
- The marks are indicated in the right-hand margin.
- There are NINE questions in this paper.
- Attempt FIVE questions in all.
- Question No. 1 is compulsory.
Q.1 Answer/Fill in the blank/Choose the correct option (any
seven):
Java is an example of ________ language.
The mother tongue of a computer is:
You have the following code in a file called Test.java:
class Base{
public static void main(String[] args){
System.out.println("Hello");
}
}
public class Test extends Base{}
What will happen if you try to compile and run this?Which of the following are valid declarations? (Note: None of the literals used here contain the character O, they are all zeroes.)
What is the result of trying to compile and run this program?
public class Test{
public static void main(String[] args){
int[] a = {1};
Test t = new Test();
t.increment(a);
System.out.println(a[a.length-1]);
}
void increment(int[] i){
i[i.length - 1]++;
}
}
Is this legal?
long longArr[];
int intArr[] = {7, 8, 9};
longArr = intArr;
What is the result of attempting to compile and run this?
interface A{
void aMethod();
}
public class Test implements A{
void aMethod(){
System.out.println("hello");
}
public static void main(String[] args){
Test t = new Test();
t.aMethod();
}
}
What are the class variables?
Explain the following code sample:result = someCondition ? value1 : value2;
Character strings are represented by the class java.lang.String.
Q.2 Solve both questions :
Why is Java called machine independent language? Explain the functionality of JVM.
What is the main difference between an application and applet?
Q.3 Solve both questions :
What are the wrapper classes? Explain their uses.
What does a dynamic Billboard Applet do? What are the three main classes that the applet contain?
Q.4 Solve both questions :
What is the difference between process-based and thread-based multitasking? Give the two ways by which a thread can be created using Java.
What is RMI? What is the difference between Naming.bind and Naming.rebind methods? Write a short code to invoke a remote method using Java RMI.
Q.5 Solve this question :
Write an Applet (Use swings) to display the outputs:

Q.6 Solve both questions :
What are the characteristics of JDBC? What are the various steps for using JDBC? Write a program to demonstrate these steps.
What is the main purpose of a container component in swing?
Q.7 Solve this question :
Design a class named Fan to represent a fan. The class contains:
• Three constants named SLOW, MEDIUM and FAST with values 1, 2 and 3 to denote the fan
speed.
• A private int data field named speed that specifies the speed of the fan (default SLOW).
• A private boolean data field named on that specifies whether the fan is on (default
false).
• A private double data field named radius that specifies the radius of the fan (default 5).
• A string data field named colour that specifies the colour of the fan (default blue).
• The accessor and mutator methods for all four data fields.
• A no-arg constructor that creates a default fan.
• A method named toString() that returns a string description for the fan. If the fan is on, the
method returns the fan speed, colour, and radius in one combined string. If the fan is not on,
the
method returns fan colour and radius along with the string "fan is off" in one combined
string.
Implement the class. Write a test program that creates two Fan objects. Assign maximum speed,
radius
10, colour yellow, and turn it onto the first object. Assign medium speed, radius 5, colour
blue,
and turn it off to the second object. Display the objects by invoking their toString method.
Q.8 Solve this question :
Write a program in Java to demonstrate communication using TCP/IP i.e., using sockets. Write a separate code for a server and client program. The program should display the contents of the file specified in a server onto the client.
Q.9 Write short notes on the following:
Instructions:
- The marks are indicated in the right-hand margin.
- There are NINE questions in this paper.
- Attempt FIVE questions in all.
- Question No. 1 is compulsory.
Q.1 Answer/Fill in the blank/Choose the correct option (any
seven):
Java is an example of ________ language.
The mother tongue of a computer is:
You have the following code in a file called Test.java:
class Base{
public static void main(String[] args){
System.out.println("Hello");
}
}
public class Test extends Base{}
What will happen if you try to compile and run this?Which of the following are valid declarations? (Note: None of the literals used here contain the character O, they are all zeroes.)
What is the result of trying to compile and run this program?
public class Test{
public static void main(String[] args){
int[] a = {1};
Test t = new Test();
t.increment(a);
System.out.println(a[a.length-1]);
}
void increment(int[] i){
i[i.length - 1]++;
}
}
Is this legal?
long longArr[];
int intArr[] = {7, 8, 9};
longArr = intArr;
What is the result of attempting to compile and run this?
interface A{
void aMethod();
}
public class Test implements A{
void aMethod(){
System.out.println("hello");
}
public static void main(String[] args){
Test t = new Test();
t.aMethod();
}
}
What are the class variables?
Explain the following code sample:result = someCondition ? value1 : value2;
Character strings are represented by the class java.lang.String.
Q.2 Solve both questions :
Why is Java called machine independent language? Explain the functionality of JVM.
What is the main difference between an application and applet?
Q.3 Solve both questions :
What are the wrapper classes? Explain their uses.
What does a dynamic Billboard Applet do? What are the three main classes that the applet contain?
Q.4 Solve both questions :
What is the difference between process-based and thread-based multitasking? Give the two ways by which a thread can be created using Java.
What is RMI? What is the difference between Naming.bind and Naming.rebind methods? Write a short code to invoke a remote method using Java RMI.
Q.5 Solve this question :
Write an Applet (Use swings) to display the outputs:

Q.6 Solve both questions :
What are the characteristics of JDBC? What are the various steps for using JDBC? Write a program to demonstrate these steps.
What is the main purpose of a container component in swing?
Q.7 Solve this question :
Design a class named Fan to represent a fan. The class contains:
• Three constants named SLOW, MEDIUM and FAST with values 1, 2 and 3 to denote the fan
speed.
• A private int data field named speed that specifies the speed of the fan (default SLOW).
• A private boolean data field named on that specifies whether the fan is on (default
false).
• A private double data field named radius that specifies the radius of the fan (default 5).
• A string data field named colour that specifies the colour of the fan (default blue).
• The accessor and mutator methods for all four data fields.
• A no-arg constructor that creates a default fan.
• A method named toString() that returns a string description for the fan. If the fan is on, the
method returns the fan speed, colour, and radius in one combined string. If the fan is not on,
the
method returns fan colour and radius along with the string "fan is off" in one combined
string.
Implement the class. Write a test program that creates two Fan objects. Assign maximum speed,
radius
10, colour yellow, and turn it onto the first object. Assign medium speed, radius 5, colour
blue,
and turn it off to the second object. Display the objects by invoking their toString method.
Q.8 Solve this question :
Write a program in Java to demonstrate communication using TCP/IP i.e., using sockets. Write a separate code for a server and client program. The program should display the contents of the file specified in a server onto the client.
Q.9 Write short notes on the following:
Instructions:
- The marks are indicated in the right-hand margin.
- There are NINE questions in this paper.
- Attempt FIVE questions in all.
- Question No. 1 is compulsory.
Questions
Choose the correct answer of the following (any seven):
To prevent any method from overriding, we declare the method as
Which of the following types of class allows only one object of it to be created?
Multiple inheritance means
When the compiler cannot differentiate between two overloaded constructors, they are called
In C++, dynamic memory allocation is accomplished with the operator
If we create a file by 'ifstream', then the default mode of the file is
To perform file I/O operations, we must use _______ header file.
Which keyword is used to check exception in the block of code?
What will happen when the exception is not caught in the program?
Which of the following gives the memory address of integer variable a?
Distinguish between static binding and dynamic binding. Explain the use of virtual functions and the vtable in dynamic binding.
Answer the following:
Explain adaptor class or wrapper classes with example.
Explain dangling pointer with the help of an example.
Compare between overloading and overriding of functions with example.
Define a class CARTESIAN to represent a point in cartesian coordinates and class POLAR to represent it in polar coordinates . Use constructor conversion and operator conversion functions in class CARTESIAN to convert object of one type into another.
Answer the following:
What is a friend function and what are its advantages?
What are the guidelines that should be followed while using friend function?
Answer the following:
Describe scope and life of a variable.
Describe 'this' pointer with its applications.
With a suitable example, explain how a function is invoked using pointers.
Answer the following:
What is a constructor? Describe the types of constructor each with an example.
Explain pointer-to-pointer with an example.
Instructions:
- There are Nine Questions in this Paper.
- Attempt Five questions in all.
- Question No. 1 is Compulsory.
- All questions carry equal marks.
Questions
Answer any Seven questions from this:
The address of a variable temp of type float is
The process of building new classes from existing one is called ________.
An array element is accessed using
If there is a pointer p to object of a base class and it contains the address of an object of a derived class and both classes contain a virtual member function abc(), then the statement p->abc(); will cause the version of abc() in the ________ class to be executed.
Overloading a postfix increment operator by means of a member function takes
What will be the output of the following program?
#include<iostream.h>
void main() {
float x=5, y=2; int result;
result=x%y; cout<<result;
}
Member functions, when defined within the class specification:
An exception is caused by
Which of the following expressions is illegal?
What is the output of given code fragment?
int f=1, i=2; while(++i<5)
f*=i;
count<<f;
Answer the following:
Explain the importance of using friend function in operator overloading with the help of an example.
What is a default argument and constant argument? Explain each with an example.
Answer the following:
Explain a pure virtual function with an example.
What is function template? Give an example of it. Also differentiate between template class and class template.
Answer the following:
How does inheritance influences the working of constructor and destructor? Give the following set of definitions
class x { };
class y: public x { };
class z: public y { };
z obj;
Write a program to read three numbers and and evaluate given by . Use exception handling to throw an exception in case division by zero is attempted.
Answer the following:
Explain the use of this pointer with an example. Explain what happens when a pointer is deleted twice.
What is downcast? Explain why and when do we use protected instead or private.
Answer the following:
What is a friend function? Explain the advantages of using friend classes.
What is C-string? Give an example in support of your answer. Also explain the problem associated with C-string.
Answer the following:
What is a container class? What are the types of container classes?
Create an array that can hold ten integers, and get input form user. Display those values on the screen, and then prompt the user for an integer. Search though the array, and count the number of times the item is found.
Answer the following:
What is a variable? Write rules for defining a variable in C++. Also explain different types of storage classes in C++.
What is encapsulation? What are its advantages? How can encapsulation are enforced in C++?
Differentiate the following:
Pointer to constant vs pointer constant
Inspector vs Mutator
Vectors vs Dequeues
Realloc() vs free()
Instructions:
- The marks are indicated in the right-hand margin.
- There are NINE questions in this paper.
- Attempt FIVE questions in all.
- Question No. 1 is compulsory.
Q.1 Choose the correct answer of any seven of the following:
Size (in bytes) of float and double in Java is:
Which of the following operators is used to allocate memory to array variable in Java?
Which of the following is an incorrect array declaration?
Which of the following is used as default for a member of a class if no access specifier is used for it?
Which of the following methods of string class is used to obtain character at specified index?
What does AWT stand for?
Which of the following keywords is used to prevent the content of a variable from being modified?
Which of the following functions is used to perform some actions when the object is to be destroyed?
What is the order of precedence (highest to lowest) of the following operators?
1. &&
2.
==
3. ?:
Which of the following classes is related to all the exceptions that can be caught by using catch?
Q.2 Solve both questions :
What are the various access specifiers for JAVA classes? Discuss the various types of inheritance supported by JAVA.
Discuss the different types of operators in JAVA along with their precedence relationship.
Q.3 Solve both questions :
What is JDBC connection? Explain the types of JAVA drivers available for database connectivity. List the advantages and disadvantages of each of the mentioned JAVA drivers.
What is the difference between final, finally and finalize in JAVA? Compare and contrast between 'throw' and 'throws'.
Q.4 Solve both questions :
What is a thread? Explain the different states in which a thread can exist. Why does a dead thread occur? What are the actions that can occur when a thread enters blocked state?
Explain the various OOPs concepts in JAVA.
Q.5 Solve both questions :
What is an immutable class? How to create an immutable class?
What is an abstract class? Explain with example. Differentiate between abstract class and interfaces. What are the advantages of interfaces over abstract classes?
Q.6 Solve both questions :
What are applets? Which package contains the applet class? Explain the applet life cycle methods.
What is the difference between swing and applet? How is a frame created and closed in an applet?
Q.7 Solve both questions :
How can we restrict inheritance for a class? Does JAVA support multiple inheritance? Justify your answer.
Write a program to insert an element at the last index of an array in JAVA.
Q.8 Solve both questions :
Explain the concept of static methods with suitable examples.
What is event handling? What are the steps involved in event handling?
Instructions:
- The marks are indicated in the right-hand margin.
- There are NINE questions in this paper.
- Attempt FIVE questions in all.
- Question No. 1 is compulsory.
Q.1 Choose the correct answer of any seven of the following:
Size (in bytes) of float and double in Java is:
Which of the following operators is used to allocate memory to array variable in Java?
Which of the following is an incorrect array declaration?
Which of the following is used as default for a member of a class if no access specifier is used for it?
Which of the following methods of string class is used to obtain character at specified index?
What does AWT stand for?
Which of the following keywords is used to prevent the content of a variable from being modified?
Which of the following functions is used to perform some actions when the object is to be destroyed?
What is the order of precedence (highest to lowest) of the following operators?
1. &&
2.
==
3. ?:
Which of the following classes is related to all the exceptions that can be caught by using catch?
Q.2 Solve both questions :
What are the various access specifiers for JAVA classes? Discuss the various types of inheritance supported by JAVA.
Discuss the different types of operators in JAVA along with their precedence relationship.
Q.3 Solve both questions :
What is JDBC connection? Explain the types of JAVA drivers available for database connectivity. List the advantages and disadvantages of each of the mentioned JAVA drivers.
What is the difference between final, finally and finalize in JAVA? Compare and contrast between 'throw' and 'throws'.
Q.4 Solve both questions :
What is a thread? Explain the different states in which a thread can exist. Why does a dead thread occur? What are the actions that can occur when a thread enters blocked state?
Explain the various OOPs concepts in JAVA.
Q.5 Solve both questions :
What is an immutable class? How to create an immutable class?
What is an abstract class? Explain with example. Differentiate between abstract class and interfaces. What are the advantages of interfaces over abstract classes?
Q.6 Solve both questions :
What are applets? Which package contains the applet class? Explain the applet life cycle methods.
What is the difference between swing and applet? How is a frame created and closed in an applet?
Q.7 Solve both questions :
How can we restrict inheritance for a class? Does JAVA support multiple inheritance? Justify your answer.
Write a program to insert an element at the last index of an array in JAVA.
Q.8 Solve both questions :
Explain the concept of static methods with suitable examples.
What is event handling? What are the steps involved in event handling?
Instructions:
- All questions carry equal marks.
- There are NINE questions in this paper.
- Attempt FIVE questions in all.
- Question No. 1 is compulsory.
Questions
Choose the correct answer (any seven):
What is the output of the following code?
char symbol[3]={'a','b','c'};
for (int index=0; index<3; index++)
cout << symbol[index];
(i) a b c (ii) "abc" (iii) abc (iv) 'abc'
If a class C is derived from class B, which is derived from class A, all through public inheritance, then a class C member function can access (i) protected and public data only in C and B (ii) protected and public data only in C (iii) private data in A and B (iv) protected data in A and B
In C++, the range of signed integer type variable is (i) 0 to (ii) to (iii) to (iv) 0 to
The function whose prototype is void getData(Item *thing); receives
(i) a pointer to a structure
(ii) a reference to a structure
(iii) a copy of a structure
(iv) four bytes
Format flags may be combined using the (i) bitwise OR operator (|) (ii) logical OR operator (||) (iii) bitwise AND operator (&) (iv) logical AND operator (&&)
Which of the following types of class allows only one object of it to be created? (i) Virtual class (ii) Abstract class (iii) Singleton class (iv) Friend class
cout is a/an (i) operator (ii) function (iii) object (iv) macro
The size of object is equal to (i) total size of member data variables (ii) total size of member function (iii) Both (i) and (ii) (iv) None of the above
If A and B are Boolean variables, then the expression (!A) || (!B) is equivalent to which of the following conditions?
(i) !(A && B)
(ii) !(A || B)
(iii) !(A) && !(B)
(iv) True
What will be stored in n by the following statements?
int n;
n = 17 + 10 / 7;
(i) 18 (ii) 3 (iii) 3.857.. (iv) 18.428..
Answer the following:
Write a program that defines a shape class with a constructor that gives value to width and height. Then define two sub-classes triangle and rectangle, that calculate the area of the shape area(). In the main, define two variables a triangle and a rectangle and then call the area() function in this two variables.
What are pure virtual functions? Write the syntax.
Answer the following:
What is inline function? What are its advantages and disadvantages?
Draw the exception handling model.
Answer the following:
What is multilevel inheritance? How is it different from multiple inheritance?
How can a common friend function to two different classes be declared?
Answer the following:
What are the basic differences between manipulators and IOS member functions in implementation? Give examples.
What is object-oriented programming? How is it different from procedure-oriented programming?
Answer the following:
Explain the following functions with examples for manipulating file pointers: seekg(), seekp(), tellg(), tellp()
What is the difference between passing a parameter by reference and constant reference? Explain with an example.
Answer the following:
Write a program that asks the user for an integer number and find the sum of all natural numbers up to that number.
Class Y has been derived from class X. The class Y does not contain any data members of its own. Does the class Y require constructor? State your answer with Yes or No and why.
Answer the following:
What is operator overloading? List out the operators that cannot be overloaded.
What are generic classes? Why are they useful? Explain with an example how these are implemented in C++.
Differentiate between the following and give examples to bring out the difference:
Private and public inheritances
Instantiation and specialization of a template class
Static and dynamic bindings
A class and a struct
Instructions:
- There are Nine Questions in this Paper.
- Attempt five questions in all.
- Question No. 1 is Compulsory.
- The questions are of equal value.
Q.1 Choose the correct answer of the following (any seven)
What is the output of this program?
Which of these have highest precedence?
What is the output of this program?
What is the output of this program?
What is the output of this program?
What is the default value of Boolean variable?
What is the output of this program?
What is the output of this program?
What is the output of this program?
What is the output of this program?
Q.2 Solve both questions :
What is the difference between the C, C++ and Java?
Write a program that reads an integer and check whether it is prime number or not.
Q.3 Solve both questions :
What do you understand by polymorphism? Explain with examples.
What do you understand by precedence and Associativity? Explain with examples.
Q.4 Solve both questions :
What is a constructor? Give its properties. How do we declare/define it? Can they be overloaded? Explain types of constructors with example.
What is exception-handling? What are the statements used for it? Show an example.
Q.5 Solve both questions :
Give the definition (1-2 Lines) and an example of the following: i. Thread Class, ii. AWT, iii. JDBC, iv. JVM.
Difference between the following with example: i. Break and continue, ii. Abstract class and interface.
Q.6 Solve both questions :
What is exception-handling? What are the statements used for it? Show an example.
What is inheritance in java? Explain different types of inheritance.
Q.7 Solve both questions :
Create an abstract class Discount Policy. It should have a single abstract method compute Discount that will return the discount for the purchase of a given number of a single item. The method has two parameters, count and itemCost.
Write a program to find largest and second largest element in an array.
Q.8 Solve both questions :
Write a program to design a class account using the inheritance and static keyword that shows all function of bank (withdrawal, deposit).
Write a program to create a thread that Implement the Runnable interface.
Q.9 Solve both questions :
Write a program to create a Simple class to find out the Area and perimeter of rectangle and box using super and this keyword.
Write a program to find the factorial of a given number using Recursion.
Instructions:
- There are Nine Questions in this Paper.
- Attempt five questions in all.
- Question No. 1 is Compulsory.
- The questions are of equal value.
Q.1 Choose the correct answer of the following (any seven)
What is the output of this program?
Which of these have highest precedence?
What is the output of this program?
What is the output of this program?
What is the output of this program?
What is the default value of Boolean variable?
What is the output of this program?
What is the output of this program?
What is the output of this program?
What is the output of this program?
Q.2 Solve both questions :
What is the difference between the C, C++ and Java?
Write a program that reads an integer and check whether it is prime number or not.
Q.3 Solve both questions :
What do you understand by polymorphism? Explain with examples.
What do you understand by precedence and Associativity? Explain with examples.
Q.4 Solve both questions :
What is a constructor? Give its properties. How do we declare/define it? Can they be overloaded? Explain types of constructors with example.
What is exception-handling? What are the statements used for it? Show an example.
Q.5 Solve both questions :
Give the definition (1-2 Lines) and an example of the following: i. Thread Class, ii. AWT, iii. JDBC, iv. JVM.
Difference between the following with example: i. Break and continue, ii. Abstract class and interface.
Q.6 Solve both questions :
What is exception-handling? What are the statements used for it? Show an example.
What is inheritance in java? Explain different types of inheritance.
Q.7 Solve both questions :
Create an abstract class Discount Policy. It should have a single abstract method compute Discount that will return the discount for the purchase of a given number of a single item. The method has two parameters, count and itemCost.
Write a program to find largest and second largest element in an array.
Q.8 Solve both questions :
Write a program to design a class account using the inheritance and static keyword that shows all function of bank (withdrawal, deposit).
Write a program to create a thread that Implement the Runnable interface.
Q.9 Solve both questions :
Write a program to create a Simple class to find out the Area and perimeter of rectangle and box using super and this keyword.
Write a program to find the factorial of a given number using Recursion.
Instructions:
- There are Nine Questions in this Paper.
- Attempt five questions in all.
- Question No. 1 is Compulsory.
- The questions are of equal value.
Q.1 Choose the correct answer of the following (any seven)
What is the output of this program?
Which of these have highest precedence?
What is the output of this program?
What is the output of this program?
What is the output of this program?
What is the default value of Boolean variable?
What is the output of this program?
What is the output of this program?
What is the output of this program?
What is the output of this program?
Q.2 Solve both questions :
What is the difference between the C, C++ and Java?
Write a program that reads an integer and check whether it is prime number or not.
Q.3 Solve both questions :
What do you understand by polymorphism? Explain with examples.
What do you understand by precedence and Associativity? Explain with examples.
Q.4 Solve both questions :
What is a constructor? Give its properties. How do we declare/define it? Can they be overloaded? Explain types of constructors with example.
What is exception-handling? What are the statements used for it? Show an example.
Q.5 Solve both questions :
Give the definition (1-2 Lines) and an example of the following: i. Thread Class, ii. AWT, iii. JDBC, iv. JVM.
Difference between the following with example: i. Break and continue, ii. Abstract class and interface.
Q.6 Solve both questions :
What is exception-handling? What are the statements used for it? Show an example.
What is inheritance in java? Explain different types of inheritance.
Q.7 Solve both questions :
Create an abstract class Discount Policy. It should have a single abstract method compute Discount that will return the discount for the purchase of a given number of a single item. The method has two parameters, count and itemCost.
Write a program to find largest and second largest element in an array.
Q.8 Solve both questions :
Write a program to design a class account using the inheritance and static keyword that shows all function of bank (withdrawal, deposit).
Write a program to create a thread that Implement the Runnable interface.
Q.9 Solve both questions :
Write a program to create a Simple class to find out the Area and perimeter of rectangle and box using super and this keyword.
Write a program to find the factorial of a given number using Recursion.
Instructions:
- There are Nine Questions in this Paper.
- Attempt five questions in all.
- Question No. 1 is Compulsory.
- The questions are of equal value.
Q.1 Choose the correct answer of the following (any seven)
What is the output of this program?
class bitwise_operator {
public static void main (String args[]) {
int var1 = 42;
int var2 = ~var1;
System.out.print(var1 + " " + var2);
}
}
Which of these have highest precedence?
What is the output of this program?
class operators {
public static void main(String args[]) {
int var1 = 5;
int var2 = 6;
int var3;
var3 = ++var2 * var1 / var2 + var2;
System.out.print(var3);
}
}
What is the output of this program?
class output {
public static void main(String args[]) {
int x, y;
x = 10;
x++;
--x;
y = x++;
System.out.println(x + " " + y);
}
}
What is the output of this program?
class conversion {
public static void main(String args[]) {
double a = 295.04;
int b = 300;
byte c = (byte) a;
byte d = (byte) b;
System.out.println(c + " " + d);
}
}
What is the default value of Boolean variable?
What is the output of this program?
class array_output {
public static void main(String args[]) {
char array_variable[] = new char[10];
for (int i=0; i<10; ++i) {
array_variable[i] = '1';
System.out.print(array_variable[i] + " ");
i++;
}
}
}
What is the output of this program?
class exception_handling {
public static void main(String args[]) {
try {
System.out.print("Hello" + " " + 1/0);
} catch (ArithmeticException e) {
System.out.print("World");
}
}
}
What is the output of this program?
class overload {
int y;
int x;
void add(int a) {
x = a + 1;
}
void add(int a, int b) {
x = a + 2;
}
}
class overload_methods {
public static void main(String args[]) {
overload obj = new overload();
int a = 0;
obj.add(6, 7);
System.out.println(obj.x);
}
}
What is the output of this program?
class A {
public int i;
private int j;
}
class B extends A {
void display() {
super.j = super.i + 1;
System.out.println(super.i + " " + super.j);
}
}
class inheritance {
public static void main(String args[]) {
B obj = new B();
obj.i = 1;
obj.j = 2;
obj.display();
}
}
Q.2 Solve both questions :
What is the difference between the C, C++ and Java?
Write a program that reads an integer and check whether it is prime number or not.
Q.3 Solve both questions :
What do you understand by polymorphism? Explain with examples.
What do you understand by precedence and Associativity? Explain with examples.
Q.4 Solve both questions :
What is a constructor? Give its properties. How do we declare/define it? Can they be overloaded? Explain types of constructors with example.
What is exception-handling? What are the statements used for it? Show an example.
Q.5 Solve both questions :
Give the definition (1-2 Lines) and an example of the following: i. Thread Class, ii. AWT, iii. JDBC, iv. JVM.
Difference between the following with example: i. Break and continue, ii. Abstract class and interface.
Q.6 Solve both questions :
What is exception-handling? What are the statements used for it? Show an example.
What is inheritance in java? Explain different types of inheritance.
Q.7 Solve both questions :
Create an abstract class Discount Policy. It should have a single abstract method compute Discount that will return the discount for the purchase of a given number of a single item. The method has two parameters, count and itemCost.
Write a program to find largest and second largest element in an array.
Q.8 Solve both questions :
Write a program to design a class account using the inheritance and static keyword that shows all function of bank (withdrawal, deposit).
Write a program to create a thread that Implement the Runnable interface.
Q.9 Solve both questions :
Write a program to create a Simple class to find out the Area and perimeter of rectangle and box using super and this keyword.
Write a program to find the factorial of a given number using Recursion.
Instructions:
- There are Nine Questions in this Paper.
- Attempt five questions in all.
- Question No. 1 is Compulsory.
- The questions are of equal value.
Q.1 Choose the correct answer of the following (any seven)
What is the output of this program?
class bitwise_operator {
public static void main (String args[]) {
int var1 = 42;
int var2 = ~var1;
System.out.print(var1 + " " + var2);
}
}
Which of these have highest precedence?
What is the output of this program?
class operators {
public static void main(String args[]) {
int var1 = 5;
int var2 = 6;
int var3;
var3 = ++var2 * var1 / var2 + var2;
System.out.print(var3);
}
}
What is the output of this program?
class output {
public static void main(String args[]) {
int x, y;
x = 10;
x++;
--x;
y = x++;
System.out.println(x + " " + y);
}
}
What is the output of this program?
class conversion {
public static void main(String args[]) {
double a = 295.04;
int b = 300;
byte c = (byte) a;
byte d = (byte) b;
System.out.println(c + " " + d);
}
}
What is the default value of Boolean variable?
What is the output of this program?
class array_output {
public static void main(String args[]) {
char array_variable[] = new char[10];
for (int i=0; i<10; ++i) {
array_variable[i] = '1';
System.out.print(array_variable[i] + " ");
i++;
}
}
}
What is the output of this program?
class exception_handling {
public static void main(String args[]) {
try {
System.out.print("Hello" + " " + 1/0);
} catch (ArithmeticException e) {
System.out.print("World");
}
}
}
What is the output of this program?
class overload {
int y;
int x;
void add(int a) {
x = a + 1;
}
void add(int a, int b) {
x = a + 2;
}
}
class overload_methods {
public static void main(String args[]) {
overload obj = new overload();
int a = 0;
obj.add(6, 7);
System.out.println(obj.x);
}
}
What is the output of this program?
class A {
public int i;
private int j;
}
class B extends A {
void display() {
super.j = super.i + 1;
System.out.println(super.i + " " + super.j);
}
}
class inheritance {
public static void main(String args[]) {
B obj = new B();
obj.i = 1;
obj.j = 2;
obj.display();
}
}
Q.2 Solve both questions :
What is the difference between the C, C++ and Java?
Write a program that reads an integer and check whether it is prime number or not.
Q.3 Solve both questions :
What do you understand by polymorphism? Explain with examples.
What do you understand by precedence and Associativity? Explain with examples.
Q.4 Solve both questions :
What is a constructor? Give its properties. How do we declare/define it? Can they be overloaded? Explain types of constructors with example.
What is exception-handling? What are the statements used for it? Show an example.
Q.5 Solve both questions :
Give the definition (1-2 Lines) and an example of the following: i. Thread Class, ii. AWT, iii. JDBC, iv. JVM.
Difference between the following with example: i. Break and continue, ii. Abstract class and interface.
Q.6 Solve both questions :
What is exception-handling? What are the statements used for it? Show an example.
What is inheritance in java? Explain different types of inheritance.
Q.7 Solve both questions :
Create an abstract class Discount Policy. It should have a single abstract method compute Discount that will return the discount for the purchase of a given number of a single item. The method has two parameters, count and itemCost.
Write a program to find largest and second largest element in an array.
Q.8 Solve both questions :
Write a program to design a class account using the inheritance and static keyword that shows all function of bank (withdrawal, deposit).
Write a program to create a thread that Implement the Runnable interface.
Q.9 Solve both questions :
Write a program to create a Simple class to find out the Area and perimeter of rectangle and box using super and this keyword.
Write a program to find the factorial of a given number using Recursion.
Instructions:
- All questions carry equal marks.
- There are NINE questions in this paper.
- Attempt FIVE questions in all.
- Question No. 1 is compulsory.
Questions
Choose the correct option (any seven):
Find out the error in following block of code:
if (x = 100)
cout << "x is 100";
(i) 100 should be enclosed in quotations (ii) There is no semicolon at end of first line (iii) Equals to operator mistake (iv) Variable x should not be inside quotation
Which of the following is not a jump statement in C++? (i) Break (ii) Goto (iii) Exit (iv) Switch
Consider the following statements:
int *p;
int i, k;
i = 142;
k = i;
p = &i;
Which of the following statements changes the value of i to 143? (i) k = 143; (ii) *k = 143; (iii) p = 143; (iv) *p = 143;
Which of the following is false? (i) Variable has scope and visibility (ii) Variables having scope may not be visible (iii) Variables having visibility may not have scope (iv) None of the above
A class cannot be: (i) virtual (ii) generic (iii) inline (iv) friend
Which of the following is/are false? (i) Inheritance is deriving new class from existing class (ii) In an inheritance, all data and function members of base class are derived by derived class (iii) We can specify which data and function members of base class will be inherited by derived class (iv) We can add new functions to derived class without recompiling the base class
What is true about inline functions? (i) It's a compulsion on the compiler to make function inline (ii) It's a request to the compiler to make the function inline (iii) It's the indication to the compiler that the function is recursive (iv) It's the indication to the compiler that the function is member function
The statement char s = 'A' will internally assign value to s is:
(i) 0
(ii) 90
(iii) 65
(iv) 127
If p is a pointer, then p++ means: (i) increment the value of p (ii) increment the pointer p (iii) increment the address of the variable to which p is pointing (iv) increment the value of the variable to which p is pointing
Which of the following is not the member of class? (i) Static function (ii) Friend function (iii) Constant function (iv) Virtual function
Answer the following:
Explain template and its type with an example.
Write a program using function template to find the cube of a given integer, float and double number.
Answer the following:
What is the output of the following code?
#include <iostream.h>
class A {
public:
void f() {
std::cout << "A::f" << std::endl;
}
virtual void g() {
std::cout << "A::g" << std::endl;
}
};
class B : public A {
public:
void f() {
std::cout << "B::f" << std::endl;
}
virtual void g() {
std::cout << "B::g" << std::endl;
}
};
int main(int argc, char** argv) {
A a; B b;
A* aPtr = &a;
A* bPtr = &b;
aPtr->f();
aPtr->g();
bPtr->f();
bPtr->g();
return 0;
}
Is there anything to be noticed? Explain it.
What is virtual destructor? How virtual functions call up is maintained?
Explain the following:
Conversion from class to basic type
Function prototyping
Overload resolution
Answer the following:
Write the expressions to represent the following: (i) p is a function whose argument is a pointer to an array of characters and which returns a pointer to an integer. (ii) p is a function whose argument is a pointer to character and which returns a pointer to an array of ten integers.
What is encapsulation? What are its advantages? How can encapsulation are enforced in C++?
Give the difference between—
a pointer and a reference;
new and malloc;
object and class.
Answer the following:
In which situation catch blocks are used? Also give types of catch handler in C++.
Write a program to show the concept of rethrowing an exception.
Answer the following:
Explain nested switch () case statement with an example and also show its output.
What are iteration statements? Write a program in C++ for iteration statements (any one) and also show its output.
Answer the following:
What is function overloading? How it differs from operator overloading?
What are the differences between a C++ struct and C++ class?
Instructions:
- The marks are indicated in the right-hand margin.
- There are NINE questions in this paper.
- Attempt FIVE questions in all.
- Question No. 1 is compulsory.
Questions
Answer any seven of the following questions :
Define hardware and software.
What is the JVM?
What are the input and output of a Java compiler?
What are the benefits of using constants?
Can different types of numeric values be used together in computation?
List six comparison operators.
Write an if statement that assigns 1 to , if is greater than 0.
What are the differences between a while loop and a do-while loop?
How do you access elements of an array?
How do you determine whether a character is alphanumeric?
Answer the following:
Write a Java Programming that displays 'Welcome to Java' five times.
Describe the history of Java. Can Java run on any machine?
Answer the following:
Describe syntax errors, runtime errors and logic errors.
Write a program that reads an integer and check. Whether it is even?
Answer the following:
Write a program that displays a random uppercase letter.
Write a program to sum the following series : $\frac{1}{3} + \frac{3}{5} + \frac{5}{7} + \frac{7}{9} + \frac{9}{11} + \frac{11}{13} + \dots + \frac{95}{97} + \frac{97}{99}$
Answer the following:
Explain method abstraction and stepwise refinement.
Declare and create a 4-by-5 int matrix.
Answer the following:
Write a program that reads in eleven numbers and displays duplicate numbers.
How does a scanner work? Explain.
Answer the following:
Write a program that removes all the occurrences of a specified string from a text file.
Explain the protected data and methods.
Answer the following:
What is encapsulation? What are the benefits of data field encapsulation?
Describe the
Write short notes on any four of the following :
JDBC
Thread communication
Polymorphism
Factory methods
AWT components
Instructions:
- The marks are indicated in the right-hand margin.
- There are NINE questions in this paper.
- Attempt FIVE questions in all.
- Question No. 1 is compulsory.
Questions
Answer any seven questions :
Which of the following functions is performed by a constructor?
Which of the following factors supports the statement that reusability is a desirable feature of a language?
Which will legally declare, construct and initialize an array?
What is the numerical range of a char?
Public class Test {} What is the prototype of the default constructor?
Which of the following provides a reuse mechanism?
Which is not a valid comment style in Java?
What is the correct signature of the main method?
Which of the following statements is correct?
Which keyword is used to inherit class?
Answer the following:
Explain the main features of object-oriented programming language.
List the eight basic data types used in Java. Give examples.
Answer the following:
Discuss the Java error handling mechanism. What is the difference between runtime (unchecked) exceptions and checked exceptions? What is the implication of catching all the exceptions with the type 'Exception'?
Explain abstract class with a program. What is the Java virtual machine?
Answer the following:
What is an applet?
Write a Java program for applet to reverse a user inputted string.
Answer the following:
What is the main difference between pass-by-reference and pass-by-value?
What are access modifiers? Explain each of the access modifiers in Java.
Answer the following:
What is AWT? What are the different AWT components in Java?
Write a program in Java to create and close a frame.
Answer the following:
What is the major difference between an interface and a class?
Write a program to multiply two matrices A and B. (Assume A and B are two-dimensional matrices.)
Answer the following:
Explain interface in a package.
Create an applet which contains a Jpopup-Menu with the following items : New, Open, Cut, Copy, Paste. Display an appropriate message while clicking the respective menu items and print the output to the console.
Answer the following:
Explain deadlock in threads with the help of a program.
Write a program in Java to multiply two 2-dimensional matrices inputted from user.
Instructions:
- The marks are indicated in the right-hand margin.
- There are NINE questions in this paper.
- Attempt FIVE questions in all.
- Question No. 1 is compulsory.
Questions
Answer any seven questions :
What do you understand by object-oriented programming? How is it different from procedural programming?
What are keywords and identifiers? Explain with examples.
Distinguish between (i) object and classes, and (ii) inheritance and polymorphism.
Why do we need the preprocessor directive #include<iostream>?
What are objects? How are they created?
What is type conversion? Give example.
Can we have more than one constructor in a class? If yes, explain the need for such a situation.
What are enumeration types? Explain with examples.
What are advantages of function prototypes in C++?
When will you make a function inline? Why?
Answer the following:
What is function overloading? Illustrate function overloading through addition function which adds two integer numbers and two float numbers.
Explain break statement and continue statement with example.
Answer the following:
What is a constructor? Explain different types of constructor.
What are benefits of using functions? Write a C++ function to swap the contents of two variables and , using different parameter passing mechanisms.
Answer the following:
What is virtual function? Explain with suitable example.
With illustration, explain function overloading.
Answer the following:
What are different types of polymorphism achieved in OOP? What are pure virtual functions?
What is operator overloading? Give an example of operator overloading, using friend class.
Answer the following:
Explain how base class member functions can be involved in a derived class if the derived class also has a member function with the same name.
What is a Destructor? Write a class, using C++ without destructor and explain.
Answer the following:
What are implicit pointer and static class member? Explain with examples.
What is inheritance? Bring out the concept of various types of inheritance and importance of derived class with examples.
Answer the following:
What is Exceptional Handling? How are exceptions handled in C++?
What are Class Templates? Explain with examples.
Answer the following:
What do you understand by void pointers? Write a program to show the use of void pointers.
Explain the uses of try, throw and catch keywords, used for exceptional handling.
Instructions:
- All questions carry equal marks.
- There are NINE questions in this paper.
- Attempt FIVE questions in all.
- Question No. 1 is compulsory.
Q.1 Choose the correct answer (any seven) :
Which of the following statements is correct?
How many parameters does a Default Constructor accept?
Destructor has the same name as the constructor and it is preceded by
Which of the following types of class allows only one object of it to be created?
Which of the following statements is correct?
Which of the following statements is incorrect?
Which of the following is not a type of constructor?
Which of the following access specifies is used in a class definition by default?
Which of the following statements is correct with respect to the use of friend keyword inside a class?
How many types of polymorphisms are supported by C++?
Q.2 Solve both questions :
Define string. How does a string type differ from C type string?
WAP in C++ that reads a particular string and displays the frequency of each character in the string.
Q.3 Solve both questions :
What is ST? Describe with example.
WAP in C++ using the function count() to how many elements in a container have a specified value.
Q.4 Solve both questions :
Explain exception handling and their types.
WAP in C++ to demonstrate the use of multiple Catch statements.
Q.5 Solve both questions :
Describe streams.
Write about the following functions: put(); get(); width(); getline(); fill().
Q.6 Solve both questions :
Describe polymorphism with suitable examples.
WAP in C++ using array of pointers to accept desired number of integers and display their sum.
Q.7 Solve this question :
What is inheritance? Describe its types with examples.
Q.8 Solve both questions :
Explain 'this' pointer. Differentiate between overloaded functions and function templates.
What is a virtual function? WAP to demonstrate use of virtual functions.
Q.9 Solve both questions :
Explain friend function along with example.
Describe type conversion with examples.
Instructions:
- All questions carry equal marks.
- There are NINE questions in this paper.
- Attempt FIVE questions in all.
- Question No. 1 is compulsory.
Q.1 Choose the correct answer (any seven) :
Which of the following statements is correct?
How many parameters does a Default Constructor accept?
Destructor has the same name as the constructor and it is preceded by
Which of the following types of class allows only one object of it to be created?
Which of the following statements is correct?
Which of the following statements is incorrect?
Which of the following is not a type of constructor?
Which of the following access specifies is used in a class definition by default?
Which of the following statements is correct with respect to the use of friend keyword inside a class?
How many types of polymorphisms are supported by C++?
Q.2 Solve both questions :
Define string. How does a string type differ from C type string?
WAP in C++ that reads a particular string and displays the frequency of each character in the string.
Q.3 Solve both questions :
What is ST? Describe with example.
WAP in C++ using the function count() to how many elements in a container have a specified value.
Q.4 Solve both questions :
Explain exception handling and their types.
WAP in C++ to demonstrate the use of multiple Catch statements.
Q.5 Solve both questions :
Describe streams.
Write about the following functions: put(); get(); width(); getline(); fill().
Q.6 Solve both questions :
Describe polymorphism with suitable examples.
WAP in C++ using array of pointers to accept desired number of integers and display their sum.
Q.7 Solve this question :
What is inheritance? Describe its types with examples.
Q.8 Solve both questions :
Explain 'this' pointer. Differentiate between overloaded functions and function templates.
What is a virtual function? WAP to demonstrate use of virtual functions.
Q.9 Solve both questions :
Explain friend function along with example.
Describe type conversion with examples.
Instructions:
- The marks are indicated in the right-hand margin.
- There are NINE questions in this paper.
- Attempt FIVE questions in all.
- Question No. 1 is compulsory.
Questions
Answer any seven questions :
Which of the following functions is performed by a constructor?
Which of the following factors supports the statement that reusability is a desirable feature of a language?
Which will legally declare, construct and initialize an array?
What is the numerical range of a char?
Public class Test {} What is the prototype of the default constructor?
Which of the following provides a reuse mechanism?
Which is not a valid comment style in Java?
What is the correct signature of the main method?
Which of the following statements is correct?
Which keyword is used to inherit class?
Answer the following:
Explain the main features of object-oriented programming language.
List the eight basic data types used in Java. Give examples.
Answer the following:
Discuss the Java error handling mechanism. What is the difference between runtime (unchecked) exceptions and checked exceptions? What is the implication of catching all the exceptions with the type 'Exception'?
Explain abstract class with a program. What is the Java virtual machine?
Answer the following:
What is an applet?
Write a Java program for applet to reverse a user inputted string.
Answer the following:
What is the main difference between pass-by-reference and pass-by-value?
What are access modifiers? Explain each of the access modifiers in Java.
Answer the following:
What is AWT? What are the different AWT components in Java?
Write a program in Java to create and close a frame.
Answer the following:
What is the major difference between an interface and a class?
Write a program to multiply two matrices A and B. (Assume A and B are two-dimensional matrices.)
Answer the following:
Explain interface in a package.
Create an applet which contains a Jpopup-Menu with the following items : New, Open, Cut, Copy, Paste. Display an appropriate message while clicking the respective menu items and print the output to the console.
Answer the following:
Explain deadlock in threads with the help of a program.
Write a program in Java to multiply two 2-dimensional matrices inputted from user.
Instructions:
- The marks are indicated in the right-hand margin.
- There are NINE questions in this paper.
- Attempt FIVE questions in all.
- Question No. 1 is compulsory.
Questions
Choose the correct answer (any seven) :
Which of the following statements is correct? (i) A reference is stored on heap (ii) A reference is stored on stack (iii) A reference is stored in a queue (iv) A reference is stored in a binary tree
How many parameters does a Default Constructor accept? (i) 0 (ii) 1 (iii) 2 (iv) 3
Destructor has the same name as the constructor and it is preceded by (i) ~ (ii) ! (iii) & (iv) ?
Which of the following types of class allows only one object of it to be created? (i) Virtual class (ii) Abstract class (iii) Singleton class (iv) Friend class
Which of the following statements is correct? (i) Two functions having same number of argument, order and type of argument can be overloaded if both functions do not have any default argument (ii) Overloaded function must have default arguments (iii) Overloaded function must have default arguments starting from the left of argument list (iv) A function can be overloaded more than once
Which of the following statements is incorrect? (i) Default arguments can be provided for pointers to functions (ii) A function can have all its arguments as default (iii) Default argument cannot be provided for pointers to functions (iv) A default argument cannot be redefined in later declaration
Which of the following is not a type of constructor? (i) Copy constructor (ii) Friend constructor (iii) Default constructor (iv) Parameterized constructor
Which of the following access specifies is used in a class definition by default? (i) Protected (ii) Public (iii) Private (iv) Friend
Which of the following statements is correct with respect to the use of friend keyword inside a class? (i) A private data member can be declared as a friend (ii) A class may be declared as a friend (iii) An object may be declared as a friend (iv) We can use friend keyword as a class name
How many types of polymorphisms are supported by C++? (i) 1 (ii) 2 (iii) 3 (iv) 4
Answer the following:
Define string. How does a string type differ from C type string?
WAP in C++ that reads a particular string and displays the frequency of each character in the string.
Answer the following:
What is STL? Describe with example.
WAP in C++ using the function count() to how many elements in a container have a specified value.
Answer the following:
Explain exception handling and their types.
WAP in C++ to demonstrate the use of multiple Catch statements.
Answer the following:
Describe streams.
Write about the following functions : put() ; get() ; width() ; getline() ; fill().
Answer the following:
Describe polymorphism with suitable examples.
WAP in C++ using array of pointers to accept desired number of integers and display their sum.
What is inheritance? Describe its types with examples.
Answer the following:
Explain ‘this’ pointer. Differentiate between overloaded functions and function templates.
What is a virtual function? WAP to demonstrate use of virtual functions.
Answer the following:
Explain friend function along with example.
Describe type conversion with examples.
Instructions:
- The marks are indicated in the right-hand margin.
- There are NINE questions in this paper.
- Attempt FIVE questions in all.
- Question No. 1 is compulsory.
Questions
Answer any seven MCQs :
Which of the following is not a valid identifier in C++? (i) Return (ii) MyInt (iii) MyInteger (iv) Total3
What is the value of after the following statements? int x; x = 0; x = x + 30; (i) 0 (ii) 30 (iii) 33 (iv) Garbage
What is the value of the following expression? (true && (4/3 || !(6))) (i) True (ii) False (iii) 0 (iv) Illegal syntax
When defining a class, the class should be composed of the kind of values a variable of the class can contain, and (i) member functions for that class (ii) the keyword private (iii) other class definitions (iv) nothing else
Data members or member functions of a class that are declared to be private may (i) only be accessed by the main program (ii) only be accessed by members of the class (iii) not be accessed by the class (iv) be considered as global variables
When overloading an operator, which of the following is true? (i) One of the arguments must be an object of the class (ii) The operator can be a friend or a member of the class (iii) The operator does not have to be a friend or a member of the class (iv) All of the above (v) None of the above
class derived : public base1, public base2 {} is an example of (i) polymorphic inheritance (ii) multilevel inheritance (iii) hierarchical inheritance (iv) multiple inheritance
In the derived class definition, you list from the base class (i) all the member functions every time (ii) only those member functions that need to be redefined (iii) only those member functions that were in the public section (iv) only those member functions you want to overload
Which of the following is not a valid reason for using exception handling? (i) Throw and catch can be used like goto (ii) The procedure for handling an error depends on the situation (iii) Need to handle built-in exceptions (iv) None of the above
You should make a function a virtual function if (i) every class that is derived from this class uses all the member functions from this class (ii) every class that is derived from this class needs to redefine this function (iii) that function is an operator (iv) only in the derived classes
Answer the following:
Write five differences between Procedural and Object-Oriented Programming.
Differentiate between Private, Public and Protected data members of the class using examples.
Answer the following:
Mention the difference between C and C++. Why is it necessary to include header files in a program written in these languages?
Write a C++ program to find the sum of the series .
Define copy constructor. Explain its significance. Under which condition is it invoked? Support your answer with an example.
Answer the following:
Discuss the basic data types of C++. Suggest appropriate data type for the following:
Write a program, which will accept a string of maximum 10 characters from the keyboard, and count the occurrences of each of the 5 vowels in the string. The output should be in tabbed format as shown below:
A E I O U 0 1 0 0 1
Explain branching statements used in C++ with example.
Answer the following:
What is operator overloading in C++? Explain with suitable example. Also list operators which cannot be overloaded.
Differentiate between Operator and Function overloading with the help of suitable example.
Answer the following:
Create a class complex and implement the following:
With relevant examples, explain (i) multilevel inheritance (ii) hybrid inheritance.
Answer the following:
Explain the concept of a destructor in a class. What is its role in terms of cleanup of unwanted objects?
How is an exception handling performed in C++? Write a program that throws an arithmetic exception as and when a number input is greater than 9999.
Answer the following:
Design and implement a class string using an array, with a maximum size of 20 characters. The class should contain the necessary constructors, destructor, overloaded assignment operator and a friend function for concatenation of two strings. Make suitable assumptions if required. Also write main() for the above.
What is an inline function? In which situations would you make a function inline? Give two examples of inline functions.
Answer the following:
Syntactically explain nested "if-else" statement in C++.
Define the following: