Thursday 28 April 2011

question paper review(april 2011)

Question paper review:
hi I believe all of you wrote good for cpp exam. Here I analyze which appears to be confusion for you

  1. What is the Principle of OOP?
  2.  Ans:
    It is nothing but Properties of OOP's. If u write at least 4 properties also you get full marks
    1. Define Constructor. Write is syntax.
     Ans: 
    1. Compare classes in C++ with structures in C.
     Ans: means difference between classes and structures
    1. Define Pass by reference method
     Ans:here you have to write the definition of REFERENCE Variable
    (actually there are two kinds of Function calls (1)Pass by Value (2) Pass by Reference. Do u remember I explained swap the values using pass by reference while explaining the Reference variable.)
    1. List the uses of references.
      Ans: /*see the notes for advantages of reference variable. This question is most frequently asked question in Interviews > 
    1) Fast Execution 2) Saving Memory 3) We can avoid the pointers 4) dulication is avoided
    5) No complexity
    1. State the relationship between base class and derived class.
    Ans: 
    1. State any three Benefits of Inheritance.
     Ans: here you have to write the advantages of Inheritance
    1. State the need for Virtual Functions in C++.
    Ans:/* if you write the definition of virtual function it is enough    */ (i) main reason for having a virtual function is to implement a different functionality in the derived class. (ii) to add (means we can redefine in derived class) more facility to that function (iii)virtual functions are needed to develop late binding concepts.  9.     Define custom / user defined manipulators.
    Ans: Actually this question is unexpected question.
             There are two kinds of manipulators 
             (1) standard I/O manipulators
             (2)User defined(custom) manipulators
             if you write the standard I/O manipulators also they may give you the marks
            An important feature of c++ streams is that they also work well with user-defined manipulators as they do with predefined(build-in) manipulators. Hence, the users can design their own(customized) manipulators to control the appearance of the output depending upon their taste and need. The syntax for crating a custom manipulators is shown as follows. In the syntax, manipulator is the name of the user defined manipulator. Output is the manipulator caller and stream cascading object and arguments if any is used for arguments for parameterized manipulator. Syntax: Ostream& manipulator(ostream &output, argements) {        -------       -------      -------    return statement; }
             /*to see the answer then go to 4th chapter C++ I/O 
    10. What is Generic programming?
    Ans: Generic Programming is nothing but Templates. I hope you wrote this question
    PART- B                                    5*10=50
    1. How will you overload Unary and binary operator using Friend functions?
    Ans:  we know that there are two types of operator overloading:          (i) unary operator overloading          (ii)binary operator overloading
    1. (a)Explain the structure of C++ program with an example program.   
    Ans:
            (b) Explain the steps in developing a C++ program.
    Ans:
    1. Write a C++ program function overloading.
    Ans:
    1. Explain the creating and accessing of array of objects with an example program.
    Ans:
    1. Write a C++ program to illustrate multiple inheritance.
    Ans:
    1. Write a C+ program to illustrate virtual base class in multipath inheritance.
    Ans:
    1. Explain the various file stream classes needed for File Manipulators.
    Ans:  (i) Ofstream: stream class to write on files  (ii)Ifstream: stream class to read from files  (iii)Fstream: stream class to both read and write from/to files. these  classes are derived directly or indirectly from the classes istream, and ostream. We have already used objects whose types were these classes: cin is an object of class istream and cout is an object of class ostream. Therefore, we have already been using classes that are related to out file streams. Ans in fact, we can use our file streams the same way we are already used to usecin and cout, with the only difference that we have to associate these streams with physical files: (i) ifstream: this is the class for input operation on files similarly to statndard input. It includes the methods(functions) open(), close(), read(), get() getline(), and the overloaded extraction operator. (ii) ofstream: this is the class for output operation of files. Similarly, to standard output methods included are open(), close(), put(), write() and the overloaded insertion oerator., (iii) fstream: this class derived from both ifstream and ofstream all the classes are declared in the fstream.h header file. The file also includes iostream.h files
    1. Explain a class template for stack data structures.
    Ans:

Tuesday 26 April 2011

Concentrate the following chapters

1. First chapter which carries 42 marks so you must read this chapter
2. classes and Inheritances carries 29 marks
3. Templates carries 13 marks (function templates and class templates)
4. Arrays, Pointers, References carries 13 marks
5. c++ I/O Which carries 13 marks


Tuesday 19 April 2011

All The Best

Today exams started, final year students wrote the exams, I heard that every day checking Squad comes, today also 4 members came to our college and checked, fortunately no body was caught by them,
so be careful..
You Have to concentrate first three chapters.
I Wish You All the Best, I hope you are preparing very well, .......:-)


CME IV TH SEM TIME TABLE
9.30 AM TO 12.30 PM.
Subcode
Date
subject
401
20.04.2011
English
402
23.04.2011
OS
403
26.04.2011
CH
404
28.04.2011
Cpp
405
03.05.2011
MP
406
05.05.2011
WB

Wednesday 13 April 2011

Marks Weightage for Polytechnic Diploma



MARKS WEIGHTAGE

Subject                        : OOPS THROUGH C++
Subject Code  : CM-404


SNO
TOPICS
MARKS
SHORT
LONG
1.
OBJECT ORIENTED PROGRAMMING METHODOLOGY INTRODUCTION TO C++
42
4
3
2.
ARRAYS, POINTERS, REFERENCES
13
1
1
3
Classes and Inheritance
29
3
2
4.
C++ I/O
13
1
1
5.
Templates
13
1
1

Wednesday 6 April 2011

Mistakes you made in the Unit-II

  • Most of the students made a mistake that is                                                                                                'virtual function' ,                                                                                                                                           pure virtual function,                                                                                                                                 and virtual Base class. Here these three are different concepts but most of the students wrote the definition of virtual base class for pure virtual function and virtual function.
  • So read carefully about those concepts
  • I have given in this blog for 'pure virtual function, and virtual functions with program (classes and Inheritance) so note down that programs
  • Very a few students wrote correct definitions
  • I will post Unit II marks very soon
What is Virtual Function?

Ans: When derived class overrides the base class function by redefining the same function, then if user wants to access redefined the function from derived class through a pointer from base class object, then you must define this function in base class as virtual function.
/* see in this blog for syntax, program */

