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

Slides:



Advertisements
Similar presentations
Chapter 4 Constructors and Destructors. Objectives Constructors – introduction and features The zero-argument constructor Parameterized constructors Creating.
Advertisements

Chapter 7 Constructors and Other Tools. Copyright © 2006 Pearson Addison-Wesley. All rights reserved. 7-2 Learning Objectives Constructors Definitions.
Question Bank. Explain the syntax of if else statement? Define Union Define global and local variables with example Concept of recursion with example.
A C++ Crash Course Part II UW Association for Computing Machinery Questions & Feedback.
Linked Lists.
Linked Lists: deleting...
Object Oriented Programming with Java
Dynamic memory allocation
Dynamic Memory Allocation in C.  What is Memory What is Memory  Memory Allocation in C Memory Allocation in C  Difference b\w static memory allocation.
Constructor. 2 constructor The main use of constructors is to initialize objects. A constructor is a special member function, whose name is same as class.
Unions The storage referenced by a union variable can hold data of different types subject to the restriction that at any one time, the storage holds data.
Review for Final Exam Dilshad M. NYU. In this review Arrays Pointers Structures Java - some basic information.
CERTIFICATION OBJECTIVES Use Class Members Develop Wrapper Code & Autoboxing Code Determine the Effects of Passing Variables into Methods Recognize when.
CS1061: C Programming Lecture 21: Dynamic Memory Allocation and Variations on struct A. O’Riordan, 2004, 2007 updated.
Pointer applications. Arrays and pointers Name of an array is a pointer constant to the first element whose value cannot be changed Address and name refer.
Kernighan/Ritchie: Kelley/Pohl:
Memory allocation CSE 2451 Matt Boggus. sizeof The sizeof unary operator will return the number of bytes reserved for a variable or data type. Determine:
Chapter 5: Elementary Data Types Properties of types and objects –Data objects, variables and constants –Data types –Declarations –Type checking –Assignment.
1 1 Lecture 4 Structure – Array, Records and Alignment Memory- How to allocate memory to speed up operation Structure – Array, Records and Alignment Memory-
Rossella Lau Lecture 8, DCO10105, Semester B, DCO10105 Object-Oriented Programming and Design  Lecture 8: Polymorphism & C++ pointer  Inheritance.
1 CSE 303 Lecture 11 Heap memory allocation ( malloc, free ) reading: Programming in C Ch. 11, 17 slides created by Marty Stepp
1 Procedural Concept The main program coordinates calls to procedures and hands over appropriate data as parameters.
Differences between C# and C++ Dr. Catherine Stringfellow Dr. Stewart Carpenter.
OOP Languages: Java vs C++
Programming Languages and Paradigms Object-Oriented Programming.
Operator Overloading and Type Conversions
 2006 Pearson Education, Inc. All rights reserved Classes: A Deeper Look.
1 CISC181 Introduction to Computer Science Dr. McCoy Lecture 19 Clicker Questions November 3, 2009.
Copy Control Joe Meehean. More Class Responsibilities When making a new type (i.e., class) we must specify what happens when it is: Copied Assigned Destroyed.
Overview of Previous Lesson(s) Over View  OOP  A class is a data type that you define to suit customized application requirements.  A class can be.
Programming Languages -1 (Introduction to C) arrays Instructor: M.Fatih AMASYALI
EE4E. C++ Programming Lecture 1 From C to C++. Contents Introduction Introduction Variables Variables Pointers and references Pointers and references.
17. ADVANCED USES OF POINTERS. Dynamic Storage Allocation Many programs require dynamic storage allocation: the ability to allocate storage as needed.
Algorithm Programming Bar-Ilan University תשס"ח by Moshe Fresko.
Object Oriented Programming with C++/ Session 6 / 1 of 44 Multiple Inheritance and Polymorphism Session 6.
CMPSC 16 Problem Solving with Computers I Spring 2014 Instructor: Tevfik Bultan Lecture 12: Pointers continued, C strings.
1 C - Memory Simple Types Arrays Pointers Pointer to Pointer Multi-dimensional Arrays Dynamic Memory Allocation.
 2006 Pearson Education, Inc. All rights reserved Classes: A Deeper Look, Part 2.
