







Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!








(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. : [2]
include<iostream.h> #define PI=3. void main( ) { float r;a; cout<<’enter any radius’; cin>>r; a=PI*pow(r,2); cout<<”Area=”<<a }
d. Write the output from the following C++ program code: [2]
#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 }
e. Find the output of the following C++ program: [3]
#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;
StreamCode=1; strcpy (Streamname,"DELHI"); fees=1000; } void display(float C) //Function 2 { cout<<StreamCode<<":"<<Streamname<<":"<<fees<<endl; } ~Stream( ) //Function 3 { cout<<"End of Stream Object"<<endl; } Stream (int SC,char S[ ],float F) ; //Function 4 };
i) In Object Oriented Programming, what are Function 1 and Function 4 combined together referred as? Write the definition of function 4.
ii) What is the difference between the following statements? Stream S(11,”Science”,8700); Stream S=Stream(11,”Science”,8700);
c. Define a class Customer with the following specifications. [4]
Private Members : Customer_no integer Customer_name char (20) Qty integer Price, TotalPrice, Discount, Netprice float Member Functions: Public members:
d. Answer the questions (i) to (iv) based on the following code: [4]
class AC {
char Model[10]; char Date_of_purchase[10]; char Company[20]; public( ); AC( ); void entercardetail( ); void showcardetail( ); }; class Accessories : protected AC { protected: char Stabilizer[30]; char AC_cover[20]; public: float Price; Accessories( ); void enteraccessoriesdetails( ); void showaccessoriesdetails( ); }; class Dealer : public Accessories { int No_of_dealers; char dealers_name[20]; int No_of_products; public: Dealer( ); void enterdetails( ); void showdetails( ); };
(i) How many bytes will be required by an object of class Dealer and class Accessories?
(ii) Which type of inheritance is illustrated in the above c++ code? Write the base class and derived class name of class Accessories.
(ii) Write names of all the members which are accessible from the objects of class Dealer.
(iv) Write names of all the members accessible from member functions of class Dealer.
Q3a) An array T[-1..35][-2..15] is stored in the memory along the row with each element occupying 4 bytes. Find out the base address and address of element T[20][5], if an element T[2][2] is stored at the memory location 3000. Find the total number of elements stored in T and number of bytes allocated to T [3]
cin>> C_No ; gets(C_Name) ; cin >> Milage; } void display( ) { cout<< C_No ; cout<<C_Name ; cout<< Milage; } int RETURN_Milage( ) { return Milage; } };
Write a function in C++, that would read contents from the file CAR.DAT and display the details of car with mileage between 100 to 150.
Section B (Python)
Q1.a) How is a static method different from an instance method? [2]
b) Name the function / method required for [1]
i) Finding second occurrence of m in madam. ii) get the position of an item in the list
c) Rewrite the following python code after removing all syntax error(s). Underline the corrections done. [2]
def main(): r = raw-input(‘enter any radius : ‘) a = pi * math.pow(r,2) print “ Area = “ + a
d) Give the output of following with justification [2] x = 3 x+= x-x print x
e) What will be printed, when following python code is executed [3] class person: def init(self,id): self.id = id arjun = person(150) arjun.dict[‘age’] = 50 print arjun.age + len(arjun.dict)
Justify your answer.
f) What are the possible outcome(s) expected from the following python code? Also specify maximum and minimum value, which we can have. [2]
def main(): p = 'MY PROGRAM' i = 0 while p[i] != 'R': l = random.randint(0,3) + 5 print p[l],'-', i += 1 i) R - P - O - R - ii) P - O - R - Y - iii) O -R - A - G - iv) A- G - R - M -
Q2. a) How data encapsulation and data abstraction are implemented in python, explain with example. [2]
b) What will following python code produce, justify your answer [2] x = 5 y = 0 print ‘A’ try : print ‘B’ a = x / y print ‘C’ except ZerorDivisionError: print ‘F’ except : print ‘D’
c) Write a class customer in python having following specifications [4]
Instance attributes:
customernumber - numeric value customername - string value price, qty, discount, totalprice, netprice - numeric value methods :
init() to assign initial values of customernumber as 111, customername as “Leena”, qty as 0 and price, discount & netprice as 0. caldiscount ( ) – To calculate discount, totalprice and netprice totalprice = price * qty discount is 25% of totalprice, if totalprice >= discount 15% of totalprice, if totalprice >=25000 and totalprice < discount 10% of totalprice, if totalprice <
Q5. a. Define degree and cardinality. Based upon given table write degree and cardinality. [2]
PATIENTS
PatNo PatName Dept DocID
1 Leena ENT 100
2 Surpreeth Ortho 200
3 Madhu ENT 100
4 Neha ENT 100
5 Deepak Ortho 200
b. Write SQL commands for the queries (i) to (iv) and output for (v) & (viii) based
on a table COMPANY and CUSTOMER [6]
101 Rohan Sharma 70000 20 222
102 Deepak Kumar 50000 10 666
103 Mohan Kumar 30000 5 111
104 Sahil Bansal 35000 3 333
105 Neha Soni 25000 7 444
106 Sonal Aggarwal 20000 5 333
107 Arjun Singh 50000 15 666
(i) To display those company name which are having prize less than 30000. (ii) To display the name of the companies in reverse alphabetical order. (iii) To increase the prize by 1000 for those customer whose name starts with ‘S’ (iv) To add one more column totalprice with decimal(10,2) to the table customer (v) SELECT COUNT(*) ,CITY FROM COMPANY GROUP BY CITY; (vi) SELECT MIN(PRICE), MAX(PRICE) FROM CUSTOMER WHERE QTY>10 ; (vii) SELECT AVG(QTY) FROM CUSTOMER WHERE NAME LIKE “%r%; (viii) SELECT PRODUCTNAME,CITY, PRICE FROM COMPANY,CUSTOMER WHERE COMPANY.CID=CUSTOMER.CID AND PRODUCTNAME=”MOBILE”;
Q6. a) State and define principle of Duality. Why is it so important in Boolean Algebra? [2]
b) Write the equivalent boolean expression for the following logic circuit [2]
c) Write Product Of Sum expression of the function F (a,b,c,d) from the given truth table [1]
a b c d F
0 0 0 0 0 0 0 0 1 1 1 0 0 0 0 1 1 1 1 0 0 0 0 0 1 1 0 0 1 1 0 0 1 0 1 0 1 0 1 0 1 0 1 0 0 0 1 1 0 1 1 0 0 0 1
(b3) Suggest the placement of the following devices with justification. · Repeater · Hub / Switch (b4) The organization also has Inquiry office in another city about 50-60 Km away in Hilly Region. Suggest the suitable transmission media to interconnect to school and Inquiry office out of the following.
· Fiber Optic Cable · Microwave · Radio Wave
http://www.income.in/home.aboutus.hml d. What is Web Hosting? [1] e. What is the difference between packet & message switching? [1] f. Define firewall. [1] g. Which protocol is used to creating a connection with a remote machine? [1]