What is pure virtual function?

Pure virtual function is virtual function with no body is known as Pure Virtual function.
/* see in this blog for syntax, program */

What is virtual Base class?
Ans: /* see the notes */

Sunday 3 April 2011

happy ugadi

happy ugadi

5. Templates

Templates are a feature of the C++ programming language that allow functions and classes to operate with generic types . This allows a function or class to work on many different data types without being rewritten for each one.
Templates are of great utility to programmers in C++, especially when combined with multiple inheritance and operator overloading.

Function templates

Function templates are special functions that can operate with generic types. This allows us to create a function template whose functionality can be adapted to more than one type or class without repeating the entire code for each type.

In C++ this can be achieved using template parameters. A template parameter is a special kind of parameter that can be used to pass a type as argument: just like regular function parameters can be used to pass values to a function, template parameters allow to pass also types to a function. These function templates can use these parameters as if they were any other regular type.

types of the templates:
1. function templates
2. generic classes or classes
3. explicit template specialization
2 Advantages and disadvantages
3 Generic programming features in other languages

The format for declaring function templates with type parameters is:


// function template
#include <iostream>
#include<conio.h>

template <class T>
T Max (T a, T b)
{
  T result;
  result = (a>b)? a : b;
  return (result);
}

void main ()
{
  int i=5, j=6, k;
  long l=10, m=5, n;
  k=Max<int>(i,j);
  n=Max<long>(l,m);
  cout << k << endl;
  cout << n << endl;
  

}

Class templates

We also have the possibility to write class templates, so that a class can have members that use template parameters as types. For example:

#include<iostream.h>
#include<conio.h>
template <class T>
class Demo
{
 T x,y,z;
 friend void display();
 public:
 //member function declarations
  temple();
void display();
}; //end of temple class
//defining member functions outside of its class
template <class T>
Demo::Demo()
  {
   x=2;
   y=3;
   z=4;
  }
template <class T>
 void Demo::display()
 {
  cout<<x<<endl<<y<<endl<<z<<endl;
 }

 void main()
 {
     Demo<int>obj;  //creating object, T is replaced with int
     clrscr();
      obj.display();
      getch();
}



