This document provides several code snippets with syntax errors and the corrected code. The summaries are:
1) The document provides C++ code snippets with errors and the corrected code with the errors underlined. Various syntax errors like missing headers, incorrect function calls, and missing semicolons are provided along with the corrections.
2) For each code snippet, the full marks are awarded for correctly identifying and fixing all errors. Partial marks are awarded for identifying errors but not providing corrections or correcting some but not all errors.
3) The document tests knowledge of C++ syntax like headers, data types, functions, classes, and correcting common errors in code snippets. The corrected code is provided to check understanding of fixing syntax
The aptitude test consisted tricky questions on core subjects of CSE like C , C++, Java ,Data Structures, Database, Computer Networks, Theory of Computation.
The aptitude test consisted tricky questions on core subjects of CSE like C , C++, Java ,Data Structures, Database, Computer Networks, Theory of Computation.
We have successfully created and continue developing PVS-Studio analyzer for C/C++ languages. Over the time, it became clear that many of the diagnostics that we have implemented are not related to a specific programming language, so we decided to apply our experience to another programming language, namely C#. In this article, we are talking about the analysis of Code Contracts project by Microsoft done by our C# analyzer
1z0 851 exam-java standard edition 6 programmer certified professionalIsabella789
Guaranteed success with updated troytec dumps for 1Z0-851 Exam-Java Standard Edition 6 Programmer Certified Professional visit@ https://www.troytec.com/1Z0-851-exams.html
Practical Class 12th (c++programs+sql queries and output) Aman Deep
Just download this and do some specific changes in the name section and roll no section . and submit it as it is to your teacher this will surely work and help you out your class 12th board practicals exam . no worries ! ENJOY :) !
We have successfully created and continue developing PVS-Studio analyzer for C/C++ languages. Over the time, it became clear that many of the diagnostics that we have implemented are not related to a specific programming language, so we decided to apply our experience to another programming language, namely C#. In this article, we are talking about the analysis of Code Contracts project by Microsoft done by our C# analyzer
1z0 851 exam-java standard edition 6 programmer certified professionalIsabella789
Guaranteed success with updated troytec dumps for 1Z0-851 Exam-Java Standard Edition 6 Programmer Certified Professional visit@ https://www.troytec.com/1Z0-851-exams.html
Practical Class 12th (c++programs+sql queries and output) Aman Deep
Just download this and do some specific changes in the name section and roll no section . and submit it as it is to your teacher this will surely work and help you out your class 12th board practicals exam . no worries ! ENJOY :) !
This set of slides introduces the reader to the concept of arrays in C++ (with elements of C++11 and C++14). After presenting the array data type, the concept of array-to-pointer decay is introduced. The presentation proceeds with a discussion on how to pass arrays to functions. To this extent, the reader is guided to the use of bounded ranges as the first step towards the use of the Standard Template Library (STL).
Download this Presentation for free from www.ecti.co.in/downloads.html
No SIGN UP REQUIRED.
C Programming Training PPTs / PDFs for free.
Download free C Programming study material. Learn C Programming for free in 2 hours.
Spring 2014 CSCI 111 Final exam of 1 61. (2 points) Fl.docxrafbolet0
Spring 2014 CSCI 111 Final exam � of �1 6
1. (2 points) Flip over this test. On the back of this test write your name in the upper, left-hand
corner.
2. (2 points) What are the four parts of the compiling process (just give me 4 words, not a
paragraph).
3. (4 points) Which of the four steps of the compiling process occurs only once, regardless of
the number of source files your application has?
4. (4 points) Write a line of code that causes the preprocessor to generate an error.
5. (4 points) Write a line of code that causes the compiler to generate an error.
6. (5 points) Describe how you could incorrectly compile the joust project to cause the linker to
generate an error.
7. (5 points) Given:
1 float* fp;
2 //...
3 float pi;
4 pi=*(314 + fp);
Rewrite line 4 using array subscript notation.
Spring 2014 CSCI 111 Final exam � of �2 6
8. (5 points) Given:
1 float arr[100];
2 for(int x=0; x<100; ++x)
3 arr[x]=100-x;
What does the following expression print out?
cout << *arr << endl;
9. (14 points) Given:
int a=0;
int b=6;
int x=0;
Circle each if-expression that evaluates to true:
A) if(b)
B) if(x)
C) if(a=b==6)
D) if(a=b==5)
E) if(a=b=5)
F) if(a=x=0)
G) if(a=x==0)
Spring 2014 CSCI 111 Final exam � of �3 6
10. (10 points) Given:
1 #include<iostream>
2 using namespace std;
3
4 int main()
5 {
6 int x;
7 cout << "Enter a number greater than 10" << endl;
8 while ( x < 10 )
9 {
10 cin >> x;
11 }
12 return 0;
13 }
This program compiles just fine, and sometimes it runs as expected. But sometimes when you
run it, it exits immediately after printing "Enter a number greater than 10". That is, the program
doesn't pause for you to enter a number. Why are you getting this inconsistent behavior?
11. (4 points) What is the output of the following:
int x=4;
int y=3;
A) cout << x / y << endl;
B) cout << x % y << endl;
C) cout << x << "%" << y << endl;
D) cout << "x" << '%' << 'y' << endl;
Spring 2014 CSCI 111 Final exam � of �4 6
12. (16 points) What is the type of the expression. That is, what is the kind of thing that each
expression evaluates to. For example:
3 + 4 integer
You may assume that the variable a has been declared as an integer.
A. a + 4
B. a = 4
C. 3.14 + 4.49
D. 3 + 3.14
E. 'a'
F. cout << a
G. new float[30]
H. new float
Spring 2014 CSCI 111 Final exam � of �5 6
13. (5 points) Write a for-loop that prints out the numbers between 1 and 100 that are evenly
divisible by three.
14. (5 points) Write a while-loop that prints out the numbers between 1 and 100 that are evenly
divisible by three.
15. (5 points) Write a do-while-loop that prints out the numbers between 1 and 100 that are
evenly divisible by three.
Spring 2014 CSCI 111 Final exam � of �6 6
16. (10 points) Given:
1 #include<iostream>
2
3 class Willow {
4 publi.
To write a program that implements the following C++ concepts 1. Dat.pdfSANDEEPARIHANT
To write a program that implements the following C++ concepts 1. Data Encapsulation 2.
Instantiate classes 3. Composition Class 4. Aggregation Class 5. Dynamic Memory 6. File
Stream Make a program that reads a file and can generate reports. Each file will have phone calls
records (see section 4). The program will process the data gathering all minutes and total amount
for each report. The program should have a menu (see section 1): 1. New Report – this option
will ask a file name (TE??????.tel). This option will instantiate an object of Report class, loading
the whole file into memory. 2. Delete a report – this option will display all reports available in
memory and ask which one you would like to delete. 3. Display a report – this option will
display all reports available in memory and ask you which one you would like to generate a
report. 4. Exit – Program ends. For option 1, you do not know how many reports are, meaning
that you will create dynamically the reports. For long distance calls the formula will be (minutes
call x $1.50). For local phone calls the formula will be (minutes call x $0.25)
--------------------------------------------------------------------------------------------------------------------
----------------------------
//Main.cpp
*#define between(x,y,z) ((x>=y && x<=z)? true:false)
#include
#include
#include
#include \"Data.h\"
#include \"Report.h\"
#include \"Menu.h\"
using namespace std;
//uses class Report to create reports
//uses class Menu to display a menu to choose
int main() {
int idx = 0;
int count = idx;
Menu menu(\"Reports\");
Data temp;
string fileName;
Report* phoneCompany;
Report* newReport(Report*, int&);
Report* deleteReport(Report*, int&, int);
int displayReport(Report*, int);
bool fileNameExists(string);
menu.addMenuItem(\"New Report\");
menu.addMenuItem(\"Delete a Report\");
menu.addMenuItem(\"Display a Report\");
ofstream openFile;
phoneCompany = NULL;
phoneCompany = new Report[count];
do {
cout << menu;
cin >> menu;
switch (menu.getChoice()) {
case \'1\':
cout << \"\ \\tEnter report name (TE??????): \";
cin >> fileName;
openFile.open(fileName + \".tel\");
if (openFile.good()) {
cout << \"\ \\tReport succesfully created.\ \";
phoneCompany[count].setFileName(fileName);
count++;
}
else {
cout << \"\ \\terror: Could not create report.\ \";
}
break;
case \'2\':
if (count != 0) {
do {
system(\"cls\");
cout << \"\ \ \\tDelete a Report:\ \ \";
idx = displayReport(phoneCompany, count);
if (between(idx, 0, count - 1)) {
phoneCompany = deleteReport(phoneCompany, count, idx);
idx = 0;
}
else
cout << \"\ \\terror: Report could not be deleted.\ \";
} while (idx != count);
}
else {
cout << \"\ \ \\tNo reports to delete.\ \ \";
system(\"pause\");
}
break;
case \'3\':
if (count != 0) {
do {
system(\"cls\");
cout << \"Display a Report:\ \ \";
idx = displayReport(phoneCompany, count);
system(\"cls\");
cout << \"\ \\t\" << phoneCompany[idx].getFileName();
cout << \"\ \ \\tWould you like to edit the report?\";
cout << \.
Fun with Lambdas: C++14 Style (part 1)Sumant Tambe
If virtual functions in C++ imply design patterns, then C++ lambdas imply what? What does it really mean to have lambdas in C++? Frankly, I don't know but I've a hunch: It's BIG.
Just like virtual functions open doors to the OO paradigm, lambdas open doors to a different paradigm--the functional paradigm. This talk is not a praise of functional programming or some elusive lambda-based library. (Although, I'll mention one briefly that tops my list these days.) Instead, the goal is to have fun while working our way through some mind-bending examples of C++14 lambdas. Beware, your brain will hurt! Bring your laptop and code the examples right along because that may be the fastest way to answer the quiz.
Normal Labour/ Stages of Labour/ Mechanism of LabourWasim Ak
Normal labor is also termed spontaneous labor, defined as the natural physiological process through which the fetus, placenta, and membranes are expelled from the uterus through the birth canal at term (37 to 42 weeks
MATATAG CURRICULUM: ASSESSING THE READINESS OF ELEM. PUBLIC SCHOOL TEACHERS I...NelTorrente
In this research, it concludes that while the readiness of teachers in Caloocan City to implement the MATATAG Curriculum is generally positive, targeted efforts in professional development, resource distribution, support networks, and comprehensive preparation can address the existing gaps and ensure successful curriculum implementation.
Macroeconomics- Movie Location
This will be used as part of your Personal Professional Portfolio once graded.
Objective:
Prepare a presentation or a paper using research, basic comparative analysis, data organization and application of economic information. You will make an informed assessment of an economic climate outside of the United States to accomplish an entertainment industry objective.
2024.06.01 Introducing a competency framework for languag learning materials ...Sandy Millin
http://sandymillin.wordpress.com/iateflwebinar2024
Published classroom materials form the basis of syllabuses, drive teacher professional development, and have a potentially huge influence on learners, teachers and education systems. All teachers also create their own materials, whether a few sentences on a blackboard, a highly-structured fully-realised online course, or anything in between. Despite this, the knowledge and skills needed to create effective language learning materials are rarely part of teacher training, and are mostly learnt by trial and error.
Knowledge and skills frameworks, generally called competency frameworks, for ELT teachers, trainers and managers have existed for a few years now. However, until I created one for my MA dissertation, there wasn’t one drawing together what we need to know and do to be able to effectively produce language learning materials.
This webinar will introduce you to my framework, highlighting the key competencies I identified from my research. It will also show how anybody involved in language teaching (any language, not just English!), teacher training, managing schools or developing language learning materials can benefit from using the framework.
A review of the growth of the Israel Genealogy Research Association Database Collection for the last 12 months. Our collection is now passed the 3 million mark and still growing. See which archives have contributed the most. See the different types of records we have, and which years have had records added. You can also see what we have for the future.
it describes the bony anatomy including the femoral head , acetabulum, labrum . also discusses the capsule , ligaments . muscle that act on the hip joint and the range of motion are outlined. factors affecting hip joint stability and weight transmission through the joint are summarized.
Thinking of getting a dog? Be aware that breeds like Pit Bulls, Rottweilers, and German Shepherds can be loyal and dangerous. Proper training and socialization are crucial to preventing aggressive behaviors. Ensure safety by understanding their needs and always supervising interactions. Stay safe, and enjoy your furry friends!
Delivering Micro-Credentials in Technical and Vocational Education and TrainingAG2 Design
Explore how micro-credentials are transforming Technical and Vocational Education and Training (TVET) with this comprehensive slide deck. Discover what micro-credentials are, their importance in TVET, the advantages they offer, and the insights from industry experts. Additionally, learn about the top software applications available for creating and managing micro-credentials. This presentation also includes valuable resources and a discussion on the future of these specialised certifications.
For more detailed information on delivering micro-credentials in TVET, visit this https://tvettrainer.com/delivering-micro-credentials-in-tvet/
2. 1(c) Rewrite the following program after
removing the syntactical error(s), if any.
Underline each correction.
Delhi 2006
2
#include<iostream.h>
void main( )
{ struct STUDENT
{ char stu_name[20];
char stu_sex;
int stu_age=17;
} student;
gets(stu_name);
gets(stu_sex);}
3. (c) Corrected Program: Delhi 2006
#include<iostream.h>
#include<stdio.h> // Error 1
void main()
{ struct STUDENT
{ char stu_name[20];
char stu_sex;
int stu_age; //Error 2
} student;
gets(student.stu_name); //Error 3
cin>>student.stu_sex; //Error 4
student.stu_age = 17; //Ignored
}
( ½ mark each for removing four errors)OR
(1 Mark to be given for only identification of all the errors without
rectification)
Note: If student replaces gets by cin>> or cin.getline( )and does not
mention <stdio.h> then full marks to be given if other errors are corrected.
4. (c) Rewrite the following program after
removing the syntactical error(s), if any.
Underline each correction. OD 2006 2
#include <idstream.h>
void main()
{ struct movie
{ char movie_name[20];
char movie_type;
int ticket_cost = 100
}MOVIE;
gets(movie_name);
gets(movie_type);
}
5. (c) #include<iostream.h>
#include<stdio.h> // Error 1 - needed for gets()
void main()
{
struct movie
{
char movie_name[20];
char movie_type;
int ticket_cost = 100; //Error 2 - assignment not
//possible inside structure definition
}MOVIE;
gets(MOVIE.movie_name);//Error 3 -members must be
//accessed using object
cin>>MOVIE.movie_type; //Error 4 -cant use gets for
//char variable and member must
//be accessed using object.
}
6. #include<iostream.h>
void main()
{
struct movie
{
char movie_name[20];
char movie_type;
int ticket_cost = 100; //Error 1 – initialization‘ not
//possible inside structure definition
}MOVIE;
cin.getline(MOVIE.movie_name,20);//Error 2 -members must be accessed
using object
cin>>MOVIE.movie_type; //Error 3 -cant use gets for
//char variable and member must
//be accessed using object.
}
(1 mark for identifying and correcting any one Error)
(1 ½ mark for identifying and correcting any two errors)
(2 marks for identifying and correcting more than two errors)
OR
(1 mark for only identifying all errors)
7. (c) Rewrite the following program after
removing the syntactical error(s), if any.
Underline each correction. Delhi 2007 2
#include <iostream.h>
const int Size 5;
void main()
{
int Array[Size];
Array = {50,40,30,20,10};
for(Ctr=0; Ctr<Size; Ctr++)
cout>>Array[Ctr];
}
8. (c) #include<iostream.h> Delhi 2007
const int Size =5;
void main( )
{
int Array[Size]={50,40,30,20,10};
for(int Ctr=0;Ctr<Size;Ctr++)
cout<<Array[Ctr];
}
(½ Mark for each correction)
OR
(1 Mark for identifying at least three errors,
without suggesting
correction)
9. (c) Rewrite the following program after
removing the syntactical error(s) if any.
Underline each correction. OD 2007 2
# include <iostream.h>
const int Max 10;
void main ( )
{
int Numbers [Max];
Numbers = { 20, 50,10, 30,40 } ;
for (Loc= Max-1 ; Loc > = 0 ; Loc - -)
cout>>Numbers [Loc];
}
10. (c) #include<iostream.h> OD 2007
const int Max = 10; //OR const int Max = 5;
void main()
{
int Numbers[Max]= {20,50,10,30,40};
// OR int Numbers[]= {20,50,10,30,40};
int Loc;
for(Loc=Max-1; Loc>=0; Loc—)
cout<<Numbers[Loc];
}
(½ Marks for each correction)
OR
(1 Mark for identifying at least three errors, without
suggesting
correction)
11. (c) Rewrite the following program after removing the
syntactical error(s) if any. Underline each correction.
Delhi 2008 2
#include < iostream.h >
void main ( )
{
First = 10, Second = 20;
Jumpto (First; Second);
Jumpto (Second);
}
void Jumpto (int N1, int N2=20)
{
N1 = N1 + N2;
cout<<N1>>N2;
}
12. #include <iostream.h>
void Jumpto(int N1, int N2=20); // Error 1
void main( )
{
int First = 10, Second = 20; // Error 2
Jumpto(First, Second); // Error 3
Jumpto(Second) ;
}
void Jumpto(int N1, int N2=20)
{
N1 = N1 + N2;
cout<<N1<<N2; // Error 4
}
13. OR
#include <iostream.h>
void Jumpto(int N1, int N2=20) // Error 1
{
N1 = N1 + N2;
cout<<N1<< N2; // Error 2
}
void main ( )
{
int First = 10, Second = 20; // Error 3
Jumpto(First, Second); // Error 4
Jumpto (Second) ;
}
(½ Mark for each correction)
OR
(1 Mark for identifying at least three errors, without suggesting
correction)
14. (c) Rewrite the following program after removing the syntax
error(s), if any. Underline each correction. OD 2008 2
#include <iostream.h>
void main ( )
{
One = 10, Two = 20;
Callme (One;Two) ;
Callme (Two) ;
}
void Callme (int Arg1, int Arg2=20)
{
319
Arg1 = Arg1 + Arg2;
cout<<Arg1>> Arg2;
}
15. #include <iostream.h> OD 2008
void Callme (int,int Arg2=20); //Error 1
void main ()
{
int One=10,Two=20; //Error 2
Callme(One,Two); //Error 3
Callme (Two);
}
void Callme (int Argl, int Arg2=20)
{
Argl=Argl +Arg2 ;
cout<<Argl<<Arg2; //Error 4
}
(½ Mark for each correction)
OR
(1 Mark for only identifying at least three errors, without suggesting
correction)
16. (c) Rewrite the following program after removing the
syntactical errors (if any). Underline each correction.
Delhi 2009 2
#include [iostream.h]
#include [stdio.h]
class Employee
{
int EmpId = 901;
char EName [20] ;
public
Employee ( ) { }
void Joining () {cin>>EmpId; gets (EName);}
void List ( ) {cout<<EmpId<<“ : ”<<EName<<endl;}
} ;
contd…
17. void main ( )
{
Employee E ;
Joining.E ( ) ;
E. List ( )
}
18. Ans Delhi 2009
#include <iostream.h>
#include <stdio.h>
class Employee
{ int EmpId;
char EName[20];
public :
Employee() {EmpId=901;}
void Joining() {cin>>EmpId; gets (EName);}
void List () {cout<<EmpId<<”:
“<<EName<<endl;}
};
19. void main ()
{ Employee E;
E.Joining ();
E.List ();
}
(½ Mark for writing both header files inside < >)
(½ Mark for removing = 901 from int Empld = 901;)
(½ Mark for writing: after public and; after E.List())
(½ Mark for writing E.Joining ( ); correctly)
Note: ½ mark for identifying any two errors without
valid correction and 1
mark for identifying all five errors without valid
correction
20. (c) Rewrite the following program after removing the
syntactical errors (if any).Underline each correction.
Outside Delhi 2009 2
include <iostream.h>
include <stdio.h>
class MyStudent
{
int StudentId = 1001;
char Name [20] ;
public
MyStudent( ){ }
void Register ( ) {cin>>StudentId; gets (Name) ;}
void Display ( ) {cout<<StudentId<< “:” <<Name<<end1;}
} ;
contd...
21. void main ( )
{
MyStudent MS ;
Register.MS( ) ;
MS.Display( ) ;
}
22. Ans Outside Delhi 2009
# include <iostream.h>
# include <stdio.h>
class MyStudent
{ int StudentId;
char Name[20];
public :
MyStudent() {StudentId = 1001;}
void Register(){ cin>>StudentId; gets (Name);}
void Display ()
{cout«StudentId<<”:“<<Name<<endl;}
};
23. void main ()
{
MyStudent MS;
MS. Register ();
MS. Display () ;
}
(½ Mark for writing both include as #include)
(½ Mark for removing = 1001 from int StudentId =
1001;)
(½ Mark for writing: after public)
(½ Mark for writing MS. Register ( ) ; correctly)
Note: ½ mark for identifying any two errors without
valid correction and
1 mark for identifying all five errors without valid
correction
24. (c) Rewrite the following c++ program code after
removing the syntax error(s) (if any). Underline
each correction. Delhi 2010 2
include <iostream.h>
class TRAIN
{
long TrainNo;
char Description[25];
public
void Entry ( )
{
cin >>TrainNo; gets(Description);
}
27. void Display ()
{
cout<<TrainNo<<“:”<<Description<<end1;
}
};
void main ()
{
TRAIN T;
T.Entry(); T.Display();
}
(½ Mark for writing # before include<iostream.h>
(½ Mark for writing # include <stdio.h>
(½ Mark for writing: after public)
(½ Mark for writing T.Entry(); and T.Display(); correctly)
28. (c) Rewrite the following C++ program code
after removing the syntax error(s) (if any).
Underline each correction. OD 2010 2
include <iostream.h>
class FLIGHT
{
long FlightCode;
char Description[25];
public
void AddInfo()
{
cin>>FlightCode; gets (Description) ;
{
30. Ans. #include <iostream.h> / / Error 1
#include <stdio.h> / / Error 2
class FLIGHT
{
long FlightCode;
char Description[25];
public : / / Error 3
void AddInfo ( )
{
cin>>FlightCode; gets (Description) ;
}
correction)
31. void ShowInfo ( )
{
cout<<FlightCode<<”:”<<Description<<endl;
}
} ;
void main ( )
{
FLIGHT F;
F.AddInfo( ) ; F. ShowInfo ( ) ; / / Error 4
}
(½ Mark for each correction)
OR
(1 mark for identifying at least three errors, without
suggesting
32. (c) Rewrite the following program after
removing the syntactical errors (if any).
Underline each correction. Delhi 2011
2
#include[iostream.h]
typedef char Text(80) ;
void main ( )
{
Text T= "Indian";
int Count=strlen(T) ;
cout<<T<<'has'<<Count<< 'characters'
<<end1;
}
33. Ans #include<iostream.h>
#include<string.h>
typedef char Text [80];
void main ( )
{
Text T= "Indian";
int Count=str1en(T);
cout<<T<< "has" <<Count<<
"cbaracters"<<end1 ;
}
(½ Mark for writing # include<iostream.h>
(½ Mark for writing # include<string.h>
(½ Mark for writing typedef char Text(80];
(½ Mark for writing "has" and "characters")
34. (c) Rewrite the following program after
removing the syntactical errors (if any).
Underline each correction. OD 2011 2
include<iostream.h>
typedef char [80] String;
void main ( )
{
String S= "Peace";
int L=strlen(S) ;
cout<<S<< 'has'<<L<< 'characters'<<end1;
}
35. Ans #include<string.h>
#include<iostream.h>
typedef char String [80];
void main ( )
{
String S = "Peace";
int L= strlen(S) ;
cout<<S<< "has" << L <<
"characters"<<end1;
}
(½ Mark for writing # include<string.h>
(½ Mark for adding # before include<iostream.h>
(½ Mark for writing typedef char string[80];)
(½ Mark for writing "has" and "characters")
36. SAMPLE PAPER 2009 SET I
c) Rewrite the following program after
removing the syntactical errors (if any).
Underline each correction. 2
#include [iostream.h]
class PAYITNOW
{
int Charge;
PUBLIC:
void Raise(){cin>>Charge;}
void Show{cout<<Charge;}
};
CONTD…
37. SAMPLE PAPER 2009 SET I
void main()
{
PAYITNOW P;
P.Raise();
Show();
}
38. SAMPLE PAPER 2009 SET I
Answer:
#include <iostream.h>
class PAYITNOW
{
int Charge;
public:
void Raise(){cin>>Charge;}
void Show(){cout<<Charge;}
};
CONTD…
39. SAMPLE PAPER 2009 SET I
Answer:
void main()
{
PAYITNOW P;
P.Raise();
P.Show();
}
(1/2 Mark for correcting each error)
OR
(1 Mark for identifying all the 4 errors with no
correction)
40. SAMPLE PAPER 2009 SET II
c) Rewrite the following program after
removing the syntactical errors (if
any). Underline each correction.
2
#include <iostream.h>
struct Pixels
{ int Color,Style;}
void ShowPoint(Pixels P)
{ cout<<P.Color,P.Style<<endl;}
CONTD…
41. SAMPLE PAPER 2009 SET II
void main()
{
Pixels Point1=(5,3);
ShowPoint(Point1);
Pixels Point2=Point1;
Color.Point1+=2;
ShowPoint(Point2);
}
42. SAMPLE PAPER 2009 SET II
#include <iostream.h>
struct Pixels
{ int Color,Style;};
void ShowPoint(Pixels P)
{ cout<<P.Color<<P.Style<<endl;}
void main()
{
Pixels Point1={5,3};
ShowPoint(Point1);
Pixels Point2=Point1;
CONTD…
43. SAMPLE PAPER 2009 SET II
Point1.Color+=2;
ShowPoint(Point2);
}
(1/2 Mark for correcting each error)
OR
(1 Mark for identifying all the 4 errors with no
correction)
44. (c) Rewrite the following program after
removing the syntactical errors (if any).
Underline each correction. SP 2010 2
#include [iostream.h]
class MEMBER
{
int Mno;float Fees;
PUBLIC:
void Register(){cin>>Mno>>Fees;}
void Display{cout<<Mno<<" : "<<Fees<<endl;}
}; CONTD…..
SAMPLE PAPER 2010 SET I
45. SAMPLE PAPER 2010 SET I
void main()
{
MEMBER M;
Register();
M.Display();
}
46. SAMPLE PAPER 2010 SET I
(c)
#include <iostream.h>
class MEMBER
{
int Mno;float Fees;
public:
void Register(){cin>>Mno>>Fees;}
void Display()
{cout<<Mno<<":"<<Fees<<endl;}
};
CONTD….
47. SAMPLE PAPER 2010 SET I
main()
{
MEMBER M;
M.Register();
M.Display();
}
( ½ Mark each correction)
48. SAMPLE PAPER 2010 SET II
(c) Rewrite the following program after
removing the syntactical errors (if any).
Underline each correction. SP 2010 2
#include <iostream.h>
struct Pixels
{ int Color,Style;}
void ShowPoint(Pixels P)
{ cout<<P.Color,P.Style<<endl;}
CONTD….
49. SAMPLE PAPER 2010 SET II
void main()
{
Pixels Point1=(5,3);
ShowPoint(Point1);
Pixels Point2=Point1;
Color.Point1+=2;
ShowPoint(Point2);
}
50. SAMPLE PAPER 2010 SET II
(c) #include <iostream.h> 2
struct Pixels
{
int Color,Style;
};
void ShowPoint(Pixels P)
{
cout<<P.Color<<P.Style<<endl;
}
Contd…
51. SAMPLE PAPER 2010 SET II
void main()
{
Pixels Point1={5,3};
ShowPoint(Point1);
Pixels Point2=Point1;
Point1.Color+=2;
ShowPoint(Point2);
}
( ½ Mark for each correction)