you can do more than what you think ……… if you believe you can

19
You can do more than what you think ……… If you believe you can

Upload: zody

Post on 23-Jan-2016

23 views

Category:

Documents


0 download

DESCRIPTION

You can do more than what you think ……… If you believe you can. Important Mantra. Do not Panic if you get a question which you do not know. Relax and the best tool to attempt for the answer is try using your common sense… You will not believe 80% of them manages to answer correctly. - PowerPoint PPT Presentation

TRANSCRIPT

Page 1: You can do more than what you think ……… If you believe you can

You can do more than what you think ………

If you believe you can

Page 2: You can do more than what you think ……… If you believe you can

Important Mantra

• Do not Panic if you get a question which you do not know.

• Relax and the best tool to attempt for the answer is try using your common sense…

• You will not believe 80% of them manages to answer correctly.

• Do not forget the word ATTITUDE at any point of your life.

Page 3: You can do more than what you think ……… If you believe you can

• You are not the first• Maximum conversation time is 15-20 minutes• Make the interviewer bound to you never allow the

reverse to happen….But do this is very carefully and swiftly. Do not do it abruptly…

• And most of the questions are based on your previous answers….So the question paper is almost in your hands.

• Please Do not overload yourself till the last minute…

Plan yourself

Page 4: You can do more than what you think ……… If you believe you can

Links used

• http://c-faq.com/~scs/cgi-bin/faqcat.cgi• http://www.techinterviews.com/c-interview-q

uestions-and-answers-2• http://zarrata.com/durofy/programming/10-

major-differences-between-c-and-c/• http://www.coolinterview.com/

Page 5: You can do more than what you think ……… If you believe you can

Simple but yet asked many a times as refresh questions

• Programming language• Difference between Preprocessor, Compiler,

Assembler, Linker and Interpreter• Difference between C, C++ and Java• Features of OOPS• Definition about each of them

Page 6: You can do more than what you think ……… If you believe you can

Frequently asked questions

• What is the difference between an ARRAY and a LIST?

• What is faster : access the element in an ARRAY or in a LIST?

• Define a constructor - what it is and how it might be called (2 methods).

• Describe PRIVATE, PROTECTED and PUBLIC the differences and give examples.

Page 7: You can do more than what you think ……… If you believe you can

• What is a COPY CONSTRUCTOR and when is it called (this is a frequent question !)?

• Explain term POLIMORPHISM and give an example using eg. SHAPE object: If I have a base class SHAPE, how would I define DRAW methods for two objects CIRCLE and SQUARE.

• What is the word you will use when defining a function in base class to allow this function to be a polimorphic function?

Page 8: You can do more than what you think ……… If you believe you can

• You have two pairs: new() and delete() and another pair : malloc() and free(). Explain differences between eg. new() and malloc()

• What is a callbyreference and callbyvalue?• Difference between calloc and malloc. what c in

calloc stand for?

Page 9: You can do more than what you think ……… If you believe you can

Check list

• 1. Declarations and Initializations• 2. Structures, Unions, and Enumerations• 3. Expressions• 4. Pointers• 5. Null Pointers

Page 10: You can do more than what you think ……… If you believe you can

• 6. Arrays and Pointers• 7. Memory Allocation• 8. Characters and Strings• 9. Boolean Expressions and Variables• 10. C Preprocessor

Page 11: You can do more than what you think ……… If you believe you can

• 11. ANSI/ISO Standard C• 12. Stdio• 13. Library Functions• 14. Floating Point• 15. Variable-Length Argument Lists

Page 12: You can do more than what you think ……… If you believe you can

Reference• malloc: malloc create the single block of given size by user

calloc: calloc creates multiple blocks of given sizeboth return void pointer(void *)so boh requires type castingmalloc: eg:int *p;p=(int*)malloc(sizeof(int)*5)above syntax tells that malloc occupies the 10 bytes memory and assign the address of first byte to P

calloc: eg:p=(int*)calloc(5,sizeof(int)*5)above syntax tells that calloc occupies 5 blocks each of the 10 bytes memeory and assign the address of first byte of first block to P

Page 13: You can do more than what you think ……… If you believe you can

Other difference

• the above answer is absolutely right,but the difference between calloc and malloc is that calloc also initialize the reserved memory block to zero rather than garbage value in case of malloc()

Page 14: You can do more than what you think ……… If you believe you can

1. What is the difference between an ARRAY and a LIST?Array is collection of homogeneous elements.

List is collection of heterogeneous elements.For Array memory allocated is static and continuous.

For List memory allocated is dynamic and Random. Array: User need not have to keep in track of next memory

allocation.List: User has to keep in Track of next location where memory is allocated.

2. What is faster : access the element in an ARRAY or in a LIST?• It’s array the reason is it continuous.

Page 15: You can do more than what you think ……… If you believe you can

3. Define a constructor - what it is and how it might be called (2 methods).

constructor is a member function of the class, with the name of the function being the same as the class name. It also specifies how the object should be initialized.

Ways of calling constructor:1) Implicitly: automatically by complier when an object

is created.2) Calling the constructors explicitly is possible

Page 16: You can do more than what you think ……… If you believe you can

4. You have two pairs: new() and delete() and another pair : alloc() and free(). Explain differences between eg. new() and malloc()

1.) “new and delete” are preprocessors while “malloc() and free()” are functions. [we dont use brackets will calling new or delete].

2.) no need of allocate the memory while using “new” but in “malloc()” we have to use “sizeof()”.

3.) “new” will initlize the new memory to 0 but “malloc()” gives random value in the new alloted memory location [better to use calloc()].

Page 17: You can do more than what you think ……… If you believe you can

5. Explain term POLIMORPHISM and give an example using eg. SHAPE object: If I have a base class SHAPE, how would I define DRAW methods for two objects CIRCLE and SQUARE

POLYMORPHISM : A phenomenon which enables an object to react differently to the same function call.in C++ it is attained by using a keyword virtualexamplepublic class SHAPE{public virtual void SHAPE::DRAW()=0;}Note here the function DRAW() is pure virtual which means the sub classes must implement the DRAW() method and SHAPE cannot be instatiated

Page 18: You can do more than what you think ……… If you believe you can

public class CIRCLE::public SHAPE{public void CIRCLE::DRAW(){// TODO drawing circle}}public class SQUARE::public SHAPE{public void SQUARE::DRAW(){// TODO drawing square}}

Page 19: You can do more than what you think ……… If you believe you can

now from the user class the calls would be likeglobally

SHAPE *newShape;when user action is to draw

public void MENU::OnClickDrawCircle(){newShape = new CIRCLE();}

public void MENU::OnClickDrawCircle(){newShape = new SQUARE();}

when user actually drawspublic void CANVAS::OnMouseOperations(){newShape->DRAW();}

What is the word you will use when defining a function in base class to allow this function to be a polimorphic function?virtual