Other Examples on Class Templates:
Single Linked List program

transpose of a maticx


/*transpose of a maticx*/
#include<iostream.h>
#include<conio.h>
void main()
{
 int m=3,n=3; //row size, colum size is 3 , m=n
 int a[][3]={1,2,3,4,5,6,7,8,9};//initializing the array
 clrscr();
cout<<"after transpose"<<endl;
 for(int i=0;i<=m-1;i++)  //this loop for rows
  for(int j=i+1;j<=n-1;j++) //this loop for columns
  {
   a[i][j]=a[i][j]+a[j][i]-(a[j][i]=a[i][j]); //swap the elements above diagnols with those below diagnols
  }
//displaying the transpose of 'a' matrix
  for(i=0;i<=m-1;i++)
  {
   cout<<"\n"; //for displaying row wise
   for(j=0;j<=n-1;j++)
   {
    cout<<a[i][j]<<"\t";
   }
  }
  getch();
 }

I WISH YOU ALL THE BEST FOR FOURTH SEMISTER STUDENTS





I WISH YOU ALL THE BEST , I HOPE YOU ARE PREPARING VERY WELL IN THE EXAM, PRACTICE ALL THE PROGRAMS ESPECIALLY RECORD PROGRAMS:


TIPS TO SECURE GOOD MARKS IN THE CPP EXAM


  • Border lines , you know that, every exam you do
  • Use pencil also to underline

  • any question in section B you have to start with (i)defination (ii) syntax (iii) advantages (iv)disadvantages (v) rules (vi) example program. 
example: 
defination:Inline function: inline function is a function , at the time of function call what are the statements are in inline function that are substituted at the place of function call
syntax: 
inline returntype function()
{
  -----;
  -----;
}
advantages:
  (i) fast execution
  (ii)...//see the notes.
Disadvantages:
<<no need for this quesiton>>
rules:

example program:
...
  • dont keep the papers blank.
  • What is Hybrid Inheritance? Explain with a program?
