Programming

  Home  Computer Programming  Programming


“Learn basic programming concepts with hundreds of Interview Questions and Answers with examples.”



102 Programming Questions And Answers

21⟩ What is a modifier explain?

A modifier, also called a modifying function is a member function that changes the value of at least one data member. In other words, an operation that modifies the state of an object. Modifiers are also known as ‘mutators’. Example: The function mod is a modifier in the following code snippet:

class test

{

int x,y;

public:

test()

{

x=0; y=0;

}

void mod()

{

x=10;

y=15;

}

};

 213 views

22⟩ Differentiate between a template class and class template in programming?

Template class: A generic definition or a parametrized class not

instantiated until the client provides the needed information. It’s

jargon for plain templates.

Class template: A class template specifies

how individual classes can be constructed much like the way a class

specifies how individual objects can be constructed. It’s jargon for

plain classes.

 222 views

23⟩ What is a dangling pointer in programming?

A dangling pointer arises when you use the address of an object after

its lifetime is over. This may occur in situations like returning

addresses of the automatic variables from a function or using the

address of the memory block after it is freed. The following

code snippet shows this:

class Sample

{

public:

int *ptr;

Sample(int i)

{

ptr = new int(i);

}

~Sample()

{

delete ptr;

}

void PrintVal()

{

cout << "The value is " << *ptr;

}

};

void SomeFunc(Sample x)

{

cout << "Say i am in someFunc " << endl;

}

int main()

{

Sample s1 = 10;

SomeFunc(s1);

s1.PrintVal();

}In the above example when PrintVal() function is

called it is called by the pointer that has been freed by the

destructor in SomeFunc.

 203 views

25⟩ What are the steps involved in designing in programming?

Before getting into the design the designer should go through the SRS prepared by the System Analyst. The main tasks of design are Architectural Design and Detailed Design. In Architectural Design we find what are the main modules in the problem domains Detailed Design we find what should be done within each module.

 206 views

26⟩ What do you mean by programming analysis and design?

Analysis: It is the process of determining what needs to be done before how it should be done. In order to accomplish this, the developer refers the existing systems and documents. So, simply it is an art of discovery.

Design:It is the process of adopting/choosing the one among the many, which best accomplishes the users needs. So, simply, it is compromising mechanism.

 206 views

27⟩ What do you meant by active and passive objects?

Active objects are one which instigate an interaction which owns a thread and they are responsible for handling control to other objects. In simple words it can be referred as client.

Passive objects are one, which passively waits for the message to be processed. It waits for another object that requires its services. In simple words it can be referred as server.

 254 views

28⟩ What do you meant by static and dynamic modeling in programming?

Static modeling is used to specify structure of the objects that exist in the problem domain. These are expressed using class, object and USECASE diagrams. But Dynamic modeling refers representing the object interactions during runtime. It is represented by sequence, activity, collaboration and statechart diagrams

 417 views

29⟩ What is meant by software development method?

Software development method describes how to model and build software systems in a reliable and reproducible way. To put it simple, methods that are used to represent ones’ thinking using graphical notations.

 232 views

30⟩ Differentiate persistent & non-persistent programming objects?

Persistent refers to an object’s ability to transcend time or space. A persistent object stores/saves its state in a permanent storage system with out losing the information represented by the object.

A non-persistent object is said to be transient or ephemeral. By default objects are considered as non-persistent.

 226 views

31⟩ Why generalization is very strong in programming?

Even though Generalization satisfies Structural, Interface, Behaviour properties. It is mathematically very strong, as it is Antisymmetric and Transitive. Antisymmetric: employee is a person, but not all persons are employees. Mathematically all As’ are B, but all Bs’ not A.

 207 views

32⟩ What do you meant by “SBI” of an object in programming?

SBI stands for State, Behavior and Identity. Since every object has the above three.

State:

It is just a value to the attribute of an object at a particular time.

Behaviour:

It describes the actions and their reactions of that object.

Identity:

An object has an identity that characterizes its own existence. The identity makes it possible to distinguish any object in an unambiguous way, and independently from its state.

 208 views

36⟩ What is Python and what is scope of Python?

Python is an interpreted, interactive, object-oriented programming language. It is often compared to Tcl, P e r l, Scheme or Java.

Python combines remarkable power with very clear syntax. It has modules, classes, exceptions, very high level dynamic data types, and dynamic typing. There are interfaces to many system calls and libraries, as well as to various windowing systems (X11, Motif, Tk, Mac, MFC, wxWidgets). New built-in modules are easily written in C or C++. Python is also usable as an extension language for applications that need a programmable interface.

The Python implementation is portable: it runs on many brands of UNIX, on Windows, OS/2, Mac, Amiga, and many other platforms.

The Python implementation is copyrighted but freely usable and distributable, even for commercial use.

 204 views

39⟩ What is meant by “method-wars” in Programming?

Before 1994 there were different methodologies like Rumbaugh, Booch, Jacobson, Meyer etc who followed their own notations to model the systems.

The developers were in a dilemma to choose the method which best accomplishes their needs. This particular span was called as “method-wars”

 207 views

40⟩ What are inner class and anonymous class concept in Programming?

Inner class in Programming:

classes defined in other classes, including those defined in methods are called inner classes. An inner class can have any accessibility including private.

Anonymous class in Programming:

Anonymous class is a class defined inside a method without a name and is instantiated and declared in the same place and cannot have explicit constructors.

 215 views