Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
What is QTP?
QTP is one of the good automation tool which supports graphical interface record-playback.
Quick Test enables you to test standard web and Windows applications.
What are the Features & Benefits of QTP?
QTP should operate as standalone tool and integrated into Mercury Business Process Testing
and Mercury Quality Center.
Testing results could be automatically fed into a database that may provide useful statistics on
how good the software testing is going.
It provides Key word driven testing.
QTP Identifies objects with Unique Smart Object Recognition, even if they change from build
to build.
By using QTP, Test execution time and cost will reduce.
What are the different scripting languages you could use when working with QTP?
Visual Basic (VB),XML,JavaScript,Java,HTML
What is the file extension of the code file & object repository file in QTP?
Code files extension is.vbs.
Object repository file extension is.tsr
What is Object Spy in QTP?
The Object Spy displays the selected objects hierarchy tree, properties and values in the
Properties tab of the Object Spy dialog box.
Using the Object Spy, you can view the properties of any object in an open application. You use
the Object Spy pointer to point to an object.
QTP testing process consists of 6 main categories:
Create test plan
Before automating there should be a detailed description of the test including the exact steps to
follow, data to be input, and all items to be verified by the test. The verification information
should include both data validations and existence or state verifications of objects in the
application.
Recording a session on the application
As you navigate through your application, Quick Test graphically displays each step you perform
in the form of a collapsible icon-based test tree. A step is any user action that causes or makes a
change in your site, such as clicking a link or image, or entering data in a form.
Enhancing test
Inserting checkpoints into your test lets you search for a specific value of a page, object or text
string, which helps you identify whether or not your application is functioning correctly. NOTE:
Checkpoints can be added to a test as you record it or after the fact via the Active Screen. It is
much easier and faster to add the checkpoints during the recording process. Broadening the
scope of your test by replacing fixed values with parameters lets you check how your application
performs the same operations with multiple sets of data. Adding logic and conditional statements
to your test enables you to add sophisticated checks to your test.
Debugging test
if any changes were made to the script, you need to debug it to check that it operates smoothly
and without interruption.
Running your test on a new version of your application
you run a test to check the behavior of your application. While running, Quick Test connects to
your application and
performs each step in your test.
Analyzing the test results
You examine the test results to pinpoint defects in your application.
Reporting defects
As you encounter failures in the application when analyzing test results, you will create defect
reports in Defect Reporting Tool.
Networking Questions
1.What do you mean by data communication?
Ans: It is the exchange of data between two devices via some form of transmission medium such
as wire cable. The communicating system must be part of a communication system made up of a
combination of hardware and software.The effectiveness of a data communication system
depends on three fundamental characteristics: delivery, accuracy and timeliness.
2.What is simplex?
Ans: It is the mode of communication between two devices in which flow of data is
unidirectional. i.e. one can transmit and other can receive.
E.g. keyboard and monitor.
3.What is half-duplex?
Ans: It is the mode of communication between two devices in which flow of data is bidirectional but not at the same time. ie each station can transmit and receive but not at the same
time.
E.g walkie-talkies are half-duplex system.
4.What is full duplex?
Ans: It is the mode of communication between two devices in which flow of data is bidirectional and it occurs simultaneously. Here signals going in either direction share the capacity
of the link.
E.g. telephone
5.What is a network?
Ans: It is a set of devices connected by communication links. A node can be a computer or any
other device capable of sending and/or receiving data generated by other nodes on the network.
6.What is distributed processing?
Ans: It is a strategy in which services provided by the network reside at multiple sites.
7.What is point to point connection?
Ans:It provides a dedicated link between two devices. The entire capacity of the link is reserved
for transmission between the two devices
e.g. when we change the TV channels by remote control we establish a point to point connection
between remote control and TV control system.
8.What is multipoint connection?
Ans: In multipoint connection more than two specific devices share a single link.
Here the capacity of the channel is shared either separately or temporally.
9.What is a topology?
Ans: Topology of a network is defined as the geometric representation of the relationship of all
the links and linking devices (node) to one another.Four basic topologies are star, bus, ring and
mesh.
Star Here each device has a dedicated point to point link only to a central controller called hub.
Bus -It is multipoint. One long cable acts as a backbone to link all the devices in the network.
Ring -Here each device has a dedicated point to point connection only with the two devices on
either side of it.
Mesh -Here every device has a dedicated point to point link to every other device.
10.Define LAN, MAN and WAN.
Ans: LAN- A local area network (LAN) is a privately owned and links the devices in a single
office, building or campus.
It allows resources to be shared between personal computers and work stations.
MAN- A metropolitan-area network (MAN) spreads over an entire city.
It may be wholly owned and operated by a private company, eg local telephone company.
WAN A wide area network (WAN) provides long distance transmission of data, voice, image
and video information over large geographic areas that comprise a country, a continent or even
whole world.
11.Define internet?
Ans: It is a network of networks.
12.What is a protocol?
Ans: It is a set of rules that governs data communication. A protocol defines what is
communicated, how it is communicated, and when it is communicated. The key elements of
protocol are syntax, semantics and timing.
13.What is TCP/IP protocol model?
Ans: It is a five layered model which provides guidelines for the development of universally
compatible networking protocols.
The five layers are physical, data link, network, transport and application.
14.Describe the functions of five layers?
Ans: Physical- It transmits raw bits over a medium. It provides mechanical and electrical
specification.
Data link- It organizes bits into frames. It provides hop to hop delivery.
Network-It moves the packets from source to destination.It provide internetworking.
Transport-It provides reliable process to process message delivery and error recovery.
Application-It allows ti access to network resources.
78.What is Gateway ?
Ans: It is a protocol converter.A gateway can accept a packet formatted for one protocol and
convert it to a packet formatted for another protocol.It operates on all the seven layers of OSI
model.
79.What do you mean by Data Terminal Equipment(DTE) ?
Ans: It is any device that is source of or destination for binary digital data.At phycal layer it can
be a terminal computer. They generate or consume information.
80.What do you mean by Data Terminating Equipment (DCE) ?
Ans: Data circuit terminating equipment includes any functional unit that transmit or receives
data in the form of an analog or digital signal through a network.DTE generates digital data and
passes them to a DCE ,the DCE converts the data to a form acceptable to the transmission media
and sends the converted signal to another DCE on the network.
81.What do you mean by protocol stack ?
Ans: The list of protocols used by certain system ,one protocol per layer is called protocol stack.
82.What do you mean by peer ?
Ans: Entities comprising the corresponding layers on different machines are called peers.It may
be
hardware device.
processes
human being
peers communicate by using protocol.
83.What do you mean by broadcasting ?
Ans: Broadcast system allow addressing a packet to all destination by using a special code in
address field.when packet is transmitted it is received and processed by every machine on the
network.
84.What are the advantages of broadcast network.
Ans:
a single communication channel is shared by all computers.
packets are transmitted and received by all the computer.
address field is attached to whom it is intended.
multicasting is used in network.
85.What do you mean by point to point network?
Ans: Point to point network consist of many connections between individual pair of
machines.large networks are point to point.Routing algorithm plays an important in point to
point network.It uses stored ad forword technique.It is a packet switching network.
93.What are the information that a computer attached to a TCP/IP internet must possesses
?
Ans: Each computer attached to TCP/IP must possesses the following information
Its IP addesss
Its subnet mask
The IP addesss of the router.
The Ip address of the name server.
94.What is domain name system(DNS)?
Ans: Domain Name System (DNS )is a client server application that identifies each host on the
internet with a unique user friendly name.
95.What is TELNET ?
Ans: TELNET is a client server application that allows a user to log on to a remote
machine,giving the user access to the remote system. TELNET is an abbreviation of terminal
Network.
96.What do you mean by local login and remote login ?
Ans: When a user logs into a local time-sharing system ,it is called local login. When a user
wants to access an application program or utility located on a remote machine,he or she performs
remote login.
97.What is Network Virtual Terminal ?
Ans: A universal interface provided by TELNET is called Network Virtual Terminal(NVT)
character set.Via this interface TELNET translates characters (data or command) that come from
local terminal into NVT form and delivers them to the network.
98.What do you mean by Simple Mail Transfer Protocol ?
Ans: The TCP/IP protocol that supports electronic mail on the internet is called Simple Mail
Transfer Protocol.SMTP provides for mail exchange between users on the same or different
computer and supports Sending a single message to one or more recipient Sending message that
include text, voice,video,or graphics.Sending message to users on network outside the internet.
99.What is Hypertext Transfer Protocol(HTTP) ?
Ans: It is the main protocol used to access data on the World Wide Web .the protol transfers data
in the form of plain text,hypertext,audio,video,and so on. It is so called because its efficiency
allows its use in a hypertext environment where there are rapid jumps from one document to
another.
100.What is URL ?
Ans: It is a standard for specifying any kind of information on the World Wide Web.
C Language Questions
1. What does static variable mean?
Ans: Static variables are the variables which retain their values between the function calls. They
are initialized only once their scope is within the function in which they are defined.
2. What is a pointer?
Ans: Pointers are variables which stores the address of another variable. That variable may be a
scalar (including another pointer), or an aggregate (array or structure). The pointed-to object may
be part of a larger object, such as a field of a structure or an element in an array.
3. What are the uses of a pointer?
Ans: Pointer is used in the following cases
i) It is used to access array elements
ii) It is used for dynamic memory allocation.
iii) It is used in Call by reference
iv) It is used in data structures like trees, graph, linked list etc.
4. What is a structure?
Ans: Structure constitutes a super data type which represents several different data types in a
single unit. A structure can be initialized if it is static or global.
5. What is a union?
Ans: Union is a collection of heterogeneous data type but it uses efficient memory utilization
technique by allocating enough memory to hold the largest member. Here a single area of
memory contains values of different types at different time. A union can never be initialized.
6. What are the differences between structures and union?
Ans: A structure variable contains each of the named members, and its size is large enough to
hold all the members. Structure elements are of same size.
A union contains one of the named members at a given time and is large enough to hold the
largest member. Union element can be of different sizes.
7. What are the differences between structures and arrays?
Ans: Structure is a collection of heterogeneous data type but array is a collection of
homogeneous data types.
Array
1-It is a collection of data items of same data type.
2-It has declaration only
3-.There is no keyword.
4- array name represent the address of the starting element.
Structure
1-It is a collection of data items of different data type.
2- It has declaration and definition
3- keyword struct is used
4-Structure name is known as tag it is the short hand notation of the declaration.
14. Where does global, static, and local, register variables, free memory and C Program
instructions get stored?
Ans: Global: Wherever the linker puts them. Typically the BSS segment on many platforms.
Static: Again, wherever the linker puts them. Often, theyre intermixed with the globals. The
only difference between globals and statics is whether the linker will resolve the symbols across
compilation units.Local: Typically on the stack, unless the variable gets register allocated and
never spills.Register: Nowadays, these are equivalent to Local variables. They live on the stack
unless they get register-allocated.
15. Difference between arrays and linked list?
Ans: An array is a repeated pattern of variables in contiguous storage. A linked list is a set of
structures scattered through memory, held together by pointers in each element that point to the
next element. With an array, we can (on most architectures) move from one element to the next
by adding a fixed constant to the integer value of the pointer. With a linked list, there is a next
pointer in each structure which says what element comes next.
16. What are enumerations?
Ans: They are a list of named integer-valued constants. Example:enum color { black , orange=4,
yellow, green, blue, violet };This declaration defines the symbols black, orange, yellow,
etc. to have the values 1, 4, 5, etc. The difference between an enumeration and a macro
is that the enum actually declares a type, and therefore can be type checked.
17. Describe about storage allocation and scope of global, extern, static, local and register
variables?
Ans:
Globals have application-scope. Theyre available in any compilation unit that includes an
appropriate declaration (usually brought from a header file). Theyre stored wherever the linker
puts them, usually a place called the BSS segment.
Extern? This is essentially global.
Static: Stored the same place as globals, typically, but only available to the compilation unit that
contains them. If they are block-scope global, only available within that block and its subblocks.
Local: Stored on the stack, typically. Only available in that block and its subblocks.
(Although pointers to locals can be passed to functions invoked from within a scope where that
local is valid.)
Register: See tirade above on local vs. register. The only difference is that
the C compiler will not let you take the address of something youve declared as register.
18. What are register variables? What are the advantages of using register variables?
Ans: If a variable is declared with a register storage class,it is known as register variable.The
register variable is stored in the cpu register instead of main memory.Frequently used variables
are declared as register variable as its access time is faster.
19. What is the use of typedef?
Ans: The typedef help in easier modification when the programs are ported to another machine.
A descriptive new name given to the existing data type may be easier to understand the code.
20. Can we specify variable field width in a scanf() format string? If possible how?
Ans: All field widths are variable with scanf(). You can specify a maximum field width for a
given
field by placing an integer value between the % and the field type specifier. (e.g. %64s). Such a
specifier will still accept a narrower field width.
The one exception is %#c (where # is an integer). This reads EXACTLY # characters, and it is
the
only way to specify a fixed field width with scanf().
21. Out of fgets() and gets() which function is safe to use and why?
Ans: fgets() is safer than gets(), because we can specify a maximum input length. Neither one is
completely safe, because the compiler cant prove that programmer wont overflow the buffer he
pass to fgets ().
22. Difference between strdup and strcpy?
Ans: Both copy a string. strcpy wants a buffer to copy into. strdup allocates a buffer using
malloc().
Unlike strcpy(), strdup() is not specified by ANSI .
23. What is recursion?
Ans: A recursion function is one which calls itself either directly or indirectly it must halt at a
definite point to avoid infinite recursion.
24. Differentiate between for loop and a while loop? What are it uses?
Ans: For executing a set of statements fixed number of times we use for loop while when the
number of
iterations to be performed is not known in advance we use while loop.
25. What is storage class? What are the different storage classes in C?
Ans: Storage class is an attribute that changes the behavior of a variable. It controls the lifetime,
scope and linkage. The storage classes in c are auto, register, and extern, static, typedef.
26. What the advantages of using Unions?
Ans: When the C compiler is allocating memory for unions it will always reserve enough room
for the
largest member.
27. What is the difference between Strings and Arrays?
Ans: String is a sequence of characters ending with NULL .it can be treated as a one dimensional
array
of characters terminated by a NULL character.
35. What does the error Null Pointer Assignment means and what causes this error?
Ans: As null pointer points to nothing so accessing a uninitialized pointer or invalid location
may cause an error.
36. What is generic pointer in C?
Ans: In C void* acts as a generic pointer. When other pointer types are assigned to generic
pointer,
conversions are applied automatically (implicit conversion).
37. Are the expressions arr and &arr same for an array of integers?
Ans: Yes for array of integers they are same.
38. IMP>How pointer variables are initialized?
Ans: Pointer variables are initialized by one of the following ways.
I. Static memory allocation
II. Dynamic memory allocation
39. What is static memory allocation?
Ans: Compiler allocates memory space for a declared variable. By using the address of operator,
the
reserved address is obtained and this address is assigned to a pointer variable. This way of
assigning pointer value to a pointer variable at compilation time is known as static memory
allocation.
40. What is dynamic memory allocation?
Ans: A dynamic memory allocation uses functions such as malloc() or calloc() to get memory
dynamically. If these functions are used to get memory dynamically and the values returned by
these function are assigned to pointer variables, such a way of allocating memory at run time is
known as dynamic memory allocation.
41. What is the purpose of realloc?
Ans: It increases or decreases the size of dynamically allocated array. The function realloc
(ptr,n) uses two arguments. The first argument ptr is a pointer to a block of memory for which
the size is to be altered. The second argument specifies the new size. The size may be increased
or decreased. If sufficient space is not available to the old region the function may create a new
region.
42. What is pointer to a pointer?
Ans: If a pointer variable points another pointer value. Such a situation is known as a pointer to a
pointer.
Example:
int *p1,**p2,v=10;
P1=&v; p2=&p1;
Here p2 is a pointer to a pointer.
68. What are bit fields? What is the use of bit fields in a Structure declaration?
Ans: A bit field is a set of adjacent bits within a single implementation based storage unit that we
will call a word.
The syntax of field definition and access is based on structure.
Struct {
unsigned int k :1;
unsigned int l :1;
unsigned int m :1;
}flags;
the number following the colon represents the field width in bits.Flag is a variable that contains
three bit fields.
69. What is a preprocessor, what are the advantages of preprocessor?
Ans: A preprocessor processes the source code program before it passes through the compiler.
1- a preprocessor involves the readability of program
2- It facilitates easier modification
3- It helps in writing portable programs
4- It enables easier debugging
5- It enables testing a part of program
6- It helps in developing generalized program
70. What are the facilities provided by preprocessor?
Ans:
1-file inclusion
2-substitution facility
3-conditional compilation
71. What are the two forms of #include directive?
Ans:
1.#includefilename
2.#include
the first form is used to search the directory that contains the source file.If the search fails in the
home directory it searches the implementation defined locations.In the second form ,the
preprocessor searches the file only in the implementation defined locations.
72. How would you use the functions randomize() and random()?
Ans:
Randomize() initiates random number generation with a random value.
Random() generates random number between 0 and n-1;
73. What do the functions atoi(), itoa() and gcvt() do?
Ans:
atoi() is a macro that converts integer to character.
itoa() It converts an integer to string
gcvt() It converts a floating point number to string
74. How would you use the functions fseek(), freed(), fwrite() and ftell()?
Ans:
fseek(f,1,i) Move the pointer for file f a distance 1 byte from location i.
fread(s,i1,i2,f) Enter i2 dataitems,each of size i1 bytes,from file f to string s.
fwrite(s,i1,i2,f) send i2 data items,each of size i1 bytes from string s to file f.
ftell(f) Return the current pointer position within file f.
The data type returned for functions fread,fseek and fwrite is int and ftell is long int.
75. What is the difference between the functions memmove() and memcpy()?
Ans: The arguments of memmove() can overlap in memory. The arguments of memcpy()
cannot.
76. What is a file?
Ans: A file is a region of storage in hard disks or in auxiliary storage devices.It contains bytes of
information .It is not a data type.
77. IMP>what are the types of file?
Ans: Files are of two types
1-high level files (stream oriented files) :These files are accessed using library functions
2-low level files(system oriented files) :These files are accessed using system calls
78. IMP>what is a stream?
Ans: A stream is a source of data or destination of data that may be associated with a disk or
other
I/O device. The source stream provides data to a program and it is known as input stream. The
destination stream eceives the output from the program and is known as output stream.
79. What is meant by file opening?
Ans: The action of connecting a program to a file is called opening of a file. This requires
creating
an I/O stream before reading or writing the data.
80. What is FILE?
Ans: FILE is a predefined data type. It is defined in stdio.h file.
81. What is a file pointer?
Ans: The pointer to a FILE data type is called as a stream pointer or a file pointer. A file pointer
points to the block of information of the stream that had just been opened.
93. Is the allocated space within a function automatically deallocated when the function
returns?
Ans: No pointer is different from what it points to .Local variables including local pointers
variables in a function are deallocated automatically when function returns.,But in case of a
local pointer variable ,deallocation means that the pointer is deallocated and not the block of
memory allocated to it. Memory dynamically allocated always persists until the allocation is
freed
or the program terminates.
94. Discuss on pointer arithmetic?
Ans:
1- Assignment of pointers to the same type of pointers.
2- Adding or subtracting a pointer and an integer.
3-subtracting or comparing two pointer.
4-incrementing or decrementing the pointers pointing to the elements of an array. When a pointer
to an integer is incremented by one , the address is incremented by two. It is done automatically
by the compiler.
5-Assigning the value 0 to the pointer variable and comparing 0 with the pointer. The pointer
having address 0 points to nowhere at all.
95. What is the invalid pointer arithmetic?
Ans:
i) adding ,multiplying and dividing two pointers.
ii) Shifting or masking pointer.
iii) Addition of float or double to pointer.
iv) Assignment of a pointer of one type to a pointer of another type ?
96. What are the advantages of using array of pointers to string instead of an array of
strings?
Ans:
i) Efficient use of memory.
ii) Easier to exchange the strings by moving their pointers while sorting.
97. Are the expressions *ptr ++ and ++ *ptr same?
Ans: No,*ptr ++ increments pointer and not the value pointed by it. Whereas ++ *ptr
increments the value being pointed to by ptr.
98. What would be the equivalent pointer expression foe referring the same element as
a[p][q][r][s] ?
Ans : *( * ( * ( * (a+p) + q ) + r ) + s)
99. Are the variables argc and argv are always local to main?
Ans: Yes they are local to main.
100. Can main () be called recursively?
Ans: Yes any function including main () can be called recursively.
C++ Questions
1. What is a class?
Ans: The objects with the same data structure (attributes) and behavior (operations) are called
class.
2. What is an object?
Ans: It is an entity which may correspond to real-world entities such as students, employees,
bank account. It may be concrete such as file system or conceptual such as scheduling policies in
multiprocessor operating system.
Every object will have data structures called attributes and behavior called operations.
3. What is the difference between an object and a class?
Ans: All objects possessing similar properties are grouped into class.
Example :person is a class, ram, hari are objects of person class. All have similar attributes like
name, age, sex and similar operations like speak, walk.
Class person
{
private:
char name[20];
int age;
char sex;
public: speak();
walk();
};
4. What is the difference between class and structure?
Ans: In class the data members by default are private but in structure they are by default public
5. Define object based programming language?
Ans: Object based programming language support encapsulation and object identity without
supporting some important features of OOPs language.
Object based language=Encapsulation + object Identity
6. Define object oriented language?
Ans: Object-oriented language incorporates all the features of object based programming
languages along with inheritance and polymorphism.
Example: c++, java.
7. Define OOPs?
Ans: OOP is a method of implementation in which programs are organized as co-operative
collection of objects, each of which represents an instance of some class and whose classes are
all member of a hierarchy of classes united through the property of inheritance.
17. What is the difference between method overloading and method overriding?
Ans: Overloading a method (or function) in C++ is the ability for functions of the same name to
be defined as long as these methods have different signatures (different set of parameters).
Method overriding is the ability of the inherited class rewriting the virtual method of the base
class.
18. What are the defining traits of an object-oriented language?
The defining traits of an object-oriented language are:
encapsulation
inheritance
polymorphism
Ans:
Polymorphism: is a feature of OOPL that at run time depending upon the type of object the
appropriate method is called.
Inheritance: is a feature of OOPL that represents the is a relationship between different
objects (classes). Say in real life a manager is a employee. So in OOPL manger class is inherited
from the employee class.
Encapsulation: is a feature of OOPL that is used to hide the information.
19. What is polymorphism?
Ans: Polymorphism is the idea that a base class can be inherited by several classes. A base class
pointer can point to its child class and a base class array can store different child class objects.
20. What do you mean by inline function?
Ans: An inline function is a function that is expanded inline when invoked.ie. the compiler
replaces the function call with the corresponding function code. An inline function is a function
that is expanded in line when it is invoked. That is the compiler replaces the function call with
the corresponding function code (similar to macro).
21 What is the difference between a NULL pointer and a void pointer?
Ans: A NULL pointer is a pointer of any type whose value is zero. A void pointer is a pointer to
an object of an unknown type, and is guaranteed to have enough bits to hold a pointer to any
object. A void pointer is not guaranteed to have enough bits to point to a function (though in
general practice it does).
22. What is difference between C++ and Java?
Ans: C++ has pointers Java does not.
Java is platform independent C++ is not.
Java has garbage collection C++ does not.
23. What do you mean by multiple inheritance in C++ ?
Ans: Multiple inheritance is a feature in C++ by which one class can be of different types. Say
class teaching Assistant is inherited from two classes say teacher and Student.
39. What is a container class? What are the types of container classes?
Ans: A container class is a class that is used to hold objects in memory or external storage. A
container class acts as a generic holder. A container class has a predefined behavior and a wellknown interface. A container class is a supporting class whose purpose is to hide the topology
used for maintaining the list of objects in memory. When a container class contains a group of
mixed objects, the container is called a heterogeneous container; when the container is holding a
group of objects that are all the same, the container is called a homogeneous container
40. Name some pure object oriented languages?
Ans: Smalltalk, Java, Eiffel, Sather.
41. Name the operators that cannot be overloaded?
Ans: sizeof, ., .*, .->, ::, ?:
42. What is an adaptor class or Wrapper class?
Ans: A class that has no functionality of its own. Its member functions hide the use of a third
party software component or an object with the non-compatible interface or a non-objectoriented implementation.
43. What is a Null object?
Ans: It is an object of some class whose purpose is to indicate that a real object of that class does
not exist. One common use for a null object is a return value from a member function that is
supposed to return an object with some specified properties but cannot find such an object.
44. What is class invariant?
Ans: A class invariant is a condition that defines all valid states for an object. It is a logical
condition to ensure the correct working of a class. Class invariants must hold when an object is
created, and they must be preserved under all operations of the class. In particular all class
invariants are both preconditions and post-conditions for all operations or member functions of
the class.
45. What is a dangling pointer?
Ans: 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. Example: 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.
46. Differentiate between the message and method?
Ans:
Message:
Objects communicate by sending messages to each other.
A message is sent to invoke a method.
Method
Provides response to a message and it is an implementation of an operation
47. How can we access protected and private members of a class?
Ans: In the case of members protected and private, these could not be accessed from outside the
same class at which they are declared. This rule can be transgressed with the use of the friend
keyword in a class, so we can allow an external function to gain access to the protected and
private members of a class.
48. Can you handle exception in C++?
Ans: Yes we can handle exception in C++ using keyword: try, catch and throw. Program
statements that we want to monitor for exceptions are contained in a try block. If an exception
occurs within the try block, it is thrown (using throw).The exception is caught, using catch, and
processed.
49. What is virtual function?
Ans: A virtual function is a member function that is declared within a base class and
redefined by a derived class .To create a virtual function, the function declaration in the base
class is preceded by the keyword virtual.
35. What are the notations used in Evaluation of Arithmetic Expressions using prefix and
postfix forms?
Ans: Polish and Reverse Polish notations.
36. Convert the expression ((A + B) * C (D E) ^ (F + G)) to equivalent Prefix and
Postfix notations.
Ans: Prefix Notation:
^ * +ABC DE + FG
Postfix Notation:
AB + C * DE FG + ^
37. Sorting is not possible by using which of the following methods?
(a) Insertion
(b) Selection
(c) Exchange
(d) Deletion
Ans: (d) Deletion.
Using insertion we can perform insertion sort, using selection we can perform selection sort,
using exchange we can perform the bubble sort (and other similar sorting methods). But no
sorting method can be done just using deletion.
38. List out few of the Application of tree data-structure?
Ans:
The manipulation of Arithmetic expression,
Symbol Table construction,
Syntax analysis.
39. List out few of the applications that make use of Multilinked Structures?
Ans: Sparse matrix, Index generation.
40. in tree construction which is the suitable efficient data structure?
(A) Array (b) Linked list (c) Stack (d) Queue (e) none
Ans: (b) Linked list
41. What is the type of the algorithm used in solving the 8 Queens problem?
Ans: Backtracking
42. In an AVL tree, at what condition the balancing is to be done?
Ans: If the pivotal value (or the Height factor) is greater than 1 or less than 1.
43. There are 8, 15, 13, 14 nodes were there in 4 different trees. Which of them could have
formed a full binary tree?
Ans: 15
In general:
There are 2n-1 nodes in a full binary tree.
By the method of elimination:
Full binary trees contain odd number of nodes. So there cannot be full binary trees with 8 or 14
nodes, so rejected. With 13 nodes you can form a complete binary tree but not a full binary tree.
So the correct answer is 15.
Note: Full and Complete binary trees are different. All full binary trees are complete binary trees
but not vice versa.
44. In RDBMS, what is the efficient data structure used in the internal storage
representation?
Ans: B+ tree. Because in B+ tree, all the data is stored only in leaf nodes, that makes searching
easier. This corresponds to the records that shall
be stored in leaf nodes.
45. One of the following tree structures, which is, efficient considering space and time
complexities?
a) Incomplete Binary Tree.
b) Complete Binary Tree.
c) Full Binary Tree.
Ans:
b) Complete Binary Tree.
By the method of elimination:
Full binary tree loses its nature when operations of insertions and deletions are done. For
incomplete binary trees,
extra property of complete binary tree is maintained even after operations like additions and
deletions are done on it.
46. What is a spanning Tree?
Ans: A spanning tree is a tree associated with a network. All the nodes of the graph appear on
the tree once. A minimum spanning tree is a spanning tree organized so that the total edge weight
between nodes is minimized.
47. Does the minimum spanning tree of a graph give the shortest distance between any 2
specified nodes?
Ans: No.
Minimal spanning tree assures that the total weight of the tree is kept at its minimum. But it
doesnt mean that the distance between any two nodes involved in the minimum-spanning tree is
minimum.
48. Whether Linked List is linear or Non-linear data structure?
Ans: According to Storage Linked List is a Non-linear one.
DBMS Questions
1.What is a Database?
Ans: A database is a collection of related data .A database is a logically coherent
collection of data with some inherent meaning.
2. What is DBMS?
Ans: Database Management system is a collection of programs that enables user to create and
maintain a database.
Thus a DBMS is a general purposed s/w system that facilitates the process of defining
constructing and manipulating a database for various applications. (Defining a data base involves
specifying the data types, structures and constraints for the data to be stored in the data database.
Constructing a data base is the process of storing data itself on some storage medium that is
controlled by DBMS. Manipulating a database includes such functions as querying the data base
to retrieve specific data, updating the database to reflect the changes in the mini-world.
3. What is a Catalog?
Ans: A catalog is a table that contain the information such as structure of each file ,
the type and storage format of each data item and various constraints on the data .
The information stored in the catalog is called Metadata . Whenever a request is
made to access a particular data, the DBMS s/w refers to the catalog to determine
the structure of the file.
4. What is data ware housing & OLAP?
Ans: Data warehousing and OLAP (online analytical processing ) systems are the
techniques used in many companies to extract and analyze useful information
from very large databases for decision making .
5. What is real time database technology?
Ans: These are all the techniques used in controlling industrial and manufacturing
processes.
6. What is program-data independence?
Ans: Unlike in the traditional file sys. the structure of the data files is stored in the
DBMS catalog separately from the access programs . This property is called
program-data independence.i.e. We neednt to change the code of the DBMS if the
structure of the data is changed .Which is not supported by traditional file sys .
7. What is ORDBMS?
Ans: Object oriented RDBMS is a relational DBMS in which every thing is treated as
objects. User can define operations on data as a part of the database definition.
Referential integrity constraints states that a tuple in one relation that refers to another relation
must refer to an existing tuple in that relation it is specified between two relations and is used to
maintain the consistency among tuples of the two relations.
44. What is difference between a super key, a key, a candidate key and a primary key?
Ans: A super key specifies a uniqueness constrain that no two distinct tuples in a state
can have the same value for the super key. Every relation has at least one default super key.
A key is a minimal super key or the subset of the super key which is obtained after
removing redundancy. A relation schema may have more than one key .In this case
each key is called a candidate key. One of the candidate key with minimum number
of attributes is chosen as primary key.
45. What is a foreign key?
Ans: A key of a relation schema is called as a foreign key if it is the primary key of
some other relation to which it is related to.
46. What is a transaction?
Ans: A transaction is a logical unit of database processing that includes one or more
database access operations.
47. What are the properties of transaction?
Ans:
1. Atomicity
2. Consistency preservation
3. Isolation
4. Durability (permanence)
48. What are the basic data base operations?
Ans:
1. Write_item(x)
2. Read_item(x)
49. What are the disadvantages of not controlling concurrency?
Ans:
1. Lost update problem
2. Temporary update(Dirty read) problem
3. Incorrect summary problem
50. What are serial, non serial?
Ans: A schedule S is serial if, for every transaction T participating in the schedule, all the
operations of T is executed consecutively in the schedule, otherwise, the schedule is called nonserial schedule.
51. What are conflict serializable schedules?
Ans: A schedule S of n transactions is serializable if it is equivalent to some serial schedule of
the same n transactions.
system calls the kernel is engaged completely to the single user thread blocking other processes.
They are created in user space.Kernel threads are supported directly by the operating system.
They are slower to create and manage. Most of the OS like Windows NT, Windows 2000,
Solaris2, BeOS, and Tru64 Unix support kernel threading.
39.Which category the java thread do fall in?
Ans: Java threads are created and managed by the java virtual machine, they do not easily fall
under the category of either user or kernel thread
40.What are multithreading models?
Ans: Many OS provide both kernel threading and user threading. They are called multithreading
models. They are of three types:
1. Many-to-one model (many user level thread and one kernel thread).
2. One-to-one model
3. Many-to many
In the first model only one user can access the kernel thread by not allowing multi-processing.
Example: Green threads of Solaris.The second model allows multiple threads to run on parallel
processing systems. Creating user thread needs to create corresponding kernel thread
(disadvantage).Example: Windows NT, Windows 2000, OS/2.The third model allows the user to
create as many threads as necessary and the corresponding kernel threads can run in parallel on a
multiprocessor.
Example: Solaris2, IRIX, HP-UX, and Tru64 Unix.
41.What is a P-thread?
Ans: P-thread refers to the POSIX standard (IEEE 1003.1c) defining an API for thread creation
and synchronization. This is a specification for thread behavior, not an implementation. The
windows OS have generally not supported the P-threads.
42.What are java threads?
Ans: Java is one of the small number of languages that support at the language level for the
creation and management of threads. However, because threads are managed by the java virtual
machine (JVM), not by a user-level library or kernel, it is difficult to classify Java threads as
either user- or kernel-level.
43.What is process synchronization?
Ans: A situation, where several processes access and manipulate the same data concurrently and
the outcome of the execution depends on the particular order in which the access takes place, is
called race condition. To guard against the race condition we need to ensure that only one
process at a time can be manipulating
the same data. The technique we use for this is called process synchronization.
44.What is critical section problem?
Ans: Critical section is the code segment of a process in which the process may be changing
common variables, updating tables, writing a file and so on. Only one process is allowed to go
into critical section at any given time (mutually exclusive).The critical section problem is to
design a protocol that the processes can use to
critical real-time task gets priority over other tasks and retains that priority until it completes. As
in hard real time systems kernel delays need to be bounded
59. What is virtual memory?
Ans : A virtual memory is hardware technique where the system appears to have more memory
that it actually does. This is done by time-sharing, the physical memory and storage parts of the
memory one disk when they are not actively being used
60. What is cache memory?
Ans : Cache memory is random access memory (RAM) that a computer microprocessor can
access more quickly than it can access regular RAM. As the microprocessor processes data, it
looks first in the cache memory and if it finds the data there (from a previous reading of data), it
does not have to do the more time-consuming reading of data
61.Differentiate between Complier and Interpreter?
Ans : An interpreter reads one instruction at a time and carries out the actions implied by that
instruction. It does not perform any translation. But a compiler translates the entire instructions.
62.What are different tasks of Lexical Analysis?
Ans : The purpose of the lexical analyzer is to partition the input text, delivering a sequence of
comments and basic symbols. Comments are character sequences to be ignored, while basic
symbols are character sequences that correspond to terminal symbols of the grammar defining
the phrase structure of the input
63. Why paging is used?
Ans : Paging is solution to external fragmentation problem which is to permit the logical address
space of a process to be noncontiguous, thus allowing a process to be allocating physical
memory wherever the latter is available.
64. What is Context Switch?
Ans : Switching the CPU to another process requires saving the state of the old process and
loading the saved state for the new process. This task is known as a context switch.Contextswitch time is pure overhead, because the system does no useful work while switching. Its speed
varies from machine to machine, depending on the memory speed, the number of registers which
must be copied, the existed of special instructions(such as a single instruction to load or store all
registers).
65. Distributed Systems?
Ans : Distribute the computation among several physical processors.
Loosely coupled system each processor has its own local memory; processors communicate
with one another through various communications lines, such as high-speed buses or telephone
lines
Advantages of distributed systems:
->Resources Sharing
->Computation speed up load sharing
->Reliability
->Communications
66.Difference between Primary storage and secondary storage?
Ans :
Main memory: only large storage media that the CPU can access directly.
Secondary storage: extension of main memory that provides large nonvolatile storage capacity.
67. What is CPU Scheduler?
Ans :
->Selects from among the processes in memory that are ready to execute, and allocates the CPU
to one of them.
->CPU scheduling decisions may take place when a process:
1.Switches from running to waiting state.
2.Switches from running to ready state.
3.Switches from waiting to ready.
4.Terminates.
->Scheduling under 1 and 4 is nonpreemptive.
->All other scheduling is preemptive.
68. What do you mean by deadlock?
Ans : Deadlock is a situation where a group of processes are all blocked and none of them can
become unblocked until one of the other becomes unblocked.The simplest deadlock is two
processes each of which is waiting for a message from the other
69. What is Dispatcher?
Ans :
->Dispatcher module gives control of the CPU to the process selected by the short-term
scheduler; this involves:
Switching context
Switching to user mode
Jumping to the proper location in the user program to restart that program
Dispatch latency time it takes for the dispatcher to stop one process and start another running.
70. What is Throughput, Turnaround time, waiting time and Response time?
Ans :
Throughput number of processes that complete their execution per time unit
Turnaround time amount of time to execute a particular process
Waiting time amount of time a process has been waiting in the ready queue
Response time amount of time it takes from when a request was submitted until the first
response is produced, not output (for time-sharing environment)
71. Explain the difference between microkernel and macro kernel?
Ans :Micro-Kernel: A micro-kernel is a minimal operating system that performs only the
essential functions of an operating system. All other operating system functions are performed by
system processes.
Monolithic: A monolithic operating system is one where all operating system code is in a single
executable image and all operating system code runs in system mode.
72.What is multi tasking, multi programming, multi threading?
Ans :
Multi programming: Multiprogramming is the technique of running several programs at a time
using timesharing.It allows a computer to do several things at the same time. Multiprogramming
creates logical parallelism.
The concept of multiprogramming is that the operating system keeps several jobs in memory
simultaneously. The operating system selects a job from the job pool and starts executing a job,
when that job needs to wait for any i/o operations the CPU is switched to another job. So the
main idea here is that the CPU is never idle.
Multi tasking: Multitasking is the logical extension of multiprogramming .The concept of
multitasking is quite similar to multiprogramming but difference is that the switching between
jobs occurs so frequently that the users can interact with each program while it is running. This
concept is also known as time-sharing systems. A time-shared operating system uses CPU
scheduling and multiprogramming to provide each user with a small portion of time-shared
system.
Multi threading: An application typically is implemented as a separate process with several
threads of control. In some situations a single application may be required to perform several
similar tasks for example a web server accepts client requests for web pages, images, sound, and
so forth. A busy web server may have several of clients concurrently accessing it. If the web
server ran as a traditional single-threaded process, it would be able to service only one client at a
time. The amount of time that a client might have to wait for its request to be serviced could be
enormous.
So it is efficient to have one process that contains multiple threads to serve the same purpose.
This approach would multithread the web-server process, the server would create a separate
thread that would listen for client requests when a request was made rather than creating another
process it would create another thread to service the request.
So to get the advantages like responsiveness, Resource sharing economy and utilization of
multiprocessor architectures multithreading concept can be used
73. Give a non-computer example of preemptive and non-preemptive scheduling?
Ans : Consider any system where people use some kind of resources and compete for them. The
non-computer examples for preemptive scheduling the traffic on the single lane road if there is
emergency or there is an ambulance on the road the other vehicles give path to the vehicles that
are in need. The example for preemptive scheduling is people standing in queue for tickets.
74. What is starvation and aging?
Ans :
Starvation: Starvation is a resource management problem where a process does not get the
resources it needs for a long time because the resources are being allocated to other processes.
Aging: Aging is a technique to avoid starvation in a scheduling system. It works by adding an
aging factor to the priority of each request. The aging factor must increase the requests priority
as time passes and must ensure that a request will eventually be the highest priority request (after
it has waited long enough)