Ans: definition:
        syntax: /*Multiple Inheritance or Multilevel Inheritance
       program: /*write multiple inheritance program

c05 OCT/NOV 2010 FIFTH SEMISTER RESULTS



STATE BOARD OF TECHNICAL EDUCATION AND TRAINING

ANDHRA PRADESH : HYDERABAD


C05 RESULTS OCT/NOV 2010.


Fifth Semister

sno
PIN
NAME
501
502
503
504
505
506
507
508







cpp



1
08036-CM-058
veera hareesha
50
84
44
25
74
88
91
94
2
08090-CM-204
sree laxmi
16
57
32
27
49
90
90
91
3
08090-CM-245
NALLA JYOTHI
47
39
20
24
57
88
91
89
6
08121-CM-001
rajashekhar
77
80
57
69
71
100
100
100
8
08121-CM-3
vishnu murthy
74
68
64
80
77
97
97
100
9
4
MADHANMOHAN REDDY
76
69
46
35
26
88
90
92
10
5
SRIKANTH
73
73
50
49
56
97
99
100
11
6
RAMAVATH SAKRU
54
31
40
20
31
86
84
88
14
9
NAGESHWAR REDDY
82
71
61
75
84
100
99
98
16
11
PRANAY KUMAR
87
62
84
93
81
100
100
100
17
12
SURENDRA KUMAR
57
45
38
21
49
88
87
86
18
13
KANDHAGATLA ARUNA
73
62
67
61
96
98
98
99
19
14
SHAREEF MD
0
0
0
0
0
20
20
20
20
    08124-CM-015
BOLLA JAHNAVI
82
46
78
74
92
100
99
100
21
16
GUGULOTH VINODH
94
93
98
89
93
100
100
100
22
17
SRUJAN KUMAR
38
43
31
40
31
93
92
94
23
18
RESHMA SULTANA
49
56
31
54
64
86
89
97
24
19
PAVAN KUMAR
51
63
31
57
50
93
89
93
25
20
RAVICHANDER A
38
51
9
43
38
78
81
88
26
21
LOHITHA
48
60
49
47
52
92
95
98
27
22
  KOTHOJU SHRAVAN KUMAR
45
75
43
37
44
94
93
96
28
    08124-CM-025
    THOTA BHAVANI
65
84
59
76
91
100
100
100
31
26
    VARAKALA MADHURI
18
41
20
13
43
34
36
37
32
    08124-CM-027
    GURVANI SRIVANI
84
62
62
52
83
99
97
100
35
30
    AVULA SURESH REDDY
40
38
32
38
57
93
88
94
36
    08124-CM-031
VADDE KIRAN
84
70
86
82
97
96
99
100
39
34
VARANASI ANIL KUMAR
31
8
20
8
13
91
85
82
40
    08124-CM-035
    G Y DEEPIKA
65
63
53
54
80
98
98
99
41
36
PILLI SAI PRAKASH
41
42
40
16
44
89
85
89
42
37
    SYEDA SANA
58
24
28
24
50
86
87
87
45
40
    B JHANSI RANI
44
40
39
61
48
83
88
90
46
    08124-CM-041
    CHOLLETI RAKESH KUMAR
59
64
72
60
73
98
96
95
47
42
    DANDU RAM KUMAR
25
44
21
4
49
90
88
89
49
    08124-CM-044
    N RADHIKA
76
64
64
80
62
92
97
98
50
45
    AKASH CHANDRA CHATURVEDI
0
0
0
0
0
20
20
20
52
47
    BANGARAM NIRMALA
87
68
56
85
62
99
100
100
56
    08124-CM-051
    MADHELAL R UDAY SAI RAJ
17
11
18
9
8
82
86
87
58
    08124-CM-053
    S SHIRISHA
53
63
46
60
49
95
94
94
61
    08124-CM-056
    MAMILLA SAI PADAM
66
71
65
66
81
97
99
99
62
    08124-CM-057
    G KARTHIK KUMAR REDDY
29
41
39
42
59
89
90
85
65
    08124-CM-060
    BHANDARI ROUNAK
49
11
25
35
21
87
88
87
66
    08124-CM-061
    MD ABUBAKAR
76
67
84
86
68
93
100
99
68
    08124-CM-063
    RAGIPANI RAKESH KUMAR
69
68
69
81
79
93
99
96
69
    08124-CM-064
    KODAVATH VINOD
58
80
53
42
63
96
93
93
70
    08124-CM-065
    PENMATSA MADHURI
80
83
78
78
91
100
100
100
71
    08124-CM-066
    RAJULA SANDEEP
72
90
86
75
72
94
96
97
72
    08124-CM-067
    SANGISETTY SHIVANATH
53
52
65
57
79
98
96
98
73
    08124-CM-068
    S SAI ANIRUDH
72
70
65
70
95
97
93
99

08124-CM-069
    ATAPAKALA DIVAKARA RAO
48
71
78
70
94
99
100
100
75
    08124-CM-070
    MEGAVATH RAJENDHER
19
67
56
44
70
94
94
97
76
    08124-CM-071
    TADIKONDA VENKATA GOPI KRISHNA
29
74
62
55
76
94
91
92
77
    08124-CM-072
    DAPKE VIVEK
56
47
53
68
82
96
96
98
78
    08124-CM-073
    MEDHARA CHANDRAVENI
66
70
72
90
77
99
100
100
79
    08124-CM-074
    NALLAPALLY STEPHEN ULLASINI
47
29
42
30
48
92
90
92
80
    08124-CM-075
    SHAIK SALAM
59
41
46
47
69
92
92
96
81
    08124-CM-076
    R VIVEKANAND
74
47
69
78
53
95
94
99
82
    08124-CM-077
    BUNSODE SHALINI
96
64
83
87
90
100
100
100
83
78









84
    08124-CM-079
    MD IMRAN UL HAQ
41
46
52
17
36
89
91
87
85
80









86
    08124-CM-081
    B SHYAM
82
73
67
77
62
96
99
100
87
82









88
83









89
    08124-CM-084
    CH ARJUN
52
66
48
45
49
94
93
93
90
    08124-CM-085
    THAKUR KISHORE SINGH
66
46
52
41
33
93
88
86
91
    08124-CM-086
    AASHISH KALE
74
75
58
64
44
94
99
95
92
    08124-CM-087
    MUDETHULA PRASHANTH
80
80
72
83
74
96
99
100
93
88









94
    08124-CM-089
    NUMBI BHANU PRAKASH
66
75
59
55
64
94
95
97
95
90









96
    08124-CM-091
    THADURU SHAMALA
85
90
81
73
74
100
100
100
97
    08124-CM-092
    SUNITHA BIRADAR
86
87
90
88
77
100
99
100
98
    08124-CM-093
    THUMUKUNTA MALLIKARJUN REDDY
69
77
48
58
31
93
93
92
99
94









100
    08124-CM-095
    B RENUKA
66
77
76
84
84
100
98
100
101
    08124-CM-096
    BILLA SRINIVAS
53
48
44
38
28
88
92
87
102
97









103
98









104
    08124-CM-099
    SYED OSMAN ALI
94
90
82
81
70
100
100
99
105
    08124-CM-100
    MOHD SALMAN KHAN
40
57
53
61
54
92
89
87
106
101









107
102









108
    08124-CM-103
    SAGGU DIVYA
73
62
47
82
88
97
94
98
109
    08124-CM-105
    PADASANABOINA MADHURI
45
64
56
62
72
92
90
95
110
105









111
    08124-CM-106
    G KIRAN KUMAR
48
58
45
45
43
88
91
85
112
107









113
108









114
109









115
    08124-CM-110
    MAYAKOTI MAHESH KUMAR
18
59
27
38
17
81
89
86
116
111









117
    08124-CM-112
    RAVIPATI TARUN KUMAR
54
51
45
48
66
96
88
94
118
113









119
    08124-CM-114
    AKULA RAJESH
71
70
68
75
62
98
99
97
120
    08124-CM-115
    INKULU RAHUL
55
61
60
64
62
89
93
97
121
    08124-CM-116
    KASTHURI KUMARI B
47
43
57
75
45
88
92
97
122
    08124-CM-117
    AIJAZ MOHIUDDIN
71
74
66
85
68
88
94
91
123
    08124-CM-118
    MADARI MRINALINI
46
40
60
65
57
84
92
93
124
    08124-CM-119
    K GNANESHWAR GOUD
48
37
19
22
44
78
86
83
125
    08124-CM-120
    LADDHA VAISHNAVI
78
54
59
76
85
99
100
100
126
    08124-CM-201
    CHEGURI RAKESH KUMAR
75
56
65
65
66
99
100
100
127
    08124-CM-204
    K MAHESH
43
27
38
54
34
86
88
98
128
    08124-CM-205
    PARSA PRASAD
73
72
82
68
81
93
94
100
129
    08124-CM-206
    MUNAVATH ANITHA
70
49
65
66
75
88
92
94
130
    08124-CM-207
    GANDHAM BRAHMAIAH
94
72
94
85
98
100
100
100
131
    08124-CM-208
    MOHAMMAD NAYEEM
54
36
38
24
61
84
89
89
132
    08124-CM-209
    THALLA RAMA RAO
68
52
53
31
71
91
90
93
133
    08124-CM-210
    SYED EHTESHAM ALI
58
38
43
37
64
90
92
92
134
    08124-CM-211
    VUPPULA AJITH KUMAR
70
57
76
50
69
97
99
100
135
    08124-CM-213
    MADDELA MADHUSUDHAN SAGAR
70
25
48
49
56
94
98
95
136
    08124-CM-214
    ANUGULA PAVAN KUMAR
98
86
81
60
84
97
99
99
137
    08124-CM-215
    G BALARAJU
57
46
54
41
74
93
93
92
138
    08124-CM-217
    SANIKE MANISH
96
83
90
88
92
99
100
100
139
    08124-CM-218
    FAHAD AHMED SALAM
60
39
23
12
46
87
91
90
140
    08124-CM-219
    KOTHAPALLY CHANDRASHEKAR
95
61
77
53
87
91
98
97
141
    08124-CM-223
    RAMJELLI MARIAMMA
88
84
60
52
85
96
96
98
142
    08124-CM-225
    DANTHOJU VENKATESH
97
91
84
88
98
99
100
100
143
    08124-CM-225
    DANTHOJU VENKATESH
97
91
84
88
98
99
100
100
144
    08124-CM-025
    THOTA BHAVANI
65
84
59
76
91
100
100
100
145
    08124-CM-027
    GURVANI SRIVANI
84
62
62
52
83
99
97
100