{"id":25497,"date":"2022-01-17T19:49:07","date_gmt":"2022-01-17T14:19:07","guid":{"rendered":"https:\/\/infinitylearn.com\/surge\/?p=25497"},"modified":"2022-01-18T11:22:11","modified_gmt":"2022-01-18T05:52:11","slug":"important-questions-for-class-12-computer-science-c-classes-and-objects","status":"publish","type":"post","link":"https:\/\/infinitylearn.com\/surge\/study-materials\/important-questions\/class-12-computer-science\/c-classes-and-objects\/","title":{"rendered":"Important Questions for Class 12 Computer Science (C++) \u2013 Classes and Objects"},"content":{"rendered":"<p style=\"text-align: center\"><span style=\"color: #0000ff\"><strong>Previous years Examination Questions<\/strong><\/span><br \/>\n<span style=\"color: #0000ff\"><strong>2 Marks Questions<\/strong><\/span><\/p>\n<p><span style=\"color: #eb4924\"><strong>Question 1:<br \/>\n<\/strong><\/span>What is the relationship between a class and an object? Illustrate with a suitable example. <strong>Delhi 2013C<\/strong><br \/>\n<span style=\"color: #eb4924\"><strong><span style=\"color: #008000\">\u0410nswers:<br \/>\n<\/span><\/strong><\/span>Class<br \/>\n\u2022 It is a user-defined data type.<br \/>\n\u2022 It is a logical framework that combines data and function into a single unit.<br \/>\ne.g<\/p>\n<pre>class GABS \r\n{\r\nint a,b; \r\npublic:\r\nvoid set() \r\n{\r\na=10; \r\nb=20;\r\n}\r\nvoid show()\r\n{\r\ncout&lt;&lt;\"Value of a and b is\"&lt;&lt;a&lt;&lt;b&lt;&lt;endl;\r\n};<\/pre>\n<p>Object<br \/>\n\u2022 It is an instance of a class.<br \/>\n\u2022 It is a physical entity that means it occupies space in a memory. It\u2019s used to access members of the class.<br \/>\ne.g. Suppose \u201cGABS\u201d is the name of the class.<br \/>\nGABS G1, G2;<br \/>\nG1.show( );<br \/>\nBoth G1 and G2 are the objects of the class \u201cGABS\u201d<\/p>\n<p><span style=\"color: #eb4924\"><strong>Question 2:<br \/>\n<\/strong><\/span>Rewrite the following program after removing the syntactical errors (if any). Underline each correction. <strong>Delhi 2012<\/strong><\/p>\n<pre>#include&lt;iostream.h&gt; \r\nclass Book \r\n{\r\nlong Bld.Qty; \r\npublic:\r\nvoid Purchase()\r\n{\r\ncin&gt;&gt;BId&lt;&lt;Qty;\r\n}\r\nvoid Sale \r\n{\r\ncout&lt;&lt;setw(5)&lt;&lt;BId&lt;&lt;\"o1d:\u201d&lt;&lt;Qty&lt;&lt;endl;\r\ncout&lt;&lt;\"New:\"&lt;&lt;\u2014Qty&lt;&lt;endl;\r\n}\r\n};\r\nvoid main()\r\n{\r\nBook B;\r\nB.Purchase();\r\nSale();\r\nB.Sale();\r\n}<\/pre>\n<p><span style=\"color: #eb4924\"><strong><span style=\"color: #008000\">\u0410nswers:<\/span><\/strong><\/span><\/p>\n<pre>#include&lt;iostream.h&gt;\r\n#include&lt;iomanip.h&gt; \r\nclass Book\r\n{\r\nlong Bid, Qty; \r\npub!ic:\r\nvoid Purchase()\r\n{\r\ncin&gt;&gt;BId&gt;&gt;Qty;\r\n}\r\nvoid Sale()\r\n{\r\ncout&lt;&lt;setw(5)&lt;&lt;BId&lt;&lt;\"o1d:\"&lt;&lt;Qty&lt;&lt;endl; \r\ncout&lt;&lt;\"New:\"&lt;&lt;--Qty&lt;&lt;endl;\r\n}\r\n};\r\nvoid main()\r\n{\r\nBook B;\r\nB.Purchase();\r\nB.Sale(); \r\nB.Sale();\r\n}<\/pre>\n<p><span style=\"color: #eb4924\"><strong>Question 3:<br \/>\n<\/strong><\/span>Rewrite the following program after removing the syntactical errors (if any). Underline each correction. <strong>Delhi 2012<\/strong><\/p>\n<pre>#include&lt;iostream.h&gt; \r\nclass Item \r\n{\r\nlong IId, Qty; \r\npublic:\r\nvoid Purchase \r\n{\r\ncin&gt;&gt;IId&gt;&gt;Qty;\r\n}\r\nvoid Sale()\r\n{\r\ncout&lt;&lt;setw(5)&lt;&lt;IId&lt;&lt;\u201dold:\"&lt;&lt;Qty&lt;&lt;endl;\r\ncout&lt;&lt;\"New: \"&lt;&lt;--Qty&lt;&lt;endl;\r\n}\r\n};\r\nvoid main()\r\n{\r\nItem I;\r\nPurchase():\r\nI.Sale();\r\nI.Sale();\r\n}<\/pre>\n<p><span style=\"color: #eb4924\"><strong><span style=\"color: #008000\">\u0410nswers:<\/span><\/strong><\/span><\/p>\n<pre>#include&lt;iostream.h&gt; \r\n#include&lt;iomanip.h&gt; \r\nclass Item\r\n{\r\nlong lid,Qty; \r\npublic:\r\nvoid Purchase()\r\n{\r\ncin&gt;&gt;IId&gt;&gt;Qty;\r\n}\r\nvoid Sale()\r\n{\r\ncout&lt;&lt;setw(5)&lt;&lt;IId&lt;&lt;\"01d:\"&lt;&lt;Qty&lt;&lt;endl;\r\ncout&lt;&lt;\"New:\"&lt;&lt;--Qty&lt;&lt;endl;\r\n}\r\n};\r\nvoid main()\r\n{\r\nItem I;\r\nI.Purchase();\r\nI.Sale();\r\nI.Sale();\r\n}<\/pre>\n<p><span style=\"color: #eb4924\"><strong>Question 4:<br \/>\n<\/strong><\/span>Rewrite the following program after removing the syntactical error(s) (if any). Underline each correction. <strong>Delhi 2012C<\/strong><\/p>\n<pre>#include&lt;iostream.h&gt;\r\n#include&lt;stdio.h&gt;\r\nClass OFFER \r\n{\r\nint OfferId; \r\nchar Description[80]: \r\nvoid Show \r\n{\r\ncout&lt;&lt;offerId&lt;&lt;\" : \u201d&lt;&lt;Description&lt;&lt;endl;\r\n}\r\npublic:\r\nvoid Enter \r\n{\r\ncin&gt;&gt;offerId; \r\ngets&gt;&gt;Description;\r\n}\r\n};\r\nvoid main()\r\n{\r\nOFFER Obj;\r\nObj.Enter();\r\nObj.Show();\r\n}<\/pre>\n<p><span style=\"color: #eb4924\"><strong><span style=\"color: #008000\">\u0410nswers:<\/span><\/strong><\/span><\/p>\n<pre>#include&lt;iostream.h&gt; \r\n#include&lt;stdio.h&gt; \r\nclass OFFER\r\n{\r\nint OfferId; \r\nchar Description[80]; \r\nvoid Show()\r\n{\r\ncout&lt;&lt;offerld&lt;&lt;\":\"&lt;&lt;Description&lt;&lt;endl; \r\n}\r\npublic:\r\nvoid Enter()\r\n{ \r\ncin&gt;&gt;offerId; \r\ngets(Description):\r\n}\r\n};\r\nvoid main()\r\n{\r\nOFFER Obj;\r\nObj.Enter();\r\n\/\/Obi.Show();\r\n\/\/Show()cannot be called because\r\n\/\/it is a private member\r\n}<\/pre>\n<p><span style=\"color: #eb4924\"><strong>Question 5:<br \/>\n<\/strong><\/span>What is the difference between members in private visibility mode and the members in public visibility mode inside a class? Also give a suitable C++ code to illustrate both. <strong>Delhi 2012<\/strong><br \/>\nor<br \/>\nDifferentiate between public and private visibility modes in context of object oriented programming using a suitable example. <strong>Delhi 2011<br \/>\n<span style=\"color: #eb4924\"><span style=\"color: #008000\">\u0410nswers:<br \/>\n<\/span><\/span><\/strong>A member declared as private remains hidden from outside world and it can only be accessed by the member function of the class in which it is declared. A member declared as public is made available to the outside world. That is , it can be accessed by any function, any expression in the program but only by using an object of the same class type.<br \/>\ne.g-<\/p>\n<pre>class A \r\n{\r\nprivate:\r\nint x;\r\nvoid show(); \r\npublic: \r\nint y;\r\nvoid get();\r\n};<\/pre>\n<p>The members x and show( ) are private and these are not accessible outside the class where the members y and get( ) are public so these are accessible outside the class.<\/p>\n<p><span style=\"color: #eb4924\"><strong>Question 6:<br \/>\n<\/strong><\/span>When is public visibility of a mode applied to members of a class? Also give an example to illustrate. <strong>Delhi 2011C<br \/>\n<span style=\"color: #eb4924\"><span style=\"color: #008000\">\u0410nswers:<br \/>\n<\/span><\/span><\/strong>When we need to access the members from out side the class then we apply public mode preceding any members.<br \/>\ne.g.<\/p>\n<pre>#include&lt;iostream.h&gt; \r\nclass ABC \r\n{\r\npublic: \r\nint b; \r\nvoid show()\r\n{\r\ncout&lt;&lt;\"b =\"&lt;&lt;b;\r\n}\r\n};\r\nvoid main()\r\n{\r\nABC x; \r\nx.b=20; \r\nx.show();\r\n}<\/pre>\n<p><span style=\"color: #eb4924\"><strong>Question 7:<br \/>\n<\/strong><\/span>Rewrite the following C++ program code after removing the syntax error(s) (if any). Underline each correction.<br \/>\n<strong>All India 2010<\/strong><\/p>\n<pre>include&lt;iostream.h&gt;\r\nclass FLIGHT \r\n{\r\nlong FlightCode;\r\nchar Description[25]; \r\npublic\r\nvoid Addlnfo()\r\n{\r\ncin&gt;&gt;FlightCode; \r\ngets(Description);\r\n}\r\nvoid ShowInfo()\r\n{\r\ncout&lt;&lt;FlightCode\u00ab\":\" &lt;&lt;Description&lt;&lt;endl;\r\n}\r\n};\r\nvoid main()\r\n{\r\nFLIGHT F;\r\nAddlnfo.F();\r\nShowlnfo.F();\r\n}<\/pre>\n<p><span style=\"color: #eb4924\"><strong><span style=\"color: #008000\">\u0410nswers:<\/span><\/strong><\/span><\/p>\n<pre># include&lt;iostream.h&gt;\r\n#include&lt;stdio.h&gt;\r\nclass FLIGHT \r\n{\r\nlong FlightCode; \r\nchar Description[25]; \r\npublic:\r\nvoid Addlnfo()\r\n{\r\ncin&gt;&gt;FlightCode; \r\ngets(Description);\r\n}\r\nvoid Showlnfo()\r\n(\r\ncout&lt;&lt;FlightCode&lt;&lt;\":\"&lt;&lt;Description&lt;&lt;endl;\r\n}\r\n};\r\nvoid main()\r\n{\r\nFLIGHT F;\r\nF.Addlnfo();\r\nF.ShowInfo();\r\n}<\/pre>\n<p><span style=\"color: #eb4924\"><strong>Question 8:<br \/>\n<\/strong><\/span>Rewrite the following C++ program code after removing the syntax error(s) (if any). Underline each correction.<br \/>\n<strong>Delhi 2010<\/strong><\/p>\n<pre>#include&lt;iostream.h&gt; \r\nclass TRAIN \r\n{\r\nlong TrainNo;\r\nchar Description[25];\r\npublic\r\nvoid Entry()\r\n{\r\ncin&gt;&gt;TrainNo; \r\ngets(Description);\r\n}\r\nvoid Display()\r\n{\r\ncout&lt;&lt;TrainNo&lt;&lt;\":\"&lt;&lt;Description&lt;&lt;endl;\r\n}\r\n};\r\nvoid main( )\r\n{\r\nTRAIN T;\r\nEntry. T();\r\nDisplay.T();\r\n}<\/pre>\n<p><span style=\"color: #eb4924\"><strong><span style=\"color: #008000\">\u0410nswers:<\/span><\/strong><\/span><\/p>\n<pre>#include&lt;iostream.h&gt; \r\n#include&lt;stdio.h&gt; \r\nclass TRAIN \r\n{\r\nlong TrainNo;\r\nchar Description[25];\r\npublic:\r\nvoid Entry()\r\n{\r\ncin&gt;&gt;TrainNo;\r\ngets(Description);\r\n}\r\nvoid Display()\r\n{\r\ncout&lt;&lt;TrainNo&lt;&lt;\" : \"&lt;&lt;Description&lt;&lt;endl;\r\n}\r\n};\r\nvoid main()\r\n{\r\nTRAIN T;\r\nT.Entry();\r\nT.Display();\r\n}<\/pre>\n<p><span style=\"color: #eb4924\"><strong>Question 9:<br \/>\n<\/strong><\/span>Rewrite the following program after removing the syntactical error(s) (if any) Underline each correction. <strong>Delhi 2009C<\/strong><\/p>\n<pre>#include&lt;iostream.h&gt;\r\nclass Transport \r\n{\r\nchar Model[20]; \r\nchar Name[20]; \r\nvoid Get()\r\n{\r\ngets(Model); \r\ngets(Name);\r\n}\r\nvoid Show()\r\n{\r\ncout&lt;&lt;Model&lt;&lt;endl; \r\nputs(Name);\r\n}\r\n};\r\nvoid main( )\r\n{\r\nTransport T;\r\nT.Get();\r\nShow();\r\n}<\/pre>\n<p><span style=\"color: #eb4924\"><strong><span style=\"color: #008000\">\u0410nswers:<\/span><\/strong><\/span><\/p>\n<pre>#include&lt;iostream.h&gt; \r\n#include&lt;stdio.h&gt; \r\nclass Transport \r\n{\r\nchar Model[20]; \r\nchar Name[20]; \r\npublic: \r\nvoid Get() \r\n{\r\ngets(Model); \r\ngets(Name);\r\n}\r\nvoid Show() \r\n{\r\ncout&lt;&lt;Model&lt;&lt;endl; \r\nputs(Name);\r\n}\r\n};\r\nvoid main()\r\n{\r\nTransport T:\r\nT.Get();\r\nT.Show();\r\n}<\/pre>\n<p style=\"text-align: center\"><span style=\"color: #0000ff\"><strong>4-5 Marks Questions<\/strong><\/span><\/p>\n<p><span style=\"color: #eb4924\"><strong>Question 10:<br \/>\n<\/strong><\/span>Write the definition of a class BOX in C++ with the following description: All India 2017<br \/>\n<img loading=\"lazy\" src=\"https:\/\/infinitylearn.com\/surge\/wp-content\/uploads\/2021\/12\/24375193947_b612fb57da_o.png\" alt=\"important-questions-for-class-12-computer-science-c-classes-and-objects-(160-1)\" width=\"737\" height=\"240\" \/><br \/>\n<span style=\"color: #eb4924\"><strong><span style=\"color: #008000\">\u0410nswer:<\/span><\/strong><\/span><\/p>\n<pre>class Box \r\n{\r\nint BoxNumber; \r\nfloat Side, Area; \r\nvoid ExecArea()\r\n{\r\nArea = Side*Side;\r\n}\r\npublic:\r\nvoid GetBox()\r\n{\r\ncout&lt;&lt;\"Enter the values of BoxNumber and Side\u201d; \r\ncin&gt;&gt;BoxNumber; \r\ncin&gt;&gt;Side;\r\nExecArea(); \r\n}\r\nvoid ShowBox()\r\n{\r\ncout&lt;&lt;\"BoxNumber:\"&lt;&lt;BoxNumber&lt;&lt;endl; \r\ncout&lt;&lt;\u201dSide:\"&lt;&lt;Side&lt;&lt;endl: \r\ncout&lt;&lt;\u201dArea:\"&lt;&lt;Area;\r\n}<\/pre>\n<p><span style=\"color: #eb4924\"><strong>Question 11:<br \/>\n<\/strong><\/span>Write the definition of a class METROPOLIS in C++ with following description: Delhi 2016<br \/>\n<img loading=\"lazy\" src=\"https:\/\/infinitylearn.com\/surge\/wp-content\/uploads\/2021\/12\/25371271028_20d247dcb8_o.png\" alt=\"important-questions-for-class-12-computer-science-c-classes-and-objects-(160-2)\" width=\"627\" height=\"341\" \/><br \/>\n<span style=\"color: #eb4924\"><strong><span style=\"color: #008000\">\u0410nswer:<\/span><\/strong><\/span><\/p>\n<pre>class METROPOLIS \r\n{\r\nint MCode; \r\nchar MName[20]; \r\nlong int MPop; \r\nfloat Area, PopDens; \r\nvoid CalDen()\r\n{\r\nPopDens = MPop\/Area;\r\n}\r\npublic:\r\nvoid Enter()\r\n{\r\ncout&lt;&lt;\"\\nEnter the code\";\r\ncin&gt;&gt;MCode;\r\ncout&lt;&lt;\"\\nEnter the name\"; \r\ngets(MName);\r\ncout&lt;&lt;\"\\n Enter the population\"; \r\ncin&gt;&gt;MPop;\r\ncout&lt;&lt;\"\\n Enter the area coverage\";\r\ncin&gt;&gt;Area;\r\nCalDen();\r\n}\r\nvoid ViewALL() \r\n{\r\ncout&lt;&lt;\"\\nCode: \"&lt;&lt;MCode; \r\ncout&lt;&lt;\"\\nName: \"&lt;MName; \r\ncout&lt;&lt;\"\\nPopulation:\"&lt;&lt;MPop; \r\ncout&lt;&lt;\"\\nArea Coverage : \"&lt;&lt;Area ; \r\ncout&lt;&lt;\"\\nPopulation Density :\"&lt;&lt;PopDens; \r\nif(PopDens&gt;12000)cout&lt;&lt;\"Highly Populated Area\";\r\n}\r\n};<\/pre>\n<p><span style=\"color: #eb4924\"><strong>Question 12:<br \/>\n<\/strong><\/span>Write the definition of a class CITY in C++ with following description: All India 2016<br \/>\n<img loading=\"lazy\" src=\"https:\/\/infinitylearn.com\/surge\/wp-content\/uploads\/2021\/12\/24375193487_7c55bfafb2_o.png\" alt=\"important-questions-for-class-12-computer-science-c-classes-and-objects-(160-3)\" width=\"669\" height=\"321\" \/><br \/>\n<span style=\"color: #eb4924\"><strong><span style=\"color: #008000\">\u0410nswer:<\/span><\/strong><\/span><\/p>\n<pre>class CITY \r\n{\r\nint Ccode;\r\nchar CName[20];\r\nlong int Pop; \r\nfloat KM, Density; \r\nvoid DenCal()\r\n{\r\nDensity = Pop\/KM;\r\n}\r\npublic :\r\nvoid Record()\r\n{\r\ncout&lt;&lt;\"\\nEnter the city code\"\r\ncin&lt;&lt;Ccode;\r\ncout&lt;&lt;\"\\nEnter the city name\"\r\ngets(CName);\r\ncout&lt;&lt;\"\\nEnter city\u2019s population\"\r\ncin&gt;&gt;Pop;\r\ncout&lt;&lt;\"\\nEnter the Area coverage by city\";\r\ncin&gt;&gt;KM;\r\nDenCal ();\r\n}\r\nvoid View()\r\n{\r\ncout&lt;&lt;\"\\nCity code:\"&lt;&lt;Ccode; \r\ncout&lt;&lt;\"\\nCity name:\"&lt;&lt;CName; \r\ncout&lt;&lt;\"\\nPopul at ion:\"&lt;&lt;Pop; \r\ncout&lt;&lt;\"\\nArea coverage:\"&lt;&lt;KM;\r\ncout&lt;&lt;\"\\nPopul ation density:\"&lt;&lt;Density; \r\nif(Density&gt;10000) \r\ncout&lt;&lt;\"Highly Populated City\"; \r\n}\r\n};<\/pre>\n<p><span style=\"color: #eb4924\"><strong>Question 13:<br \/>\n<\/strong><\/span>Write the definition of a class PIC in C++ with following description Delhi 2015<br \/>\n<img loading=\"lazy\" src=\"https:\/\/infinitylearn.com\/surge\/wp-content\/uploads\/2021\/12\/24375194237_0663df07a9_o.png\" alt=\"important-questions-for-class-12-computer-science-c-classes-and-objects-(161-1)\" width=\"671\" height=\"318\" \/><\/p>\n<p><span style=\"color: #eb4924\"><strong><span style=\"color: #008000\">\u0410nswer:<\/span><\/strong><\/span><\/p>\n<pre>class PIC \r\n{\r\nint Pno;\r\nchar Category[20]; \r\nchar Location[20]; \r\nvoid FixLocation()\r\n{\r\nif(strcmp(Category,\"Antique\u201d)==0) \r\nstrcpy(Location,\"Ustad Khan\"); \r\nelse if(strcmp(Category,\"Modern\" )==0)\r\nstrcpy(Location,\"Jim Plaq\u201d); \r\nelse if(strcmp(Category,\u201dClassic\u201d)==0) \r\nstrcpy(Location,\"Amina\");\r\n}\r\npublic:\r\nvoid Enter() \r\n{\r\ncout&lt;&lt;\"\\nEnter the picture number\";\r\ncin&gt;&gt;Pno;\r\ncout&lt;&lt;\"\\nEnter the category\"; gets(Category);\r\nFixLocation(); \r\n}\r\nvoid SeeAll() \r\n{\r\ncout&lt;&lt;\"\\nPicture number:\"&lt;&lt;Pno; \r\ncout&lt;&lt;\"\\nCategory: \"&lt;&lt;Category; \r\ncout&lt;&lt;\"\\nLocation:\"&lt;&lt;Location; \r\n}\r\n};<\/pre>\n<p><span style=\"color: #eb4924\"><strong>Question 14:<br \/>\n<\/strong><\/span>Write the definition of a class Photo in C++ with following description: All Indio 2015<br \/>\n<img loading=\"lazy\" src=\"https:\/\/infinitylearn.com\/surge\/wp-content\/uploads\/2021\/12\/38361397625_9687be4025_o.png\" alt=\"important-questions-for-class-12-computer-science-c-classes-and-objects-(161-2)\" width=\"676\" height=\"327\" \/><\/p>\n<p><span style=\"color: #eb4924\"><strong><span style=\"color: #008000\">\u0410nswer:<\/span><\/strong><\/span><\/p>\n<pre>class Photo \r\n{\r\nint Pno;\r\nchar Category[20]; \r\nchar Exhibit[20]; \r\nvoid FixExhibit()\r\n{ \r\nif(strcmp(Category,\"Antique\")== 0) \r\nstrcpy(Exhibit, \"Zaveri\"); \r\nelse if(strcmp(Category,\"Modem\") == 0) \r\nstrcpy(Exhibit, \"Johnsen\"); \r\nelse if(strcmp(Category,\"Classic\") == 0) \r\nstrcpy(Exhibit, \"Terenida\u201d);\r\n}\r\npublic:\r\nvoid Register()\r\n{\r\ncout&lt;&lt;\"\\nEnter the photo number\";\r\ncin&gt;&gt;Pno;\r\ncout&lt;&lt;\"\\nEnter the category\"; \r\ngets(Category);\r\nFixExhibit();\r\n}\r\nvoid ViewAll()\r\n{\r\ncout&lt;&lt;\"\\nPhoto number :\"&lt;&lt;Pno; \r\ncout&lt;&lt;\"\\nCategory:\"&lt;&lt;Category; \r\ncout&lt;&lt;\"\\nExhibit:\u201d&lt;&lt;Exhibit;\r\n}\r\n};<\/pre>\n<p><span style=\"color: #eb4924\"><strong>Question 15:<br \/>\n<\/strong><\/span>Write the definition of a class STAFF in C++ with following description: All India 20isc<br \/>\n<img loading=\"lazy\" src=\"https:\/\/infinitylearn.com\/surge\/wp-content\/uploads\/2021\/12\/24375193847_be6f878fe7_o.png\" alt=\"important-questions-for-class-12-computer-science-c-classes-and-objects-(161-3)\" width=\"568\" height=\"299\" \/><br \/>\n<strong>Public Members<\/strong><\/p>\n<ul>\n<li>Enroll( )  \/\/A function to allow user to enter values<br \/>\n\/\/SID, Type, Name and call<br \/>\n\/\/AssignPay( ) function<\/li>\n<li>SeeData( ) \/\/A function to display all the data members<\/li>\n<\/ul>\n<p><span style=\"color: #eb4924\"><strong><span style=\"color: #008000\">\u0410nswer:<\/span><\/strong><\/span><\/p>\n<pre>class STAFF \r\n{\r\nlong int SID; \r\nchar Type; \r\nfloat Pay; \r\nchar Name[30]; \r\nvoid AssignPay()\r\n{\r\nif(Type == 'D')\r\nPay = 95000; \r\nelse if(Type == 'M')\r\nPay = 75000; \r\nelse if (Type == 'E')\r\nPay = 60000; \r\nelse if(Type == 'S')\r\nPay = 45000;\r\n}\r\npublic:\r\nvoid Enroll()\r\n{\r\ncout&lt;&lt;\u201dEnter the values of staff ID, Type, Name\"; \r\ncin&gt;&gt;SID; \r\ncin&gt;&gt;Type; \r\ngets(Name);\r\nAssignPay();\r\n}\r\nvoid seeData()\r\n{\r\ncout&lt;&lt;SID&lt;&lt;Type&lt;&lt;Name&lt;&lt;Pay;\r\n}\r\n};<\/pre>\n<p><span style=\"color: #eb4924\"><strong>Question 16:<br \/>\n<\/strong><\/span>Define a class Seminar with the following specification private members: <strong>Delhi 2013C<\/strong><br \/>\n<strong>Seminarld<\/strong> long<br \/>\n<strong>Topic<\/strong> string of 20 characters<br \/>\n<strong>VenueLocation<\/strong> string of 20 characters<br \/>\n<strong>Fee<\/strong> float<br \/>\nCalcFee( ) function to calculate Fee depending on VenueLocation<\/p>\n<table border=\"2\">\n<tbody>\n<tr>\n<td style=\"text-align: center\"><strong>Venue Location<\/strong><\/td>\n<td style=\"text-align: center\"><strong>Fee<\/strong><\/td>\n<\/tr>\n<tr>\n<td style=\"text-align: center\">Outdoor<\/td>\n<td style=\"text-align: center\">5000<\/td>\n<\/tr>\n<tr>\n<td style=\"text-align: center\">Indoor Non-AC<\/td>\n<td style=\"text-align: center\">6500<\/td>\n<\/tr>\n<tr>\n<td style=\"text-align: center\">Indoor AC<\/td>\n<td style=\"text-align: center\">7500<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p><strong>Public members<\/strong><br \/>\n<strong>Register<\/strong>( ) function to accept values for Seminarld, Topic, VenueLocation and call CalcFee( ) to calculate Fee.<br \/>\n<strong>ViewSeminarf<\/strong>( ) function to display all the data members on the screen.<\/p>\n<p><span style=\"color: #eb4924\"><strong><span style=\"color: #008000\">\u0410nswer:<\/span><\/strong><\/span><\/p>\n<pre>class Seminar \r\n{\r\nlong SeminarId;\r\nchar Topic[20]. VenueLocation[20]; \r\nfloat Fee; \r\nvoid CalcFee()\r\n{\r\nif(strcmp(VenueFocation,\"Outdoor\")==0)\r\nFee=5000;\r\nelse if(strcmp(Venuetocation,\"Indoor Non-AC\")==0) \r\nFee=6500;\r\nelse if(strcmp(VenueFocation,\"Indoor AC\")==0)\r\nFee=7500;\r\n}\r\npublic:\r\nvoid Register()\r\n{\r\ncout&lt;&lt;\"Enter Seminar Id\"; \r\ncin&gt;&gt;SeminarId; \r\ncout&lt;&lt;\"Enter Topic\"; \r\ngets(Topic);\r\ncout&lt;&lt;\"Enter Venue Location\";\r\ngets(VenueLocation);\r\nCalcFee(); \r\n}\r\nvoid ViewSeminar()\r\n{ \r\ncout&lt;&lt;\"SeminarId:\"&lt;&lt;SeminarId&lt;&lt;endl; \r\ncout&lt;&lt;\"Topic: \"&lt;&lt;Topic&lt;&lt;endl; \r\ncout&lt;&lt;\"Venue Location;\"&lt;&lt;VenueFocation&lt;&lt;endl; \r\ncout&lt;&lt;\"Fee is:\"&lt;&lt;Fee;\r\n}\r\n};<\/pre>\n<p><span style=\"color: #eb4924\"><strong>Question 17:<br \/>\n<\/strong><\/span>Define a class RESTRA in C++ with following description: <strong>Delhi 2012<\/strong><br \/>\n<strong>Private members<\/strong><\/p>\n<ul>\n<li>FoodCode of type int<\/li>\n<li>Food of type string<\/li>\n<li>FType of type string<\/li>\n<li>Sticker of type string<\/li>\n<li>A member function GetStickerf( ) to assign the following values for Food Sticker as per the given FType<\/li>\n<\/ul>\n<p><strong>FType<\/strong> <strong>Sticker<\/strong><br \/>\nVegetarian GREEN<br \/>\nContains Egg YELLOW<br \/>\nNon-Vegetarian RED<\/p>\n<p><strong>Public members<\/strong><\/p>\n<ul>\n<li>A function GetFood( ) to allow user to enter values for FoodCode, Food, FType and call function GetSticker( ) to assign Sticker.<\/li>\n<li>A function ShowFoodf( ) to allow user to view the content of all the data members.<\/li>\n<\/ul>\n<p><span style=\"color: #eb4924\"><strong><span style=\"color: #008000\">\u0410nswer:<\/span><\/strong><\/span><\/p>\n<pre>class RESTRA \r\n{\r\nint FoodCode;\r\nchar Food[30], FType[20],Sticker[20];\r\nvoid GetSticker()\r\n{\r\nif(strcmp(FType,\"Vegetarian\u201d)==0) \r\nstrcpy(Sticker,\"GREEN\"); \r\nelse if(strcmp(FType,\"Contains Egg\")==0)\r\nstrcpy(Sticker,\"YELLOW\"); \r\nelse if(strcmpCFType,\"Non-Vegetarian\")==0) \r\nstrcpy(Sticker,\"RED\u201d); \r\n}\r\npublic:\r\nvoid GetFood() \r\n{\r\ncout&lt;&lt;\"Enter FoodCode, Food, Food Type\";\r\ncin&gt;&gt;FoodCode; \r\ngets(Food); \r\ngets(FType);\r\nGetSticker();\r\n}\r\nvoid ShowFood()\r\n{ \r\ncout&lt;&lt;\"Entered values of FoodCode, Food, FoodType,Sticker\";\r\ncout&lt;&lt;FoodCode&lt;&lt;Food&lt;&lt;FType&lt;&lt;Sticker;\r\n}\r\n};<\/pre>\n<p><span style=\"color: #eb4924\"><strong>Question 18:<br \/>\n<\/strong><\/span>Define a class SUPPLY in C++ with following description: All Indio 2012<br \/>\n<strong>Private members<\/strong><\/p>\n<ul>\n<li>Code of type int<\/li>\n<li>FoodName of type string<\/li>\n<li>Sticker of type string<\/li>\n<li>FoodType of type string<\/li>\n<li>A member function GetTypef ( ) to assign the following values for FoodType as per the given Sticker<\/li>\n<\/ul>\n<p><strong>Sticker  FoodType<\/strong><br \/>\nGREEN  Vegetarian<br \/>\nYELLOW  Contains Egg<br \/>\nRED  Non-Vegetarian<br \/>\n<strong>Public members<\/strong><\/p>\n<ul>\n<li>A function FoodIn( ) to allow user to enter values for Code, FoodName, Sticker and call function GetType( ) to assign respective FoodType.<\/li>\n<li>A function FoodOut( ) to allow user to view the content of all the data members.<\/li>\n<\/ul>\n<p><span style=\"color: #eb4924\"><strong><span style=\"color: #008000\">\u0410nswer:<\/span><\/strong><\/span><\/p>\n<pre>class SUPPLY \r\n{\r\nint Code;\r\nchar FoodName[30],Sticker[30]; \r\nchar FoodType[20]; \r\nvoid GetType()\r\n{\r\nif(strcmp(Sticker, \"GREEN\u201d)==0) \r\nstrcpy(FoodType,\"Vegetarian\" ); \r\nelse if(strcmp(Sticker,\"YELLOW\")==0) \r\nstrcpy(FoodType,\"Contains Egg\"); \r\nelse if(strcmp(Sticker,\"RED\")==0) \r\nstrcpy(FoodType,\"Non -Vegeta rian\"); \r\n}\r\npublic:\r\nvoid FoodIn()\r\n{\r\ncout&lt;&lt;\"Enter Code, FoodName, Sticker\";\r\ncin&gt;&gt;Code;\r\ngets(FoodName); \r\ngets(Sticker);\r\nGetType(); \r\n}\r\nvoid Food0ut()\r\n{\r\ncout&lt;&lt;\"Code,FoodName,Sticker,FoodType are\"; \r\ncout&lt;&lt;Code&lt;&lt;FoodName&lt;&lt;Sticker&lt;&lt;FoodType;\r\n}\r\n};<\/pre>\n<p><span style=\"color: #eb4924\"><strong>Question 19:<br \/>\n<\/strong><\/span>Define a class Candidate in C++with following description: <strong>Delhi 2o11<\/strong><br \/>\n<strong>Private members<\/strong><\/p>\n<ul>\n<li>A data member RNo (Registration Number) of type long<\/li>\n<li>A data member Name of type string<\/li>\n<li>A data member Score of type float<\/li>\n<li>A data member Remarks of type string<\/li>\n<li>A member function AssignRem( ) to assign the remarks as per the score obtained by a candidate.<\/li>\n<li>Score range and the respective remarks are shown as follow:<\/li>\n<\/ul>\n<p><strong>Score Remarks<\/strong><br \/>\n&gt;=50  Selected<br \/>\nless than 50  Not Selected<br \/>\n<strong>Public members<\/strong><\/p>\n<ul>\n<li>A function ENTER( ) to .allow user to enter values for RNo, Name, .Score and call function AssignRem( ) to assign Remarks.<\/li>\n<li>A function DISPLAY( ) to allow user to view the content of all data members.<\/li>\n<\/ul>\n<p><span style=\"color: #eb4924\"><strong><span style=\"color: #008000\">\u0410nswer:<\/span><\/strong><\/span><\/p>\n<pre>class Candidate \r\n{\r\nlong RNo; \r\nchar Name[40]; \r\nfloat Score; \r\nchar Remarks[20]; \r\nvoid AssignRem()\r\n{\r\nif(Score&gt;=50)\r\nstrcpy(Remarks,\"Selected\"); \r\nelse\r\nstrcpy(Remarks,\"Not Selected\");\r\n}\r\npublic: \r\nvoid ENTER()\r\n{\r\ncout&lt;&lt;\"Enter the values for Rno,Name,Score\u201d;\r\ncin&gt;&gt;RNo; \r\ngets(Name); \r\ncin&gt;&gt;Score;\r\nAssignRem(); \r\n}\r\nvoid DISPLAY()\r\n{\r\ncout&lt;&lt;RNo&lt;&lt;Name&lt;&lt;Score&lt;&lt;Remarks; \r\n}\r\n};<\/pre>\n<p><span style=\"color: #eb4924\"><strong>Question 20:<br \/>\n<\/strong><\/span>Define a class Applicant in C++ with following description: <strong>All IndiA 2011<\/strong><br \/>\n<strong>Private members<\/strong><\/p>\n<ul>\n<li>A data member ANo (Admission Number) of type long<\/li>\n<li>A data member Name of type string<\/li>\n<li>A data member Agg (Aggregate Marks) of type float<\/li>\n<li>A data member Grade of type char<\/li>\n<li>A member function GradeMe( ) to find the grade as per the aggregate marks obtained by a student. Equivalent aggregate marks range and the respective grades are shown as follow:<\/li>\n<\/ul>\n<p><strong>Aggregate marks  Grade<\/strong><br \/>\n&gt;=80 A<br \/>\nless than 80 and &gt;=65 B<br \/>\nless than 65 and &gt;=50 C<br \/>\nless than 50 D<br \/>\n<strong>Public members<\/strong><\/p>\n<ul>\n<li>A function ENTER( ) to allow user to enter values for ANo, Name, Agg and call function GradeMe( ) to find the Grade.<\/li>\n<li>A function RESULT( ) to allow user to view the content of all data members.<\/li>\n<\/ul>\n<p><span style=\"color: #eb4924\"><strong><span style=\"color: #008000\">\u0410nswer:<\/span><\/strong><\/span><\/p>\n<pre>class Applicant\r\n{\r\nlong ANo; \r\nchar Name[40]; \r\nfloat Agg; \r\nchar Grade; \r\nvoid GradeMe()\r\n{\r\nif(Agg&gt;=80) \r\nGrade='A';\r\nelse if(Agg&lt;80 &amp;&amp; Agg&gt;=65) \r\nGrade='B';\r\nelse if(Agg&lt;65 &amp;&amp; Agg&gt;=50) \r\nGrade='C'; \r\nelse\r\nGrade='D';\r\npublic: \r\nvoid ENTER()\r\n{\r\ncout&lt;&lt;\"Enter the values for Ano.Name.Agg\"\r\ncin&gt;&gt;ANo; \r\ngets(Name); \r\ncin&gt;&gt;Agg;\r\nGradeMe();\r\n}\r\nvoid RESULT()\r\n{\r\ncout&lt;&lt;ANo&lt;&lt;Name&lt;&lt;Agg&lt;&lt;Grade;\r\n}\r\n};<\/pre>\n<p><span style=\"color: #eb4924\"><strong>Question 21:<br \/>\n<\/strong><\/span>Define a class ITEM in C++ with the following specification: <strong>Delhi 2010<\/strong><br \/>\n<strong>Private members<\/strong><\/p>\n<ul>\n<li>Code of type integer (Item Code)<\/li>\n<li>Iname of type string (Item Name)<\/li>\n<li>Price of type float(Price of each item)<\/li>\n<li>Qty of type integer(Quantity of item stock)<\/li>\n<li>Offer of type float(Offer percentage on the item)<\/li>\n<li>A member function GetOffer( ) to calculate offer percentage as follows:<\/li>\n<\/ul>\n<p>If Qty &lt;=50 Offer is 0<br \/>\nIf 50&lt;Qtv&lt;=l 00 Offer is 5<br \/>\nIf Qty &gt;100 Offer is 10<br \/>\n<strong>Public members<\/strong><\/p>\n<ul>\n<li>A function GetStock( ) to allow user to enter values for Code, Iname, Price, Qty and call function GetOffer( ) to calculate offer.<\/li>\n<li>A function ShowItem( ) to allow user to view the content of all data members.<\/li>\n<\/ul>\n<p><span style=\"color: #eb4924\"><strong><span style=\"color: #008000\">\u0410nswer:<\/span><\/strong><\/span><\/p>\n<pre>class ITEM\r\n{\r\nint Code;\r\nchar Iname[20]: \r\nfloat Price; \r\nint Qty; \r\nfloat Offer; \r\nvoid GetOffer()\r\n{\r\nif(Qty&lt;=50) \r\nOffer=0;\r\nelse if(Qty&lt;=100) \r\nOffer=5; \r\nelse\r\nOffer=10;\r\n}\r\npublic:\r\nvoid GetStock()\r\n{\r\ncout&lt;&lt;\"Enter the values for code, Item name, Price, Quantity\";\r\ncin&gt;&gt;Code; \r\ngets(Iname); \r\ncin&gt;&gt;Price&gt;&gt;Qty;\r\nGetOffer();\r\n}\r\nvoid ShowItem()\r\n{\r\ncout&lt;&lt;Code&lt;&lt;Iname&lt;&lt;Price&lt;&lt;Qty&lt;&lt;Offer;\r\n}\r\n};<\/pre>\n<p><span style=\"color: #eb4924\"><strong>Question 22:<br \/>\n<\/strong><\/span>Define a class STOCK in C++ with the following specification: All India 2010<br \/>\n<strong>Private members<\/strong><\/p>\n<ul>\n<li>ICode of type integer (Item Code)<\/li>\n<li>Item of type string (Item Name)<\/li>\n<li>Price of type float(Price of each item)<\/li>\n<li>Qty of type integer(Quantity in stock)<\/li>\n<li>Discount of type float(Discount percentage on the item)<\/li>\n<li>A member function FindDisc( ) to calculate discount percentage as follows:<\/li>\n<\/ul>\n<p>If Qty &lt;=50 Discount is 0<br \/>\nIf 50&lt;Qty&lt;=100 Discount is 5<br \/>\nIf Qty &gt;100 Discount is 10 Public members<\/p>\n<ul>\n<li>A function Buy( ) to allow user to enter values for ICode, Item, Price, Qty and call function FindDisc( ) to calculate discount.<\/li>\n<li>A function ShowAll( ) to allow user to view the content of all data members.<\/li>\n<\/ul>\n<p><span style=\"color: #eb4924\"><strong><span style=\"color: #008000\">\u0410nswer:<\/span><\/strong><\/span><\/p>\n<pre>class STOCK \r\n{\r\nint ICode; \r\nchar Item[20]: \r\nfloat Price: \r\nint Qty; \r\nfloat Discount: \r\nvoid FindDisc():\r\n{\r\nif(Qty&lt;=50)\r\nDiscount=0; \r\nelse if(Qty&lt;=100) \r\nDiscount=5; \r\nelse\r\nDiscount=10;\r\n}\r\npublic: \r\nvoid Buy()\r\n{\r\ncout&lt;&lt;\"Enter the values for Icode,Item,Price,Qty\"; \r\ncin&gt;&gt;ICode; \r\ngets(Item); \r\ncin&gt;&gt;Price&gt;&gt;Qty;\r\nFindDisc();\r\n}\r\nvoid ShowAll()\r\n{\r\ncout&lt;&lt;ICode&lt;&lt;Item&lt;&lt;Price&lt;&lt;Qty&lt;&lt;Discount;\r\n}\r\n};<\/pre>\n<p><span style=\"color: #eb4924\"><strong>Question 23:<br \/>\n<\/strong><\/span>Define a class RESORT in C++ with the following specification: Delhi 2009<br \/>\n<strong>Private members<\/strong><\/p>\n<ul>\n<li>Rno \u2013 Data member to store room number<\/li>\n<li>Name \u2013 Data member to store customer name<\/li>\n<li>Charges \u2013 Data member to store per day charges<\/li>\n<li>Days \u2013 Data member to store number of days of stay<\/li>\n<li>COMPUTEO \u2013 Function to calculate and return amount as days*charges and if the value of days *charges is more than 11000, then as 1.02*Days *Charges<\/li>\n<\/ul>\n<p><strong>Public members<\/strong><\/p>\n<ul>\n<li>Getinfo( ) Function tfo enter the content Rno, Name, Charges and Days<\/li>\n<li>Dispinfo( ) Function to display Rno, Name, Charges, Days and Amount (amount to be displayed by calling function COMPUTE( ))<\/li>\n<\/ul>\n<p><span style=\"color: #eb4924\"><strong><span style=\"color: #008000\">\u0410nswer:<\/span><\/strong><\/span><\/p>\n<pre>class RESORT \r\n{\r\nint Rno; \r\nchar Name[30]; \r\nfloat Charges; \r\nint Days ; \r\nfloat COMPUTE()\r\n{\r\nfloat temp=Days*Charges; \r\nif(temp&gt;11000) \r\nreturn(1.02*temp);\r\nreturn temp; \r\n}\r\npublic:\r\nvoid Getinfo()\r\n{\r\ncout&lt;&lt;\"enter the room number:\"; \r\ncin&gt;&gt;No;\r\ncout&lt;&lt;\"enter the customer name:\"; \r\ngets(Name);\r\ncout&lt;&lt;\u201denter the room charges per day\";\r\ncin&gt;&gt;Charges;\r\ncout&lt;&lt;\"enter number of days stayed by customer:\"; \r\ncin&gt;&gt;Days:\r\n}\r\nvoid Dispinfo()\r\n{\r\ncout&lt;&lt;\"Room number:\"&lt;&lt;Rno; \r\ncout&lt;&lt;\"Customer Name:\"; \r\nputs(Name) ;\r\ncout&lt;&lt;\"Charges per day:\"&lt;&lt;Charges; \r\ncout&lt;&lt;\"Number of days stayed by customer:\"&lt;&lt;Days; \r\ncout&lt;&lt;\"Total charges of customer: \"&lt;&lt;COMPUTE();\r\n}\r\n};<\/pre>\n<p><span style=\"color: #eb4924\"><strong>Question 24:<br \/>\n<\/strong><\/span>Define a class HOTEL in C++ with the following specification: <strong>All IndiA 2009<\/strong><br \/>\n<strong>Private members<\/strong><\/p>\n<ul>\n<li>Rno Data member to store room number<\/li>\n<li>Name Data member to store customer name<\/li>\n<li>Tariff Data member to store per day charges<\/li>\n<li>NOD Data member to store number of days of stay<\/li>\n<li>CALC( ) Function to calculate and return amount as NOD*Tariff and if the value of NOD*Tariff is more than 10000, then as 1.05 NOD *charges<\/li>\n<\/ul>\n<p><strong>Public members<\/strong><\/p>\n<ul>\n<li>Checkin( ) Function to enter the content Rno, Name, Tariff and NOD<\/li>\n<li>Checkout( ) Function to display Rno, Name, Tariff, NOD and Amount (amount to be displayed by calling function<br \/>\nCALC( ))<\/li>\n<\/ul>\n<p><span style=\"color: #eb4924\"><strong><span style=\"color: #008000\">\u0410nswer:<\/span><\/strong><\/span><\/p>\n<pre>class HOTEL \r\n{\r\nint Rno,NOD; \r\nchar Name[30]; \r\nfloat Tariff; \r\nfloat CALC()\r\n{\r\nfloat temp=NOD*Tariff; \r\nif(temp&gt;10000) \r\nreturn(1.05*temp); \r\nreturn temp;\r\n} \r\npublic:\r\nvoid Check In()\r\n{\r\ncout\u00ab\"Enter the room number:\";\r\ncin&gt;&gt;Rno;\r\ncout&lt;&lt;\"Enter the customer name:\";\r\ngets(Name);\r\ncout&lt;&lt;\"Enter the room charges per day\";\r\ncin&gt;&gt;Tariff ;\r\ncout&lt;&lt;\"Enter number of days stayed by customer:\"; \r\ncin&gt;&gt;NOD;\r\n}\r\nvoid Checkout()\r\n{\r\ncout&lt;&lt;\"Room number:\"&lt;&lt;Rno; \r\ncout&lt;&lt;\"Customer Name:\"; \r\nputs(Name); \r\ncout&lt;&lt;\"Charges per day:\"&lt;&lt;Tariff; \r\ncout&lt;&lt;\"Number of days stayed by customer:\"&lt;&lt;NOD; \r\ncout&lt;&lt;\"Total charges of customer:\"&lt;&lt;CALC();\r\n}\r\n};<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>Previous years Examination Questions 2 Marks Questions Question 1: What is the relationship between a class and an object? Illustrate [&hellip;]<\/p>\n","protected":false},"author":7,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_yoast_wpseo_focuskw":"","_yoast_wpseo_title":"Important Questions for Class 12 Computer Science (C++) \u2013 Classes and Objects","_yoast_wpseo_metadesc":"Important Questions for Class 12 Computer Science (C++) \u2013 Classes and Objects ... What is the relationship between a class and an object?","custom_permalink":"study-materials\/important-questions\/class-12-computer-science\/c-classes-and-objects\/"},"categories":[93,21],"tags":[],"table_tags":[],"acf":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v17.9 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Important Questions for Class 12 Computer Science (C++) \u2013 Classes and Objects<\/title>\n<meta name=\"description\" content=\"Important Questions for Class 12 Computer Science (C++) \u2013 Classes and Objects ... What is the relationship between a class and an object?\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/infinitylearn.com\/surge\/study-materials\/important-questions\/class-12-computer-science\/c-classes-and-objects\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Important Questions for Class 12 Computer Science (C++) \u2013 Classes and Objects\" \/>\n<meta property=\"og:description\" content=\"Important Questions for Class 12 Computer Science (C++) \u2013 Classes and Objects ... What is the relationship between a class and an object?\" \/>\n<meta property=\"og:url\" content=\"https:\/\/infinitylearn.com\/surge\/study-materials\/important-questions\/class-12-computer-science\/c-classes-and-objects\/\" \/>\n<meta property=\"og:site_name\" content=\"Infinity Learn by Sri Chaitanya\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/InfinityLearn.SriChaitanya\/\" \/>\n<meta property=\"article:published_time\" content=\"2022-01-17T14:19:07+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2022-01-18T05:52:11+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/infinitylearn.com\/surge\/wp-content\/uploads\/2021\/12\/24375193947_b612fb57da_o.png\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@InfinityLearn_\" \/>\n<meta name=\"twitter:site\" content=\"@InfinityLearn_\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Prasad Gupta\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"14 minutes\" \/>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Important Questions for Class 12 Computer Science (C++) \u2013 Classes and Objects","description":"Important Questions for Class 12 Computer Science (C++) \u2013 Classes and Objects ... What is the relationship between a class and an object?","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/infinitylearn.com\/surge\/study-materials\/important-questions\/class-12-computer-science\/c-classes-and-objects\/","og_locale":"en_US","og_type":"article","og_title":"Important Questions for Class 12 Computer Science (C++) \u2013 Classes and Objects","og_description":"Important Questions for Class 12 Computer Science (C++) \u2013 Classes and Objects ... What is the relationship between a class and an object?","og_url":"https:\/\/infinitylearn.com\/surge\/study-materials\/important-questions\/class-12-computer-science\/c-classes-and-objects\/","og_site_name":"Infinity Learn by Sri Chaitanya","article_publisher":"https:\/\/www.facebook.com\/InfinityLearn.SriChaitanya\/","article_published_time":"2022-01-17T14:19:07+00:00","article_modified_time":"2022-01-18T05:52:11+00:00","og_image":[{"url":"https:\/\/infinitylearn.com\/surge\/wp-content\/uploads\/2021\/12\/24375193947_b612fb57da_o.png"}],"twitter_card":"summary_large_image","twitter_creator":"@InfinityLearn_","twitter_site":"@InfinityLearn_","twitter_misc":{"Written by":"Prasad Gupta","Est. reading time":"14 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Organization","@id":"https:\/\/infinitylearn.com\/surge\/#organization","name":"Infinity Learn","url":"https:\/\/infinitylearn.com\/surge\/","sameAs":["https:\/\/www.facebook.com\/InfinityLearn.SriChaitanya\/","https:\/\/www.instagram.com\/infinitylearn_by_srichaitanya\/","https:\/\/www.linkedin.com\/company\/infinity-learn-by-sri-chaitanya\/","https:\/\/www.youtube.com\/c\/InfinityLearnEdu","https:\/\/twitter.com\/InfinityLearn_"],"logo":{"@type":"ImageObject","@id":"https:\/\/infinitylearn.com\/surge\/#logo","inLanguage":"en-US","url":"","contentUrl":"","caption":"Infinity Learn"},"image":{"@id":"https:\/\/infinitylearn.com\/surge\/#logo"}},{"@type":"WebSite","@id":"https:\/\/infinitylearn.com\/surge\/#website","url":"https:\/\/infinitylearn.com\/surge\/","name":"Infinity Learn by Sri Chaitanya","description":"Surge","publisher":{"@id":"https:\/\/infinitylearn.com\/surge\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/infinitylearn.com\/surge\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"en-US"},{"@type":"ImageObject","@id":"https:\/\/infinitylearn.com\/surge\/study-materials\/important-questions\/class-12-computer-science\/c-classes-and-objects\/#primaryimage","inLanguage":"en-US","url":"https:\/\/infinitylearn.com\/surge\/wp-content\/uploads\/2021\/12\/24375193947_b612fb57da_o.png?v=1642486144","contentUrl":"https:\/\/infinitylearn.com\/surge\/wp-content\/uploads\/2021\/12\/24375193947_b612fb57da_o.png?v=1642486144","width":737,"height":240},{"@type":"WebPage","@id":"https:\/\/infinitylearn.com\/surge\/study-materials\/important-questions\/class-12-computer-science\/c-classes-and-objects\/#webpage","url":"https:\/\/infinitylearn.com\/surge\/study-materials\/important-questions\/class-12-computer-science\/c-classes-and-objects\/","name":"Important Questions for Class 12 Computer Science (C++) \u2013 Classes and Objects","isPartOf":{"@id":"https:\/\/infinitylearn.com\/surge\/#website"},"primaryImageOfPage":{"@id":"https:\/\/infinitylearn.com\/surge\/study-materials\/important-questions\/class-12-computer-science\/c-classes-and-objects\/#primaryimage"},"datePublished":"2022-01-17T14:19:07+00:00","dateModified":"2022-01-18T05:52:11+00:00","description":"Important Questions for Class 12 Computer Science (C++) \u2013 Classes and Objects ... What is the relationship between a class and an object?","breadcrumb":{"@id":"https:\/\/infinitylearn.com\/surge\/study-materials\/important-questions\/class-12-computer-science\/c-classes-and-objects\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/infinitylearn.com\/surge\/study-materials\/important-questions\/class-12-computer-science\/c-classes-and-objects\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/infinitylearn.com\/surge\/study-materials\/important-questions\/class-12-computer-science\/c-classes-and-objects\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/infinitylearn.com\/surge\/"},{"@type":"ListItem","position":2,"name":"Important Questions for Class 12 Computer Science (C++) \u2013 Classes and Objects"}]},{"@type":"Article","@id":"https:\/\/infinitylearn.com\/surge\/study-materials\/important-questions\/class-12-computer-science\/c-classes-and-objects\/#article","isPartOf":{"@id":"https:\/\/infinitylearn.com\/surge\/study-materials\/important-questions\/class-12-computer-science\/c-classes-and-objects\/#webpage"},"author":{"@id":"https:\/\/infinitylearn.com\/surge\/#\/schema\/person\/143c89c9c2f5e56ed91f96dde47b0b05"},"headline":"Important Questions for Class 12 Computer Science (C++) \u2013 Classes and Objects","datePublished":"2022-01-17T14:19:07+00:00","dateModified":"2022-01-18T05:52:11+00:00","mainEntityOfPage":{"@id":"https:\/\/infinitylearn.com\/surge\/study-materials\/important-questions\/class-12-computer-science\/c-classes-and-objects\/#webpage"},"wordCount":1485,"publisher":{"@id":"https:\/\/infinitylearn.com\/surge\/#organization"},"image":{"@id":"https:\/\/infinitylearn.com\/surge\/study-materials\/important-questions\/class-12-computer-science\/c-classes-and-objects\/#primaryimage"},"thumbnailUrl":"https:\/\/infinitylearn.com\/surge\/wp-content\/uploads\/2021\/12\/24375193947_b612fb57da_o.png","articleSection":["Important Questions","Study Materials"],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/infinitylearn.com\/surge\/#\/schema\/person\/143c89c9c2f5e56ed91f96dde47b0b05","name":"Prasad Gupta","image":{"@type":"ImageObject","@id":"https:\/\/infinitylearn.com\/surge\/#personlogo","inLanguage":"en-US","url":"https:\/\/secure.gravatar.com\/avatar\/200104b443e586c76c46cadc113d931c?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/200104b443e586c76c46cadc113d931c?s=96&d=mm&r=g","caption":"Prasad Gupta"},"url":"https:\/\/infinitylearn.com\/surge\/author\/prasad\/"}]}},"_links":{"self":[{"href":"https:\/\/infinitylearn.com\/surge\/wp-json\/wp\/v2\/posts\/25497"}],"collection":[{"href":"https:\/\/infinitylearn.com\/surge\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/infinitylearn.com\/surge\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/infinitylearn.com\/surge\/wp-json\/wp\/v2\/users\/7"}],"replies":[{"embeddable":true,"href":"https:\/\/infinitylearn.com\/surge\/wp-json\/wp\/v2\/comments?post=25497"}],"version-history":[{"count":0,"href":"https:\/\/infinitylearn.com\/surge\/wp-json\/wp\/v2\/posts\/25497\/revisions"}],"wp:attachment":[{"href":"https:\/\/infinitylearn.com\/surge\/wp-json\/wp\/v2\/media?parent=25497"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/infinitylearn.com\/surge\/wp-json\/wp\/v2\/categories?post=25497"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/infinitylearn.com\/surge\/wp-json\/wp\/v2\/tags?post=25497"},{"taxonomy":"table_tags","embeddable":true,"href":"https:\/\/infinitylearn.com\/surge\/wp-json\/wp\/v2\/table_tags?post=25497"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}