Showing posts with label class12-computerScience. Show all posts
Showing posts with label class12-computerScience. Show all posts

Friday, 9 June 2017

CBSE Class 12 - Computer Science - C++ Practical Class Design Snippet-2 (#cbseNotes)

C++ Practical
Class Design Snippet-2

CBSE Class 12 - Computer Science - C++ Practical Class Design Snippet-2  (#cbseNotes)

Question 2: Write a declaration for a class Person which has the following:
  • data members name, phone
  • set and get functions for every data member
  • a display function
  • a destructor

(i) For the Person class above, write each of the constructors, the assignment operator and the getName member functions. Use member initialization list as often as possible

(ii) Given the Person class above, write the declaration for the class Spouse that inherits from Person and does the following:
  • has an extra data member spouseName
  • redefines the display member function

(iii) For the Spouse class above, write each of the constructors and display member, functions. Use member initialization lists as often as possible.


Answer:

Thursday, 8 June 2017

CBSE Class 12 C++ Practical - Class Design Snippet-1 (#cbseNotes)

C++ Practical
Class Design Snippet-1

CBSE Class 12 C++ Practical - Class Design Snippet-1 (#cbseNotes)

Question 1: Imagine a publishing company that markets both book and audio-cassette versions of its works. Create a class publication that stores the title (a string) and price (type float) of a publication. From this class derive two classes: book, which adds a page count (type int) and tape, which adds a playing time in minutes (type float). Each of these three classes should have a getdata() function to get its data from the user and a putdata() function to display its data. Write a main() program to test the book and tape classes by creating instances of then displaying the data with putdata().


Answer:


Thursday, 1 June 2017

CBSE Class 12 - Computer Science / Informatics Practices - Computer Networking - Data Transmission Media - Q and A (#cbseNotes)

Data Transmission Media

Computer Networking

Class 12 - Computer Science / Informatics Practices

Q & A

CBSE Class 12 - Computer Science / Informatics Practices - Computer Networking - Data Transmission Media - Q and A (#cbseNotes)



Q: Define transmission media.

Answer: The means or channel through which we send our data from one place to another are called transmission media.


Q: What are different categories of transmission media?

Answer:
Guided or Wired Media- Examples are
Twisted Pair Cable
Co-axial cable
Fibre active cable

Unguided or Wireless Media - Examples are:
Satellite
Microwave
Wifi
Radiowave


Q: Define baud.

Answer: Baud is used as measurement for the information carry of a communication channel. It is measured in Kbps (kilobits Per Second), KBPS (Kilo Byte Per Second), and Mbps (Mega bits Per Second )


Tuesday, 30 May 2017

CBSE Class 12 - Computer Science / Informatics Practices - Computer Networking - Q and A (#cbseNotes)

Computer Networking 

Q and A
CBSE Class 12 - Computer Science / Informatics Practices - Computer Networking - Q and A (#cbseNotes)



Q1: What is a computer network?

Answer: A computer network is a collection of interconnected computers. Two computers are said to be interconnected if they are capable of sharing hardware, software and exchanging information.


Q2: Name the architectures that are involved in network design?

Answer:
Peer to peer (P2P)
Client - Server
Hybrid of client-server and P2P

CBSE Class 11 and 12 Computer Science - (C++ / Python) -Syllabus (2017-18) (#cbseNotes)

Computer Science (C++ / Python) -Syllabus (2017-18)


CBSE Class 11 and 12 Computer Science

CBSE Class 12 Business Studies -Syllabus (2017-18) (#cbseNotes)

Here presents the prescribed syllabus for Class 11 and Class 12 Computer Science for the curriculum 2017-18.


Sunday, 14 May 2017

CBSE Class 12 - Computer Science - C++ - Constructors and Destructors (Q and A) (#cbseNotes)

C++ - Constructors and Destructors

CBSE Class 12 - Computer Science - Questions and Answers

CBSE Class 12 - Computer Science - C++ - Constructors and Destructors (Q and A) (#cbseNotes)

Q1: What is a constructor? How it is different from other member functions?

Answer: A constructor is a special member function that must be defined with the same name as the class and it is used to initialize the data members of the class. Constructor is invoked automatically when an object of a class is created. Constructors unlike other functions cannot return values, so they cannot specify a return type (not even void ).Generally, constructors are declared public.



Q2: Name the types of constructors.

Answer: Types of constructors:
Default Constructor (No argument constructor)
Parameterized Constructor (Overloaded Constructor)
Copy Constructor


Wednesday, 10 May 2017

CBSE Class 12 - Computer Science - C++ - OOPS, Class and Objects (Q and A) (#cbseNotes)

C++ - OOPS, Class and Objects

CBSE Class 12 - Computer Science - Questions and Answers

CBSE Class 12 - Computer Science - C++ - OOPS, Class and Objects (Q and A) (#cbseNotes)

Q1: Define class.

Answer: A class is collection of data (data member) and functions (member functions or methods)
working on the data. It can be seen as a blueprint for the object. Data define the attributes and methods define behaviours of the class.


Q2: Does memory allocated when a class is created? 

Answer: No memory is allocated when a class is created. Memory is allocated only when an object is created.


Q3: Which keyword is used to begin the definition of a class?

Answer: class

Sunday, 14 June 2015

CBSE Class 12 - Computer Science - C++ - Board Questions on Header Files

Board Questions On Header Files

There is 1 or 2 Marks questions based on function mapping to header files


Q1(CBSE 2012): Write the names of the header file to which of the following belong:

   (i) sqrt( )
   (ii) randomize()

Answer: (i) math.h
              (ii) stdlib.h

Q2: Name the header file that will be needed for the following code:

   void main()
   {
     char word [] = "Board Examination";
  cout << setw(20) << word;
   }   

Answer: iostream.h (for cout), iomanip.h (for setw)

Q3(CBSE 2012): Which C++ header file(s) are especially required to be included to run the following C++ code. (Note: Do not include any header which is/are not required):

   void main()
   {
      char TEXT[] = "something";
   cout << "Remaining SMS chars: " << 160 - strlen(TEXT) << endl;
   }

Answer: iostream.h (for cout), string.h (for strlen)

Q4(CBSE 2013): Observe the following C++ code and write name(s) of the header file(s) which will be essentially required to run in a C++ compiler:

    void main()  
 {
     int number;
  cin >> number;
  if (abs(number) == number)
    cout << "positive" << endl;
 }

Answer: iostream.h (for cin, cout), math.h (for abs)

Sunday, 7 June 2015

CBSE Class 12 - Computer Science - Board Questions on Inheritance

C++ Inheritance Questions 
Asked in Board Examination

Q&A
CBSE Class 12 - Computer Science - Board Questions on Inheritance

Q1(CBSE 2004): What is inheritance? Give an example in C++ to show its implementation in C++.

Answer: Inheritance is the process of forming a new class from an existing or base class. The base class is also known as parent class or super class. It allows the new class (called derived class) to inherit properties of its parent class.Inheriatnce helps in reusability of code.
For example, a class Truck inherits from class Automobiles which itself inherits from another class vehicles.

Q2(CBSE 2004): Given the following class definitions, answer the following questions.

   class Book 
   {
      char title[20];
      char author[20];
      int no_of_pages;
      public:
        void read( );
     void show( );
   };
   
   class TextBook : private Book
   {
      int no_of_chapters, no_of_assignments;
      protected:
         int standard;
      public:
         void readtextbook( );
      void showtextbook( );
   };
   
   class PhysicsBook : public TextBook
   {
       char topic[20];
    public:
       void readphysicsbook( );
       void showphysicsbook( );
   };
  

(i) Name the members, which can be accessed from the member functions of class PhysicsBook.
(ii) Name the members, which can be accessed by an object of class TextBook.
(iii) Name the members which can be accessed by an object of class Physicsbook.
(iv) What will be the size of an object (in bytes) of class Physicsbook?

Answer: (i) no_of_chapters, no_of_assignments, standard, topic, readtextbook(), showtextbook(), readphysicsbook() and showphysicsbook().

(ii) read(), show(), readtextbook(), showtextbook()

(iii) readtextbook(), showtextbook(), readphysicsbook() and showphysicsbook()

(iv)20 + 20 + 2 + 2 + 2 + 2 + 20 = 68 bytes.

Q3 (CBSE 2013): Consider the following c++ code and answer the questions (i) to (iv):

Thursday, 23 April 2015

CBSE Class 12 - Computer Science (C++) Questions on Class Design

Computer Science (C++) - Class Design

Questions Asked in Board Papers on Class Design

Q1(CBSE 2013):  Define a class Tourist in C++ with the following specifications:
     Data Members:
  • CarNo - to store bus number
  • Origin - to store Place name
  • Destination - to store Place name
  • Type - to store Car Type such as 'E' for Economy
  • Distance - to store the Distance in Kilometers
  • Charge - to store the Car Fare
    Member Functions:
  • A constructor function to initialize Type as 'E' and Freight as 250
  • A function CalcCharge( ) to calculate Fare as per the following criteria:
    Type Charge
    'E' 16*Distance
    'A' 22*Distance
    'L' 30*Distance

  • A function Enter( ) to allow user to enter values for CarNo, Origin, Destination, Type and Distance. Also this function should call CalcCharge( ) to calculate Fare.
  • A function Show( ) to display the content of all the data members on screen.
 Answer:
 const int BUFFSIZE = 40;
 class Tourist
 {
   // private data members
   int carNum;
   char origin[BUFFSIZE];
   char destination[BUFFSIZE];
   char carType;
   int distance;
   int charges;
  public:
    // member functions
    // constructor
   Tourist()
    {
     carType = 'E';
     charges = 250;
    }

   // calculate charges
   void CalcCharges()
    {
     if (Type == 'E')
     {
      charges = 16*distance;
     }
    else if (Type == 'A')
     {
      charges = 22*distance;
     }
    else if (Type == 'C')
     {
      charges = 30*distance;
     }
 };

 // enter values
 void Tourist::Enter()
 {
   cout << "Enter CarNo, Origin, Destination, Type, Distance:";
   cin >> carNum;
   gets(origin);
   gets(destination);
   cin >> carType >> Distance;
   CalcCharges();
 }
 
 // show/display details
 void Show()
 {
   cout << "Car No: " << carNum 
        << "\nOrigin: " << origing 
        << "\nDestination: " << destination
        << "\nType: " << carType
        << "\nDistance: " << distance
        << "\nCharges: " << charges << endl; 
 }
 };

Q2(CBSE 2012): Define a class Flat in C++ with the following description:
     Private Members:

Saturday, 4 April 2015

CBSE Class 12 - Computer Science - Sample Question Paper - (2014-15)

Class 12
Computer Science
Sample Q Paper (2014-15)



CLASS-XII
COMPUTER SCIENCE
(Subject Code 083)
SAMPLE PAPER 2014 - 15

Time allowed : 3 hours
Maximum Marks: 70

Instructions:
(i) All questions are compulsory.
(ii) Programming Language: Section A C+ +.
(iii) Programming Language : Section B Python.
(iv) Answer either Section A or B, and Section C is compulsory.

Section A (C++)

Q1 (a) Differentiate between ordinary function and member functions in C++. Explain with an example. [2]
(b) Write the related library function name based upon the given information in C++.
(i) Get single character using keyboard. This function is available in stdio.h file.
(ii) To check whether given character is alpha numeric character or not. This function is available in ctype.h file.
[1]
(c) Rewrite the following C++ program after removing all the syntactical errors (if any), underlining each correction. :
include <iostream.h>
#define PI=3.14
void main( )
{ float r;a;
  cout<<’enter any radius’;
  cin>>r;
  a=PI*pow(r,2);
  cout<< ”Area=” << a
}
[2]
(d) Write the output from the following C++ program code:
#include <iostream.h>
#include <ctype.h>
void strcon(char s[])
{
  for(int i=0,l=0;s[i]!='\0';i++,l++);
  for(int j=0; j<l; j++)
  {
    if (isupper(s[j]))
      s[j]=tolower(s[j])+2;
    else if ( islower(s[j]))
      s[j]=toupper(s[j])-2;
    else
      s[j]='@';
  }
}

void main()
{
  char *c="Romeo Joliet";
  strcon(c);
  cout<<"Text= "<<c<<endl;
  c=c+3;
  cout<<"New Text= "<<c<<endl;
  c=c+5-2;
  cout<<"last Text= "<<c
}
[2]
(e) Find the output of the following C++ program:
#include<iostream.h>
#include<conio.h>
#include<ctype.h>
class Class
{
  int Cno,total;
  char section;
 public:
  Class(int no=1)
  {
   Cno=no;
   section='A';
   total=30;
  }
  void addmission(int c=20)
  {
   section++;
   total+=c;
  }
  void ClassShow()
  {
   cout<<Cno<<":"<<section<<":"<<total<<endl;
  }
};

void main()
{
  Class C1(5),C2;
  C1.addmission(25);
  C1.ClassShow();
  C2.addmission();
  C1.addmission(30);
  C2.ClassShow();
  C1.ClassShow();
}