Chapter 0.2 – Pointers and Memory. Type Specifiers  const  may be initialised but not used in any subsequent assignment  common and useful  volatile.
Week 14 - Monday.  What did we talk about last time?  Introduction to C++  Input and output  Functions  Overloadable  Default parameters  Pass.
CSE 425: Data Types I Data and Data Types Data may be more abstract than their representation –E.g., integer (unbounded) vs. 64-bit int (bounded) A language.
Lists II. List ADT When using an array-based implementation of the List ADT we encounter two problems; 1. Overflow 2. Wasted Space These limitations are.
Prachi A. Joshi Assistant Professor in CSE DIEMS,Aurangabad Unit 1 : Basic Concepts Pointers and dynamic memory allocation, Algorithm Specification, Data.
1 Pointers to structs. 2 A pointer to a struct is used in the same way as a pointer to a simple type, such as an int. Pointers to structs were introduced.
Copyright 2005, The Ohio State University 1 Pointers, Dynamic Data, and Reference Types Review on Pointers Reference Variables Dynamic Memory Allocation.
19&20-2 Know how to declare pointer variables. Understand the & (address) and *(indirection) operators. Dynamic Memory Allocation Related Chapter: ABC.
1 Homework HW5 due today Review a lot of things about allocation of storage that may not have been clear when we covered them in our initial pass Introduction.
UFS003C3 Lecture 15 Data type in C & C++ Using the STL.
CS 261 – Data Structures Introduction to C Programming.
Java Basics Opening Discussion zWhat did we talk about last class? zWhat are the basic constructs in the programming languages you are familiar.
Computer Organization and Design Pointers, Arrays and Strings in C Montek Singh Sep 18, 2015 Lab 5 supplement.
Computer Graphics 3 Lecture 1: Introduction to C/C++ Programming Benjamin Mora 1 University of Wales Swansea Pr. Min Chen Dr. Benjamin Mora.
CS-1030 Dr. Mark L. Hornick 1 Basic C++ State the difference between a function/class declaration and a function/class definition. Explain the purpose.
CMSC 202 Advanced Section Classes and Objects: Object Creation and Constructors.
C++ for Java Programmers Chapter 2. Fundamental Daty Types Timothy Budd.
Chapter 1 C++ Basics Review (Section 1.4). Classes Defines the organization of a data user-defined type. Members can be  Data  Functions/Methods Information.
1 Recall that... char str [ 8 ]; str is the base address of the array. We say str is a pointer because its value is an address. It is a pointer constant.
1 Chapter 15-1 Pointers, Dynamic Data, and Reference Types Dale/Weems.
MORE POINTERS Plus: Memory Allocation Heap versus Stack.
Reference Types CSE301 University of Sunderland Harry R Erwin, PhD.
Java and C# - Some Commonalities Compile into machine-independent, language- independent code which runs in a managed execution environment Garbage Collection.
Constructors and Destructors
Computer Organization and Design Pointers, Arrays and Strings in C
Java Yingcai Xiao.
Java Primer 1: Types, Classes and Operators
Operators.
Constructors and Destructors
CS111 Computer Programming
Java Programming Language
CECS 130 Final Exam Review Session
Presentation transcript:

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.

You are not the first Max imum conversation time is 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

Links used questions-and-answers-2 questions-and-answers-2 major-differences-between-c-and-c/ major-differences-between-c-and-c/

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

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.

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?

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?

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

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

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

Reference malloc: malloc create the single block of given size by user calloc: calloc creates multiple blocks of given size both return void pointer(void *)so boh requires type casting malloc: 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

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()

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.

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

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()].

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 virtual example public 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

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

now from the user class the calls would be like globally 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 draws public 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