C/C++ PROGRAMMING

C Interview Questions


1. What is Polymorphism ?

'Polymorphism' is an object oriented term. Polymorphism may be defined as the ability of related objects to respond to the same message with different, but appropriate actions. In other words, polymorphism means taking more than one form. Polymorphism leads to two important aspects in Object Oriented terminology - Function Overloading and Function Overriding. Overloading is the practice of supplying more than one definition for a given function name in the same scope. The compiler is left to pick the appropriate version of the function or operator based on the arguments with which it is called. Overriding refers to the modifications made in the sub class to the inherited methods from the base class to change their behavior.

2. What is Operator overloading ?

When an operator is overloaded, it takes on an additional meaning relative to a certain class. But it can still retain all of its old meanings.Examples:1) The operators >> and << color="#ffffcc">
3. What are Templates ?

C++ Templates allow u to generate families of functions or classes that can operate on a variety of different data types, freeing you from the need to create a separate function or class for each type. Using templates, u have the convenience of writing a single generic function or class definition, which the compiler automatically translates into a specific version of the function or class, for each of the different data types that your program actually uses. Many data structures and algorithms can be defined independently of the type of data they work with. You can increase the amount of shared code by separating data-dependent portions from data-independent portions, and templates were introduced to help you do that.

4. What is the difference between run time binding and compile time binding?

Dynamic Binding :The address of the functions are determined at runtime rather than @ compile time. This is also known as "Late Binding".

Static Binding :The address of the functions are determined at compile time rather than @ run time. This is also known as "Early Binding"

5. What is Difference Between C/C++ ?

C does not have a class/object concept.
C++ provides data abstraction, data encapsulation, Inheritance and Polymorphism.
C++ supports all C syntax.
In C passing value to a function is "Call by Value" whereas in C++ its "Call by Reference"File extension is .c in C while .cpp in C++.(C++ compiler compiles the files with .c extension but C compiler can not!)
In C structures can not have contain functions declarations. In C++ structures are like classes, so declaring functions is legal and allowed.
C++ can have inline/virtual functions for the classes.
c++ is C with Classes hence C++ while in c the closest u can get to an User defined data type is struct and union

6. What will be the output of the following code?

void main ()
{ int i = 0 , a[3] ;
a[i] = i++;
printf ("%d",a[i]) ;

} The output for the above code would be a garbage value. In the statement a[i] = i++; the value of the variable i would get assigned first to a[i] i.e. a[0] and then the value of i would get incremented by 1. Since a[i] i.e. a[1] has not been initialized, a[i] will have a garbage value.

7. Why doesn't the following code give the desired result?

int x = 3000, y = 2000 ;

long int z = x * y ;
Here the multiplication is carried out between two ints x and y, and the result that would overflow would be truncated before being assigned to the variable z of type long int. However, to get the correct output, we should use an explicit cast to force long arithmetic as shown below: long int z = ( long int ) x * y ;
Note that ( long int )( x * y ) would not give the desired effect.

8. Why doesn't the following statement work?

char str[ ] = "Hello" ;
strcat ( str, '!' ) ;
The string function strcat( ) concatenates strings and not a character. The basic difference between a string and a character is that a string is a collection of characters, represented by an array of characters whereas a character is a single character. To make the above statement work writes the statement as shown below:
strcat ( str, "!" ) ;

9. How do I know how many elements an array can hold?

The amount of memory an array can consume depends on the data type of an array. In DOS environment, the amount of memory an array can consume depends on the current memory model (i.e. Tiny, Small, Large, Huge, etc.). In general an array cannot consume more than 64 kb. Consider following program, which shows the maximum number of elements an array of type int, float and char can have in case of Small memory model.

main( )
{
int i[32767] ;
float f[16383] ;
char s[65535] ;
}

10. How do I write code that reads data at memory location specified by segment and offset?

Use peekb( ) function. This function returns byte(s) read from specific segment and offset locations in memory. The following program illustrates use of this function. In this program from VDU memory we have read characters and its attributes of the first row. The information stored in file is then further read and displayed using peek( ) function.


