doubts on computer science
@Opcode here :)
Ready :-).
Consider the following program : #include<iostream.h> class data {int a; public: data( ) { a=0; { data(int x) { a=x; } void disp() { cout<<"value is"<<a<<endl; } }; vpod main( ) { data m,n(7); m.disp( ); n.disp( ); } a) what OOP feature do you observe in above program?? b)write the output for above program
I would also like to know how the code works here
2. class base { public:base( ) { cout<<"Base Class constructor\n"; } ~base( ) { cout<<"Base Class Destructor\n"; } }; class der:public base { Base b,b1; public: der( ) { cout<<"Derived Class Constructor\n"; } ~der( ) { cout<<"Derived class destructor\n"; } }; predict output and explain logic of code
3. If the get pointer position at the beginning of file ,tellg( ) returns _______ is it 0 ?
4. Tom recieved a carbon copy of printout .Name the printer
5. Arrange in ascending order of storage capacity floppy disk,hard disk ,CD ,DVD,Pen drive i know HD>DVD>FLOPPY where to place pen drive ?
6. explain L3 cache
7.choose odd one out scanner ,light pen, track ball , mouse
scanner?
8. distinguish between the foll: a) distance t1=distance(10,20); b)distance t1(10,20)
9) class test { int a,b; public: test( ) { a=10; b=5; } }; define and implement copy constructor for above class
10) find @Opcode and operand in foll instructions a) MVI A,06 b) ADD A,B c)LDA 2000H d)SUB B I think a) opcode =MVI operands A and 06 b)opcode=ADD operands A and B C)i have doubt d) opcode =sub operand=B
If the get pointer position at the beginning of file ,tellg( ) returns _______ Returns your current pointer position. Tom recieved a carbon copy of printout .Name the printer Impact Printers/ Dot matrix printers. Arrange in ascending order of storage capacity Floppy disk, hard disk, CD, DVD, Pen drive. Hard disks = Most storage capacity. Pen drive = up to 256 gigabytes DVD = 17.08 GB (double-sided, double-layer) CD = 700Mb Floppy disks = I don't know the size but I know it's the smalles. Explain L3 cache: http://www.wisegeek.com/what-is-l3-cache.htm Choose odd one out: scanner ,light pen, track ball , mouse Scanner, because the rest are pointer devices.
so pen drive >DVD ?
Yes.
10. what will be order of constructor invocation for foll code? explain class A { ..... }; class B { ...... } class C { int val; A obj1; B obj2; ....... }; void main( ) { A a1; B b1; C c1; }
why current position isnt it beginning position ?
11.constructors can be inherited .say true or false with reason .
12. Is it required to read data from a file and update it simultaneously ? which stream can serve this purpose ? answer to second part is input strean i suppose
*input stream
Constructors can be inherited. True or false explain your reasoning. False 100% sure. Constructors are not inherited. If they were, that would cause many problems anyway. They're instead called implicitly or explicitly by the child constructor. A) Is it required to read data from a file and update it simultaneously ? B) Which stream can serve this purpose ? Answer to question A is yes. I think the answer to "B" is "fstream" Boop ^.^ http://www.cplusplus.com/reference/fstream/fstream/
lol thanks i am looking forward to the answers based on the code :P
Constructors are not inherited. If they were, that would cause many problems anyway. i need to reason so i cant just say many ways
Number nine [9]: ``` //Regular code: class test { int a,b; public: test( ) { a=10; b=5; } }; //Copy constructor code: class test { int a,b; public: test() {a = 10}; //default constructor abc(abc &5) {this.a=5.a) //copy constructor } }; ``` Number ten [10]: What will be order of constructor invocation for the following code? Explain. ``` class A { ..... }; class B { ...... } class C { int val; A obj1; B obj2; ....... }; void main( ) { A a1; B b1; C c1; } ``` Order: Class A's Constructor Class B's Constructor Class C's Constructor Class C's Constructor Class B's Constructor Class A's Constructor I really think is messed that up >.<
Number ten [10] Find Opcode and operand in following instructions. ``` A) MVI A,06 B) ADD A,B C) LDA 2000H D) SUB B ``` I think A) Opcode = MVI operands A and 06 (Agree) B) Opcode = ADD operands A and B (Agree) C) Get the contents of memory location 2000H into accumulator. Maybe: (Opcode = LDA Operands 2000 and H.) Not so sure :/ D) Opcode = 'sub' operand = B (Agreed)
programms.....ohh my god....ruuun...
@Opcode for first code i think output is 07
nah its : value is0 value is7
Join our real-time social learning platform and learn together with your friends!