main( )
{

char far *scr = 0xB8000000 ;
FILE *fp ;
int offset ;
char ch ;

if ( ( fp = fopen ( "scr.dat", "wb" ) ) == NULL )
{

printf ( "\nUnable to open file" ) ;
exit( ) ;

}

// reads and writes to file
for ( offset = 0 ; offset < fp =" fopen" offset =" 0">

SYLLABUS

SEMESTER VIII

(Applicable to the students admitted from the Academic year 2006 – 2007 onwards)

To download the syllabus


Click here

IT1402 MOBILE COMPUTING

AIM
To provide basics for various techniques in Mobile Communications and Mobile Content services.

OBJECTIVES
• To learn the basics of Wireless voice and data communications technologies.
• To build working knowledge on various telephone and satellite networks.
• To study the working principles of wireless LAN and its standards.
• To build knowledge on various Mobile Computing algorithms.
• To build skills in working with Wireless application Protocols to develop mobile content applications.

UNIT I WIRELESS COMMUNICATION FUNDAMENTALS
Introduction – Wireless transmission – Frequencies for radio transmission – Signals – Antennas – Signal Propagation – Multiplexing – Modulations – Spread spectrum – MAC – SDMA – FDMA – TDMA – CDMA – Cellular Wireless Networks.

UNIT II TELECOMMUNICATION NETWORKS
Telecommunication systems – GSM – GPRS – DECT – UMTS – IMT-2000 – Satellite Networks - Basics – Parameters and Configurations – Capacity Allocation – FAMA and DAMA – Broadcast Systems – DAB - DVB.

UNIT III WIRLESS LAN
Wireless LAN – IEEE 802.11 - Architecture – services – MAC – Physical layer – IEEE 802.11a - 802.11b standards – HIPERLAN – Blue Tooth.

UNIT IV MOBILE NETWORK LAYER
Mobile IP – Dynamic Host Configuration Protocol - Routing – DSDV – DSR – Alternative Metrics.

UNIT V TRANSPORT AND APPLICATION LAYERS
Traditional TCP – Classical TCP improvements – WAP, WAP 2.0.


TEXT BOOKS
1. Jochen Schiller, “Mobile Communications”, PHI/Pearson Education, Second Edition, 2003.
(Unit I Chap 1,2 &3- Unit II chap 4,5 &6-Unit III Chap 7.Unit IV Chap 8- Unit V Chap 9&10.)
2. William Stallings, “Wireless Communications and Networks”, PHI/Pearson Education, 2002. (Unit I Chapter – 7&10-Unit II Chap 9)

REFERENCES
1. Kaveh Pahlavan, Prasanth Krishnamoorthy, “Principles of Wireless Networks”, PHI/Pearson Education, 2003.
2. Uwe Hansmann, Lothar Merk, Martin S. Nicklons and Thomas Stober, “Principles of Mobile Computing”, Springer, New York, 2003.
3. Hazysztof Wesolowshi, “Mobile Communication Systems”, John Wiley and Sons Ltd, 2002.





CS1020 SOFTWARE QUALITY MANAGEMENT

AIM
To introduce an integrated approach to software development incorporating quality management methodologies.
OBJECTIVE
• Software quality models
• Quality measurement and metrics
• Quality plan, implementation and documentation
• Quality tools including CASE tools
• Quality control and reliability of quality process
• Quality management system models
• Complexity metrics and Customer Satisfaction
• International quality standards – ISO, CMM

UNIT I INTRODUCTION TO SOFTWARE QUALITY
Software Quality – Hierarchical models of Boehm and McCall – Quality measurement – Metrics measurement and analysis – Gilb’s approach – GQM Model

UNIT II SOFTWARE QUALITY ASSURANCE
Quality tasks – SQA plan – Teams – Characteristics – Implementation – Documentation – Reviews and Audits

UNIT III QUALITY CONTROL AND RELIABILITY
Tools for Quality – Ishikawa’s basic tools – CASE tools – Defect prevention and removal – Reliability models – Rayleigh model – Reliability growth models for quality assessment

UNIT IV QUALITY MANAGEMENT SYSTEM
Elements of QMS – Rayleigh model framework – Reliability Growth models for QMS – Complexity metrics and models – Customer satisfaction analysis.

UNIT V QUALITY STANDARDS
Need for standards – ISO 9000 Series – ISO 9000-3 for software development – CMM and CMMI – Six Sigma concepts.


TEXT BOOKS
1. Allan C. Gillies, “Software Quality: Theory and Management”, Thomson Learning, 2003. (UI : Ch 1-4 ; UV : Ch 7-8)
2. Stephen H. Kan, “Metrics and Models in Software Quality Engineering”, Pearson Education (Singapore) Pte Ltd., 2002. (UI : Ch 3-4; UIII : Ch 5-8 ; UIV : Ch 9-11)

REFERENCES
1. Norman E. Fenton and Shari Lawrence Pfleeger, “Software Metrics” Thomson, 2003
2. Mordechai Ben – Menachem and Garry S.Marliss, “Software Quality”, Thomson Asia Pte Ltd, 2003.
3. Mary Beth Chrissis, Mike Konrad and Sandy Shrum, “CMMI”, Pearson Education (Singapore) Pte Ltd, 2003.
4. ISO 9000-3 “Notes for the application of the ISO 9001 Standard to software development”.




GE1301 PROFESSIONAL ETHICS AND HUMAN VALUES

OBJECTIVE
• To create an awareness on Engineering Ethics and Human Values.
• To instill Moral and Social Values and Loyalty
• To appreciate the rights of Others

1. HUMAN VALUES
Morals, Values and Ethics – Integrity – Work Ethic – Service Learning – Civic Virtue – Respect for Others – Living Peacefully – caring – Sharing – Honesty – Courage – Valuing Time – Co-operation – Commitment – Empathy – Self-Confidence – Character – Spirituality

2. ENGINEERING ETHICS
Senses of 'Engineering Ethics' - variety of moral issued - types of inquiry - moral dilemmas - moral autonomy - Kohlberg's theory - Gilligan's theory - consensus and controversy – Models of Professional Roles - theories about right action - Self-interest - customs and religion - uses of ethical theories.

3. ENGINEERING AS SOCIAL EXPERIMENTATION
Engineering as experimentation - engineers as responsible experimenters - codes of ethics - a balanced outlook on law - the challenger case study

4. SAFETY, RESPONSIBILITIES AND RIGHTS
Safety and risk - assessment of safety and risk - risk benefit analysis and reducing risk - the three mile island and chernobyl case studies.
Collegiality and loyalty - respect for authority - collective bargaining - confidentiality - conflicts of interest - occupational crime - professional rights - employee rights - Intellectual Property Rights (IPR) - discrimination.

5. GLOBAL ISSUES
Multinational corporations - Environmental ethics - computer ethics - weapons development - engineers as managers-consulting engineers-engineers as expert witnesses and advisors -moral leadership-sample code of Ethics like ASME, ASCE, IEEE, Institution of Engineers (India), Indian Institute of Materials Management, Institution of electronics and telecommunication engineers (IETE),India, etc.


TEXT BOOK

1. Mike Martin and Roland Schinzinger, “Ethics in Engineering”, McGraw-Hill, New York 1996.
2. Govindarajan M, Natarajan S, Senthil Kumar V. S, “Engineering Ethics”, Prentice Hall of India, New Delhi, 2004.

REFERENCES

1. Charles D. Fleddermann, “Engineering Ethics”, Pearson Education / Prentice Hall, New Jersey, 2004 (Indian Reprint)
2. Charles E Harris, Michael S. Protchard and Michael J Rabins, “Engineering Ethics – Concepts and Cases”, Wadsworth Thompson Learning, United States, 2000 (Indian Reprint now available)
3. John R Boatright, “Ethics and the Conduct of Business”, Pearson Education, New Delhi, 2003.
4. Edmund G Seebauer and Robert L Barry, “Fundamentals of Ethics for Scientists and Engineers”, Oxford University Press, Oxford, 2001.