70
Testing Testing: Software testing is an investigation conducted to provide stakeholders with information about the quality of the product or service under test.Software testing can also provide an objective, independent view of the software to allow the business to appreciate and understand the risks of software implementation. Test techniques include, but are not limited to, the process of executing a program or application with the intent of finding software bugs(errors or other defects). Black box testing: These tests are based on requirements and functionality. These tests are not based on any knowledge of internal design or code. White box testing: This testing based on knowledge of the internal logic of an application’s code. Tests are based on coverage of code statements, branches, paths, conditions in code. Unit Testing: Generally Unit testing done by the programmer and not by testers, as it requires detailed knowledge of the internal program design and code. This test particular functions or code modules. Not always easily done unless the application has a well-designed architecture with tight code; may require developing test drive modules or test harnesses. Incremental integration testing: this testing will be used when new functionality is added; requires that various aspects of an application’s functionality be independent enough to work separately before all parts of the program are completed, or that test drivers be developed as needed; done by programmers or by testers. Integration testing: Testing of combined parts of an application to determine if they function together correctly. The ‘parts’ can be code modules, individual applications, client and server applications on a network, etc. This type of testing is especially relevant to client/server and distributed systems. Functional testing: black-box type testing geared to functional requirements of an application; this type of testing should be done by testers. This doesn’t mean that the programmers shouldn’t check that their code works before releasing it (which of course applies to any stage of testing.) Smoke Testing: typically an initial testing effort to determine if a new software version is performing well enough to accept it for a major testing effort. For example, if the new software is crashing systems every 5 minutes, bogging down systems to a crawl, or corrupting databases, the software may not be in a ‘sane’ enough condition to warrant further testing in its current state. Regression Testing: Re-testing after fixes or modifications of the software or its environment. It can be difficult to determine how much re-testing is needed, especially near the end of the development cycle. Automated testing tools can be especially useful for this type of testing. Acceptance Testing: Final testing based on specifications of the end-user or customer, or based on use by end-users/customers over some limited period of time.

Basic interview questions

Embed Size (px)

DESCRIPTION

hi this will help in basics of software interview

Citation preview

  • Testing

    Testing: Software testing is an investigation conducted to provide stakeholders with informationabout the quality of the product or service under test.Software testing can also provide anobjective, independent view of the software to allow the business to appreciate and understandthe risks of software implementation. Test techniques include, but are not limited to, the processof executing a program or application with the intent of finding software bugs(errors or otherdefects).

    Black box testing: These tests are based on requirements and functionality. These tests are notbased on any knowledge of internal design or code.White box testing: This testing based on knowledge of the internal logic of an applications code.Tests are based on coverage of code statements, branches, paths, conditions in code.

    Unit Testing: Generally Unit testing done by the programmer and not by testers, as it requiresdetailed knowledge of the internal program design and code. This test particular functions orcode modules. Not always easily done unless the application has a well-designed architecturewith tight code; may require developing test drive modules or test harnesses.

    Incremental integration testing: this testing will be used when new functionality is added;requires that various aspects of an applications functionality be independent enough to workseparately before all parts of the program are completed, or that test drivers be developed asneeded; done by programmers or by testers.Integration testing: Testing of combined parts of an application to determine if they functiontogether correctly. The parts can be code modules, individual applications, client and serverapplications on a network, etc. This type of testing is especially relevant to client/server anddistributed systems.

    Functional testing: black-box type testing geared to functional requirements of an application;this type of testing should be done by testers. This doesnt mean that the programmers shouldntcheck that their code works before releasing it (which of course applies to any stage of testing.)

    Smoke Testing: typically an initial testing effort to determine if a new software version isperforming well enough to accept it for a major testing effort. For example, if the new softwareis crashing systems every 5 minutes, bogging down systems to a crawl, or corrupting databases,the software may not be in a sane enough condition to warrant further testing in its currentstate.

    Regression Testing: Re-testing after fixes or modifications of the software or its environment. Itcan be difficult to determine how much re-testing is needed, especially near the end of thedevelopment cycle. Automated testing tools can be especially useful for this type of testing.

    Acceptance Testing: Final testing based on specifications of the end-user or customer, or basedon use by end-users/customers over some limited period of time.

  • 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 Testingand Mercury Quality Center. Testing results could be automatically fed into a database that may provide useful statistics onhow 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 buildto 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 theProperties tab of the Object Spy dialog box.Using the Object Spy, you can view the properties of any object in an open application. You usethe Object Spy pointer to point to an object.

    QTP testing process consists of 6 main categories:Create test planBefore automating there should be a detailed description of the test including the exact steps tofollow, data to be input, and all items to be verified by the test. The verification informationshould include both data validations and existence or state verifications of objects in theapplication.

    Recording a session on the applicationAs you navigate through your application, Quick Test graphically displays each step you performin the form of a collapsible icon-based test tree. A step is any user action that causes or makes achange in your site, such as clicking a link or image, or entering data in a form.

  • Enhancing testInserting checkpoints into your test lets you search for a specific value of a page, object or textstring, 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 ismuch easier and faster to add the checkpoints during the recording process. Broadening thescope of your test by replacing fixed values with parameters lets you check how your applicationperforms the same operations with multiple sets of data. Adding logic and conditional statementsto your test enables you to add sophisticated checks to your test.

    Debugging testif any changes were made to the script, you need to debug it to check that it operates smoothlyand without interruption.

    Running your test on a new version of your applicationyou run a test to check the behavior of your application. While running, Quick Test connects toyour application andperforms each step in your test.

    Analyzing the test resultsYou examine the test results to pinpoint defects in your application.

    Reporting defectsAs you encounter failures in the application when analyzing test results, you will create defectreports in Defect Reporting Tool.

  • What is silk test?Skill test is automation testing tool specifically designed for doing regression and functionaltesting. This tool designed by segue software Inc

    What is silk test host?Silk Test Host is one of the Silk Test components that manages and executes test scripts. SilkTest Host typically runs on a separate computer different than the computer where AUT(Application under Test) is running.

    What is silk test Agent?Silk test agent is one of the silk test components that interact with the GUI of your application.The Agent translates the commands in your 4Test scripts into GUI specific commands, drivingand monitoring the application you are testing.Silk test agent could run on same machine where host is running or on networked environments.

    What are the different file types in silk test tool?Test Plan (.pln): This is used to create a suite of tests when combined with test scripts.Example: autotest.pln

    Test script (.t): This file type used to write actual test scripts.Example: Mytest.t (Automating notepad application)

    Frame file (.inc): The abstraction layer used to define the windows and controls in applicationunder test that will be further referenced in .t files.Example : Mytest.inc

    Result file (.res): This file type contains test run results with the names of passed or failed testsalong with a description of the failures. Can also contain log messages.

    What is 4test?4Test is a test scripting language used by Silk Test to compose test scripts to perform automatedtests.

    4Test programming language contains1. Library of object oriented classes and methods to interact with application GUI objects.2. Similar to other programming languages, 4test also has set of statements, operators and datatypes.

  • Networking Questions1.What do you mean by data communication?Ans: It is the exchange of data between two devices via some form of transmission medium suchas wire cable. The communicating system must be part of a communication system made up of acombination of hardware and software.The effectiveness of a data communication systemdepends 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 isunidirectional. 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 bi-directional but not at the same time. ie each station can transmit and receive but not at the sametime.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 bi-directional and it occurs simultaneously. Here signals going in either direction share the capacityof 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 anyother 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 reservedfor transmission between the two devicese.g. when we change the TV channels by remote control we establish a point to point connectionbetween 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 allthe links and linking devices (node) to one another.Four basic topologies are star, bus, ring andmesh.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 oneither 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 singleoffice, 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, imageand video information over large geographic areas that comprise a country, a continent or evenwhole 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 iscommunicated, how it is communicated, and when it is communicated. The key elements ofprotocol 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 universallycompatible 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 electricalspecification.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.

  • 15.What is ISO-OSI model?Ans: Open Systems Interconnection or OSI model was designed by the InternationalOrganization for Standardization (ISO) .It is a seven layer model. It is a theoretical modeldesigned to show how a protocol stack should be implemented.It defines two extra layers in addition to TCP/IP model.Session -It was designed to establish, maintain, and synchronize the interaction betweencommunicating system.Presentation-It was designed to handle the syntax and semantics of the information exchangedbetween the two systems. It was designed for data translation, encryption, decryption, andcompression.

    16. What is multiplexing?Ans: Multiplexing is the process of dividing a link, the phycal medium, into logical channels forbetter efficiency. Here medium is not changed but it has several channels instead of one.

    16.What is switching?Ans: Switching in data communication is of three typesCircuit switchingPacket switchingMessage switching

    17.How data is transmitted over a medium?Ans: Data is transmitted in the form of electromagnetic signals.

    18. Compare analog and digital signals?Ans: Analog signals can have an infinite number of values in a range but digital signal can haveonly a limited number of values.

    19.Define bandwidth?Ans: The range of frequencies that a medium can pass is called bandwidth. It is the differencebetween the highest and lowest frequencies that the medium can satisfactorily pass.

    20.What are the factors on which data rate depends?Ans: Data rate ie.how fast we can send data depends uponi) Bandwidth availableii) The levels of signals we can useiii) The quality of the channel (level of noise)

    21.Define bit rate and bit interval?Ans: Digital signals are aperiodic.so instead of using period and frequency we use bit intervaland bit rate respectively.Bit interval is the time required to send one single bit.Bit rate is thenumber of bit intervals per second.

  • 22.What is Nyquist bit rate formula?Ans: For a noiseless channel, the Nyquist bit rate formula defines the theoretical maximum bitrateBitrate=2* Bandwidth*log2LWhere Bandwidth is the bandwidth of the channelL is the number of signal level used to represent the dataBitrate is the bit rate in bits per second.

    23.Define Shannon Capacity?Ans: Shannon Capacity determines the theoretical highest data rate foe a noise channel.Capacity= Bandwidth * log2 (1+SNR)Bandwidth is the bandwidth of the channel.SNR is the signal to noise ratio, it is the statical ratio of the power of the signal to the power ofthe noise.Capacity is the capacity of the channel in bits per second

    24.What is sampling?Ans: It is the process of obtaining amplitude of a signal at regular intervals.

    25.Define pulse amplitude modulation?Ans: It is an analog to digital conversion method which takes analog signals, samples it andgenerates a series of pulse based on the results of the sampling. It is not used in datacommunication because the series of pulses generated still of any amplitude. To modify it we usepulse code modulation.

    26.Define pulse code modulation?Ans: Pulse code Modulation modifies pulses created by PAM to create a completely digitalsignal.For this PCM first quantizes the PAM pulse. Quantization is the method of assigning integralvalues in a specific tange to sampled instances.PCM is made up of four separate processes:PAM, quantization, binary encoding and line encoding.

    27.What is Nyquist Theorem?Ans: According to this theorem, the sampling rate must be at least 2 times the highest frequencyof the original signal.

    28.What are the modes of data transmission?Ans: Data transmission can be serial or parallel in modeIn parallel transmission, a group of bits is sent simultaneously, with each bit on a separate line.Inserial transmission there is only one line and the bits are sent sequentially.

    29.What is Asynchronous mode of data transmission?Ans: It is a serial mode of transmission.In this mode of transmission, each byte is framed with a start bit and a stop bit. There may be avariable length gap between each byte.

  • 30.What is Synchronous mode of data transmission?Ans: It is a serial mode of transmission.In this mode of transmission, bits are sent in acontinuous stream without start and stop bit and without gaps between bytes. Regrouping the bitsinto meaningful bytes is the responsibility of the receiver.

    31.What are the different types of multiplexing?Ans: Multiplexing is of three types. Frequency division multiplexing and wave divisionmultiplexing is for analog signals and time division multiplexing is for digital signals.

    32.What is FDM?Ans: In frequency division multiplexing each signal modulates a different carrier frequency. Themodulated carrier combines to form a new signal that is then sent across the link.Here multiplexers modulate and combine the signal while demultiplexers decompose anddemodulate.Guard bands keep the modulating signal from overlapping and interfering with one another.

    32.What is TDM ?Ans: In TDM digital signals from n devices are interleaved with one another, forming a frame ofdata.Framing bits allow the TDM multiplexer to synchronize properly.

    33.What are the different transmission media?Ans: The transmission media is broadly categorized into two typesi)Guided media(wired)i)Unguided media(wireless)

    34.What are the different Guided Media?Ans: The media which provides a conduct from one device to another is called a guided media.These include twisted pair cable, coaxial cable, and fiber-optic cable.

    35.Describe about the different Guided Medias.Ans: Twisted pair cable consists of two insulated cupper wires twisted together. It is used intelephone line for voice and data communications.Coaxial cable has the following layers: a metallic rod-shaped inner conductor, an insulatorcovering the rod, a metallic outer conductor (shield), an insulator covering the shield, and aplastic cover.Coaxial cable can carry signals of higher frequency ranges than twisted-pair cable.Coaxial cable is used in cable TV networks and Ethernet LANs.Fiber-optic cables are composedof a glass or plastic inner core surrounded by cladding, all encased in an outer jacket.Fiber-opticcables carry data signals in the form of light. The signal is propagated along the inner core byreflection. Its features are noise resistance, low attenuation, and high bandwidth capabilities.It is used in backbone networks, cable TV nerworks, and fast Ethernet networks.

  • 36.What do you mean by wireless communication?Ans: Unguided media transport electromagnetic waves without using a physical conductor. Thistype of communication is referred as wireless communication.Here signals are broadcaster through air and thus available to anyone who has a device to receiveit.

    37.What do you mean by switching?Ans: It is a method in which communication devices are connected to one another efficiently.A switch is intermediary hardware or software that links devices together temporarily.

    38.What are the switching methods?Ans: There are three fundamental switching methods: circuit switching, packet switching,And message switching.In circuit switching, a direct physical connection between two devices iscreated by space division switches, time division switches or both.In packet switching data is transmitted using a packet switched network. Packet switchednetwork is a network in which data are transmitted in independent units called packets.

    39.What are the duties of data link layer?Ans: Data link layer is responsible for carrying packets from one hop (computer or router) to thenext. The duties of data link layer include packetizing, adderssing, error control, flow control,medium access control.

    40.What are the types of errors?Ans: Errors can be categorized as a single-bit error or burst error. A single bit error has one biterror per data unit. A burst error has two or more bits errors per data unit.

    41.What do you mean by redundancy?Ans: Redundancy is the concept of sending extra bits for use in error detection. Three commonredundancy methods are parity check, cyclic redundancy check (CRC), and checksum.

    42.Define parity check.Ans: In parity check, a parity bit is added to every data unit so that the total number of 1s is even(or odd for odd parity).Simple parity check can detect all single bit errors. It can detect bursterrors only if the total number of errors in each data unit is odd.In two dimensional parity checks,a block of bits is divided into rows and a redundant row of bits is added to the whole block.

    43. Define cyclic redundancy check (CRC).Ans: C RC appends a sequence of redundant bits derived from binary division to the data unit.The divisor in the CRC generator is often represented as an algebraic polynomial.

    44. What is hamming code?Ans: The hamming code is an error correction method using redundant bits. The number of bitsis a function of the length of the data bits. In hamming code for a data unit of m bits, we use theformula 2r >= m+r+1 to determine the number of redundant bits needed. By rearranging theorder of bit transmission of the data units, the hamming code can correct burst errors.

  • 45.What do you mean by flow control?Ans: It is the regulation of senders data rate so that the receiver buffer doesnt becomeoverwhelmed.i.e. flow control refers to a set of procedures used to restrict the amount of datathat the sender can send before waiting for acknowledgement.

    46.What do you mean by error control?Ans: Error control refers primarily to methods of error detection and retransmission. Anytime anerror is detected in an exchange, specified frames are retransmitted. This process is calledautomatic repeat request (ARQ).

    47.Define stop and wait ARQ.Ans: In stop and wait ARQ, the sender sends a frame and waits for an acknowledgement fromthe receiver before sending the next frame.

    48.Define Go-Back-N ARQ?Ans: In Go-Back-N ARQ, multiple frames can be in transit at the same time. If there is an error,retransmission begins with the last Unacknowledged frame even if subsequent frames arrivedcorrectly. Duplicate frames are discarded.

    49.Define Selective Repeat ARQ?Ans: In Selective Repeat ARQ, multiple frames can be in transit at the same time. If there is anerror, only unacknowledged frame is retransmitted.

    50.What do you mean by pipelining, is there any pipelining in error control?Ans: The process in which a task is often begun before the previous task has ended is calledpipelining. There is no pipelining in stop and wait ARQ however it does apply in Go-Back-NARQ and Selective Repeat ARQ.

    51.What is HDLC?Ans: It is a bit oriented data link protocol designed to support both half duplex and full duplexcommunication over point to point and multi point links.HDLC is characterized by their stationtype,configuration and their response modes.

    52.What do you mean by point to point protocol?Ans: The point to point protocol was designed to provide a dedicated line for users who needinternet access via a telephone line or a cable TV connection. Its connection goes through threephases: idle, establishing, authenticating, networking and terminating.At data link layer it employs a version of HDLC.

    53. What do you mean by point to point protocol stack?Ans: Point to point protocol uses a stack of other protocol to use the link, to authenticate theparties involved, and to carry the network layer data. Three sets of protocols are defined: linkcontrol protocol, Authentication protocol, and network control protocol.

    54.What do you mean by line control protocol?Ans: It is responsible for establishing, maintaining, configuring, and terminating links.

  • 55.What do you mean by Authentication protocol?Ans: Authentication means validating the identity of a user who needs to access a set ofresources.It is of two typesi)Password Authentication Protocol(PAP)ii)Challenge Handshake Authentication Protocol(CHAP)PAP is a two step process. The user sends a authentication identification and a password. Thesystem determines the validity of the Information sent.CHAP is a three step process. The systemsends a value to the user. The user manipulates the value and sends the result. The systemVerifies the result.

    56.What do you mean by network control protocol?Ans: Network control protocol is a set of protocols to allow the encapsulation of data comingfrom network layer protocol that requires the services of PPP.

    57. What do you mean by CSMA?Ans: To reduce the possibility of collision CSMA method was developed. In CSMA each stationfirst listen to the medium (Or check the state of the medium) before sending. It cant eliminatecollision.

    58.What do you mean by Bluetooth?Ans: It is a wireless LAN technology designed to connect devices of different functions such astelephones, notebooks, computers, cameras, printers and so on. Bluetooth LAN Is an adhocnetwork that is the network is formed spontaneously? It is the implementation of protocoldefined by the IEEE 802.15 standard.

    59.What is IP address?Ans: The internet address (IP address) is 32bits that uniquely and universally defines a host orrouter on the internet.The portion of the IP address that identifies the network is called netid. The portion of the IPaddress that identifies the host or router on the network is called hostid.

    60.What do you mean by subnetting?Ans: Subnetting divides one large network into several smaller ones. It adds an intermediatelevel of hierarchy in IP addressing.

    61.What are the advantages of fiber optics cable ?Ans: The advantages of fiber optics cable over twisted pair cable are Noise resistance-As theyuse light so external noise is not a factor. Less signal attenuation-fiber optics transmissiondistance is significantly greater than that of other guided media.Higher bandwidth-It can supporthigher bandwidth.

    62.What are the disadvantages of fiber optics cable?Ans: The disadvantages of fiber optics cable over twisted pair cable areCost-It is expensive Installation/maintenance-Any roughness or cracking defuses light and altersthe signal Fragility-It is more fragile.

  • 63.What are the propagation type of radio wave ?Ans: Radio wave propagation is dependent upon frequency.There are five propagation type.i)surface propagationii)Tropospheric propagationiii)Ionospheric propagationiv)Line of sight propagationv)space propagation

    64.What do you mean by Geosynchronous Satellites ?Ans: Satellite communication uses a satellite in geosynchronous orbit to relay signals.TheSatellite must move at the same speed as the earth so that it seems to remain fixed above acertain spot..Only one orbit can be geosynchronous.This orbit occurs at the equatorial plane andis approximately 22,000 miles from the surface of earth.

    65.What are the factors for evaluating the suitability of the media ?Ans: The factors are cost,throughput,attenuation,Electromagneric interference(EMI),securtty.

    66.What do you mean by medium access control(MAC) sublayer.Ans: The protocols used to determine who goes next on a multi-access channel belong to asublayer of the data link layer is called the multi-access channel(MAC) sublayer.It is the buttompart of data link layer.

    67.What do you mean by ALOHA ?Ans: It is the method used to solve the channel allocation problem .It is used for:i)ground based radio broadcastingii)In a network in which uncoordinated users are competing for the use of single channel.It is of two types:1.Pure aloha2.Slotted aloha

    68.What is pure ALOHA?Ans: It lets users transmit whenever they have data to sent.Collision may occur but due tofeedback property sender can know the status of message.conflict occur when at one time morebits are transmitted.The assumptions are :i)all frame size is same for all user.ii)collision occur when frames are transmitted simultaneouslyiii)indefinite population of no of user.iv)N=number of frames/frame timeiv)it obeys poissons distribution if N>1 there will be collision 0

  • 70.What do you mean by persistent CSMA(carrier sense multiple access) ?Ans: When a station has data to send,it first listens to the channel to see if anyone else istransmitting at that moment.If channel is busy it waits until the station becomes idle. Whencollision occurs it waits and then sends.It sends frame with probability 1 when channel is idle.

    71.What do you mean by non persistent CSMA(carrier sense multiple access) ?Ans: Here if no one else is sending the station begins doing so itself.However if the channel isalready in use,the station doest continuously sense it rather it waits for a random period of timeand then repeats.It leads better channel utilization but longer delay.

    72.What do you mean by p persistent CSMA(carrier sense multiple access) ?Ans: It applies to slotted channels.when a station becomes ready to send,it senses the channel.Ifit is idle it transmits with a probability P,with a probability Q=P-1It defers until the next slot.If that slot is also idle,it either transmits or defers again withprobability P and Q.The process is repeated until either the frame has been transmitted or anotherstation begins transmitting.

    73.What is FDDI?Ans: It is high performance fiber optic token ring LAN running at 100Mbps over distance up1000 stations.FDDI access is limited by time.A FDDI cabling consist of two fiber rings.i)one transmitting clockwiseii)one transmitting counterclockwise

    74.What is Firewalls?Ans: It is an electronic downbridge which is used to enhance the security of a network. Itsconfiguration has two components.i)Two routersii)Application gatewaythe packets traveling through the LAN are inspected here and packets meeting certain criteria areforwarded and others are dropped.

    75.What is Repeaters ?Ans: A receiver receives a signal before it becomes too weak or corrupted,regenerates theoriginal bit pattern,and puts the refreshed copy back onto the link.It operates on phycal layer ofOSI model.

    76.What is Bridges?Ans: They divide large network into smaller components.They can relay frames between twooriginally separated LANs.They provide security through partitioning traffic.They operate onphycal and data link layer of OSI model.

    77.What is Routers ?Ans: Router relay packets among multiple interconnected networks.They receive packet fromone connected network and pass it to another network.They have access to network layeraddresses and certain software that enables them to determine which path is best for transmissionamong several paths.They operate on phycal,data link and network layer of OSI model.

  • 78.What is Gateway ?Ans: It is a protocol converter.A gateway can accept a packet formatted for one protocol andconvert it to a packet formatted for another protocol.It operates on all the seven layers of OSImodel.

    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 canbe 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 receivesdata in the form of an analog or digital signal through a network.DTE generates digital data andpasses them to a DCE ,the DCE converts the data to a form acceptable to the transmission mediaand 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 maybe hardware device. processes human beingpeers 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 inaddress field.when packet is transmitted it is received and processed by every machine on thenetwork.

    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 ofmachines.large networks are point to point.Routing algorithm plays an important in point topoint network.It uses stored ad forword technique.It is a packet switching network.

  • 86.What are the design issue of layers ?Ans: The design issue of layer are Addressing technique.ie source and destination address Types of communication Error control Order of message. Speed matching Multiplexing and demultiplexing.

    87.What are the protocols in application layer ?Ans: The protocols defined in application layer are TELNET FTP SMTP DNS

    88.What are the protocols in transport layer ?Ans: The protocols defined in transport layer are TCP UDP

    89.Define TCP ?Ans: It is connection oriented protocol.It consist byte streams oeiginating on one machine to bedelivered without error on any other machine in the network.while transmitting it fragments thestream to discrete messages and passes to interner layer.At the destination it reassembles themessages into output stream.

    90.Define UDP ?Ans: It is unreliable connectionless protocol.It is used for one-shot,client-server type,requesr-reply queries and applications in which prompt delivery is required than accuracy.

    91.Define IP ?Ans: Internetwork protocol (IP) is the transmission mechanism used by TCP/IP protocol.It is anunreliable and connectionless datagram protocol.It provides no error checking and tracking.

    92.What do you mean by client server model ?Ans: In client server model ,the client runs a program to request a service and the server runs aprogram to provide the service.These two programs communicate with each other. One serverprogram can provide services to many client programs.

  • 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 theinternet 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 remotemachine,giving the user access to the remote system. TELNET is an abbreviation of terminalNetwork.

    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 userwants to access an application program or utility located on a remote machine,he or she performsremote 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 fromlocal 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 MailTransfer Protocol.SMTP provides for mail exchange between users on the same or differentcomputer and supports Sending a single message to one or more recipient Sending message thatinclude 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 datain the form of plain text,hypertext,audio,video,and so on. It is so called because its efficiencyallows its use in a hypertext environment where there are rapid jumps from one document toanother.

    100.What is URL ?Ans: It is a standard for specifying any kind of information on the World Wide Web.

  • 101. What is World Wide Web ?Ans: World Wide Web is a repository of information spread all over the world and linkedtogether.It is a unique combination of flexibility,portability,and user-friendly features .TheWorld Wide Web today is a distributed client-server service,in which a client using a browsercan access a service using a server.The service provided is distributed over many locations calledweb sites.

    102.What is HTML ?Ans: Hypertext Markup Language (HTML) is a language for creating static web pages

  • C Language Questions1. What does static variable mean?Ans: Static variables are the variables which retain their values between the function calls. Theyare 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 ascalar (including another pointer), or an aggregate (array or structure). The pointed-to object maybe 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 casesi) It is used to access array elementsii) It is used for dynamic memory allocation.iii) It is used in Call by referenceiv) 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 asingle 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 utilizationtechnique by allocating enough memory to hold the largest member. Here a single area ofmemory 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 tohold 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 thelargest 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 ofhomogeneous data types.Array1-It is a collection of data items of same data type.2-It has declaration only3-.There is no keyword.4- array name represent the address of the starting element.Structure1-It is a collection of data items of different data type.2- It has declaration and definition3- keyword struct is used4-Structure name is known as tag it is the short hand notation of the declaration.

  • 8. In header files whether functions are declared or defined?Ans: Functions are declared within header file. That is function prototypes exist in a headerfile,not function bodies. They are defined in library (lib).

    9. What are the differences between malloc () and calloc ()?Ans: Malloc Calloc 1-Malloc takes one argument Malloc(a);where a number of bytes 2-memoryallocated contains garbage values1-Calloc takes two arguments Calloc(b,c) where b no of object and c size of object2-It initializes the contains of block of memory to zerosMalloc takes one argument, memoryallocated contains garbage values.It allocates contiguous memory locations. Calloc takes two arguments, memory allocatedcontains all zeros, and the memory allocated is not contiguous.

    10. What are macros? What are its advantages and disadvantages?Ans: Macros are abbreviations for lengthy and frequently used statements. When a macro iscalled the entire code is substituted by a single line though the macro definition is of severallines.The advantage of macro is that it reduces the time taken for control transfer as in case offunction.The disadvantage of it is here the entire code is substituted so the program becomeslengthy if a macro is called several times.

    11. Difference between pass by reference and pass by value?Ans: Pass by reference passes a pointer to the value. This allows the callee to modify thevariable directly.Pass by value gives a copy of the value to the callee. This allows the callee tomodify the value without modifying the variable. (In other words, the callee simply cannotmodify the variable, since it lacks a reference to it.)

    12. What is static identifier?Ans: A file-scope variable that is declared static is visible only to functions within that file. Afunction-scope or block-scope variable that is declared as static is visible only within that scope.Furthermore, static variables only have a single instance. In the case of function- or block-scopevariables, this means that the variable is not automatic and thus retains its value acrossfunction invocations.

    13. Where is the auto variables stored?Ans: Auto variables can be stored anywhere, so long as recursion works. Practically, theyrestored onthe stack. It is not necessary that always a stack exist. You could theoretically allocate functioninvocation records from the heap.

  • 14. Where does global, static, and local, register variables, free memory and C Programinstructions 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. Theonly difference between globals and statics is whether the linker will resolve the symbols acrosscompilation units.Local: Typically on the stack, unless the variable gets register allocated andnever spills.Register: Nowadays, these are equivalent to Local variables. They live on the stackunless 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 ofstructures scattered through memory, held together by pointers in each element that point to thenext element. With an array, we can (on most architectures) move from one element to the nextby adding a fixed constant to the integer value of the pointer. With a linked list, there is a nextpointer 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 macrois 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 registervariables?Ans:Globals have application-scope. Theyre available in any compilation unit that includes anappropriate declaration (usually brought from a header file). Theyre stored wherever the linkerputs 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 thatcontains 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 thatlocal is valid.)Register: See tirade above on local vs. register. The only difference is thatthe 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.Theregister variable is stored in the cpu register instead of main memory.Frequently used variablesare 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 agivenfield by placing an integer value between the % and the field type specifier. (e.g. %64s). Such aspecifier will still accept a narrower field width.The one exception is %#c (where # is an integer). This reads EXACTLY # characters, and it istheonly 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 iscompletely safe, because the compiler cant prove that programmer wont overflow the buffer hepass to fgets ().

    22. Difference between strdup and strcpy?Ans: Both copy a string. strcpy wants a buffer to copy into. strdup allocates a buffer usingmalloc().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 adefinite 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 thenumber ofiterations 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 roomfor thelargest 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 dimensionalarrayof characters terminated by a NULL character.

  • 28. What is a far pointer? Where we use it?Ans: In large data model (compact, large, huge) the address B0008000 is acceptable because inthesemodel all pointers to data are 32bits long. If we use small data model(tiny, small, medium) theabove address wont work since in these model each pointer is 16bits long. If we are working ina small data model and want to access the address B0008000 then we use far pointer. Far pointeris always treated as a 32bit pointer and contains a segment address and offset address both of16bits each. Thus the address is represented using segment : offset format B000h:8000h. For anygiven memory address there are many possible far address segment : offset pair. The segmentregister contains the address where the segment begins and offset register contains the offset ofdata/code from where segment begins.

    29. What is a huge pointer?Ans: Huge pointer is 32bit long containing segment address and offset address. Huge pointersarenormalized pointers so for any given memory address there is only one possible huge addresssegment: offset pair. Huge pointer arithmetic is doe with calls to special subroutines so itsarithmetic slower than any other pointers.

    30. What is a normalized pointer, how do we normalize a pointer?Ans: It is a 32bit pointer, which has as much of its value in the segment register as possible.Sincea segment can start every 16bytes so the offset will have a value from 0 to F. for normalizationconvert the address into 20bit address then use the 16bit for segment address and 4bit for theoffset address. Given a pointer 500D: 9407,we convert it to a 20bitabsolute address549D7,Which then normalized to 549D:0007.

    31. What is near pointer?Ans: A near pointer is 16 bits long. It uses the current content of the CS (code segment) register(ifthe pointer is pointing to code) or current contents of DS (data segment) register (if the pointer ispointing to data) for the segment part, the offset part is stored in a 16 bit near pointer. Using nearpointer limits the data/code to 64kb segment.

    32. In C, why is the void pointer useful? When would you use it?Ans: The void pointer is useful because it is a generic pointer that any pointer can be cast intoandback again without loss of information.

    33. What is a NULL Pointer? Whether it is same as an uninitialized pointer?Ans: Null pointer is a pointer which points to nothing but uninitialized pointer may point toanywhere.

    34. Are pointers integer?Ans: No, pointers are not integers. A pointer is an address. It is a positive number.

  • 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 locationmay 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 genericpointer,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 allocationII. Dynamic memory allocation

    39. What is static memory allocation?Ans: Compiler allocates memory space for a declared variable. By using the address of operator,thereserved address is obtained and this address is assigned to a pointer variable. This way ofassigning pointer value to a pointer variable at compilation time is known as static memoryallocation.

    40. What is dynamic memory allocation?Ans: A dynamic memory allocation uses functions such as malloc() or calloc() to get memorydynamically. If these functions are used to get memory dynamically and the values returned bythese function are assigned to pointer variables, such a way of allocating memory at run time isknown 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 whichthe size is to be altered. The second argument specifies the new size. The size may be increasedor decreased. If sufficient space is not available to the old region the function may create a newregion.

    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 apointer.Example:int *p1,**p2,v=10;P1=&v; p2=&p1;Here p2 is a pointer to a pointer.

  • 43. What is an array of pointers?Ans: if the elements of an array are addresses, such an array is called an array of pointers.

    44. Difference between linker and linkage?Ans: Linker converts an object code into an executable code by linking together the necessarybuilt infunctions. The form and place of declaration where the variable is declared in a programdetermine the linkage of variable.

    45. Is it possible to have negative index in an array?Ans: Yes it is possible to index with negative value provided there are data stored in thislocation. Even if it is illegal to refer to the elements that are out of array bounds, the compilerwill not produce error because C has no check on the bounds of an array.

    46. Why is it necessary to give the size of an array in an array declaration?Ans: When an array is declared, the compiler allocates a base address and reserves enough spaceinmemory for all the elements of the array. The size is required to allocate the required space andhence size must be mentioned.

    47. What modular programming?Ans: If a program is large, it is subdivided into a number of smaller programs that are calledmodules or subprograms. If a complex problem is solved using more modules, this approach isknown as modular programming.

    48. What is a function?Ans: A large program is subdivided into a number of smaller programs or subprograms. Eachsubprogramspecifies one or more actions to be performed for the larger program. Such sub programs arecalled functions.

    49. What is an argument?Ans: An argument is an entity used to pass data from the calling to a called function.

    50. What are built in functions?Ans: The functions that are predefined and supplied along with the compiler are known as built-in functions. They are also known as library functions.

    61. What do the c and v in argc and argv stand for?Ans: The c in argc(argument count) stands for the number of command line argument theprogram isinvoked with and v in argv(argument vector) is a pointer to an array of character string thatcontain the arguments.

  • 62. IMP>what are C tokens?Ans: There are six classes of tokens: identifier, keywords, constants, string literals, operators andother separators.

    63. What are C identifiers?Ans: These are names given to various programming element such as variables, function,arrays.It is a combination of letter, digit and underscore.It should begin with letter. Backspace isnot allowed.

    64. Difference between syntax vs logical error?Ans:Syntax Error1-These involves validation of syntax of language.2-compiler prints diagnostic message.

    Logical Error1-logical error are caused by an incorrect algorithm or by a statement mistyped in such a waythat it doesnt violet syntax of language.2-difficult to find.

    65. What is preincrement and post increment?Ans: ++n (pre increment) increments n before its value is used in an assignment operation or anyexpression containing it. n++ (post increment) does increment after the value of n is used.

    66. Write a program to interchange 2 variables without using the third one.Ans:a ^= b; ie a=a^bb ^= a; ie b=b^a;a ^= b ie a=a^b;here the numbers are converted into binary and then xor operation is performed.You know, youre just asking have you seen this overly clever trick thats not worth applyingonmodern architectures and only really applies to integer variables?

    67. What is the maximum combined length of command line arguments including the spacebetween adjacent arguments?Ans: It depends on the operating system.

  • 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 wewill 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 containsthree 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 program2- It facilitates easier modification3- It helps in writing portable programs4- It enables easier debugging5- It enables testing a part of program6- It helps in developing generalized program

    70. What are the facilities provided by preprocessor?Ans:1-file inclusion2-substitution facility3-conditional compilation

    71. What are the two forms of #include directive?Ans:1.#includefilename2.#includethe first form is used to search the directory that contains the source file.If the search fails in thehome directory it searches the implementation defined locations.In the second form ,thepreprocessor 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 stringgcvt() 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 ofinformation .It is not a data type.

    77. IMP>what are the types of file?Ans: Files are of two types1-high level files (stream oriented files) :These files are accessed using library functions2-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 orotherI/O device. The source stream provides data to a program and it is known as input stream. Thedestination 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 requirescreatingan 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 pointerpoints to the block of information of the stream that had just been opened.

  • 82. How is fopen()used ?Ans: The function fopen() returns a file pointer. Hence a file pointer is declared and it isassignedasFILE *fp;fp= fopen(filename,mode);filename is a string representing the name of the file and the mode represents:r for read operationw for write operationa for append operationr+,w+,a+ for update operation

    83How is a file closed ?Ans: A file is closed using fclose() functionEg. fclose(fp);Where fp is a file pointer.

    84. What is a random access file?Ans:A file can be accessed at random using fseek() functionfseek(fp,position,origin);fp file pointerposition number of bytes offset from originorigin 0,1 or 2 denote the beginning ,current position or end of file respectively.

    85. What is the purpose of ftell ?Ans: The function ftell() is used to get the current file represented by the file pointer.ftell(fp);returns a long integer value representing the current file position of the file pointed by thefile pointer fp.If an error occurs ,-1 is returned.

    86. What is the purpose of rewind() ?Ans: The function rewind is used to bring the file pointer to the beginning of the file.Rewind(fp);Where fp is a file pointer.Also we can get the same effect byfeek(fp,0,0);

    87. Difference between a array name and a pointer variable?Ans: A pointer variable is a variable where as an array name is a fixed address and is not avariable. Apointer variable must be initialized but an array name cannot be initialized. An array name beinga constant value , ++ and operators cannot be applied to it.

  • 88. Represent a two-dimensional array using pointer?Ans:Address of a[I][j] Value of a[I][j]&a[I][j]ora[I] + jor*(a+I) + j*&a[I][j] or a[I][j]or*(a[I] + j )or*( * ( a+I) +j )

    89. Difference between an array of pointers and a pointer to an array?Ans:Array of pointers1- Declaration is: data_type *array_name[size];2-Size represents the row size.3- The space for columns may be dynamically

    Pointers to an array1-Declaration is data_type ( *array_name)[size];2-Size represents the column size.

    90. Can we use any name in place of argv and argc as command line arguments ?Ans: yes we can use any user defined name in place of argc and argv;

    91. What are the pointer declarations used in C?Ans:1- Array of pointers, e.g , int *a[10]; Array of pointers to integer2-Pointers to an array,e.g , int (*a)[10]; Pointer to an array of into3-Function returning a pointer,e.g, float *f( ) ; Function returning a pointer to float4-Pointer to a pointer ,e.g, int **x; Pointer to apointer to int5-pointer to a data type ,e.g, char *p; pointer to char

    92. Differentiate between a constant pointer and pointer to a constant?Ans:const char *p; //pointer to a const character.char const *p; //pointer to a const character.char * const p; //const pointer to a char variable.const char * const p; // const pointer to a const character.

  • 93. Is the allocated space within a function automatically deallocated when the functionreturns?Ans: No pointer is different from what it points to .Local variables including local pointersvariables in a function are deallocated automatically when function returns.,But in case of alocal pointer variable ,deallocation means that the pointer is deallocated and not the block ofmemory allocated to it. Memory dynamically allocated always persists until the allocation isfreedor 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 pointerto an integer is incremented by one , the address is incremented by two. It is done automaticallyby the compiler.5-Assigning the value 0 to the pointer variable and comparing 0 with the pointer. The pointerhaving 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 ofstrings?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 ++ *ptrincrements the value being pointed to by ptr.

    98. What would be the equivalent pointer expression foe referring the same element asa[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++ Questions1. What is a class?Ans: The objects with the same data structure (attributes) and behavior (operations) are calledclass.

    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 inmultiprocessor 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 likename, 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 withoutsupporting 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 programminglanguages 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-operativecollection of objects, each of which represents an instance of some class and whose classes areall member of a hierarchy of classes united through the property of inheritance.

  • 8. What is public, protected, and private?Ans: These are access specifier or a visibility lebels .The class member that has been declared asprivate can be accessed only from within the class. Public members can be accessed from outsidethe class also. Within the class or from the object of a class protected access limit is same as thatof private but it plays a prominent role in case of inheritance

    9. What is a scope resolution operator?Ans: The scope resolution operator permits a program to reference an identifier in the globalscope that has been hidden by another identifier with the same name in the local scope.

    10. What do you mean by inheritance?Ans: The mechanism of deriving a new class (derived) from an old class (base class) is calledinheritance. It allows the extension and reuse of existing code without having to rewrite the codefrom scratch.

    11. What is abstraction?Ans: The technique of creating user-defined data types, having the properties of built-in datatypes and a set of permitted operators that are well suited to the application to be programmed isknown as data abstraction. Class is a construct for abstract data types (ADT).

    12. What is encapsulation?Ans: It is the mechanism that wraps the data and function it manipulates into single unit andkeeps it safe from external interference.

    13. How variable declaration in c++ differs that in c?Ans: C requires all the variables to be declared at the beginning of a scope but in c++ we candeclare variables anywhere in the scope. This makes the programmer easier to understandbecause the variables are declared in the context of their use.

    14. What are the c++ tokens?Ans: c++ has the following tokensI. keywordsII. IdentifiersIII. ConstantsIV. StringsV. operators

    15. What do you mean by reference variable in c++?Ans: A reference variable provides an alias to a previously defined variable.Data type & reference-name = variable name

    16. What do you mean by implicit conversion?Ans: Whenever data types are mixed in an expression then c++ performs the conversionautomatically.Here smaller type is converted to wider type.Example- in case of integer and float integer is converted into float type.

  • 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 tobe 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 baseclass.

    18. What are the defining traits of an object-oriented language?The defining traits of an object-oriented language are:encapsulationinheritancepolymorphismAns:Polymorphism: is a feature of OOPL that at run time depending upon the type of object theappropriate method is called.

    Inheritance: is a feature of OOPL that represents the is a relationship between differentobjects (classes). Say in real life a manager is a employee. So in OOPL manger class is inheritedfrom 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 classpointer 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 compilerreplaces the function call with the corresponding function code. An inline function is a functionthat is expanded in line when it is invoked. That is the compiler replaces the function call withthe 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 toan object of an unknown type, and is guaranteed to have enough bits to hold a pointer to anyobject. A void pointer is not guaranteed to have enough bits to point to a function (though ingeneral 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. Sayclass teaching Assistant is inherited from two classes say teacher and Student.

  • 24. What do you mean by virtual methods?Ans: virtual methods are used to use the polymorphism feature in C++. Say class A is inheritedfrom class B. If we declare say function f() as virtual in class B and override the same function inclass A then at runtime appropriate method of the class will be called depending upon the type ofthe object.

    25. What do you mean by static methods?Ans: By using the static method there is no need creating an object of that class to use thatmethod. We can directly call that method on that class. For example, say class A has staticfunction f(), then we can call f() function as A.f(). There is no need of creating an object of classA.

    26. How many ways are there to initialize an int with a constant?Ans: Two.There are two formats for initializers in C++ as shown in the example that follows. The firstformat uses the traditional C notation. The second format uses constructor notation.int foo = 123;int bar (123);

    27. What is a constructor?Ans: Constructor is a special member function of a class, which is invoked automaticallywhenever an instance of the class is created. It has the same name as its class.

    28. What is destructor?Ans: Destructor is a special member function of a class, which is invoked automaticallywhenever an object goes out of the scope. It has the same name as its class with a tilde characterprefixed.

    29. What is an explicit constructor?Ans: A conversion constructor declared with the explicit keyword. The compiler does not use anexplicit constructor to implement an implied conversion of types. Its purpose is reservedexplicitly for construction.

    30 What is the Standard Template Library?Ans: A library of container templates approved by the ANSI committee for inclusion in thestandard C++ specification. A programmer who then launches into a discussion of the genericprogramming model, iterators, allocators, algorithms, and such, has a higher than averageunderstanding of the new technology that STL brings to C++ programming.

    31. What problem does the namespace feature solve?Ans: Multiple providers of libraries might use common global identifiers causing a namecollision when an application tries to link with two or more such libraries. The namespacefeature surrounds a librarys external declarations with a unique namespace that eliminates thepotential for those collisions. This solution assumes that two library vendors dont use the samenamespace identifier, of course.

  • 32. What is the use of using declaration?Ans: A using declaration makes it possible to use a name from a namespace

    33. What is a template?Ans: Templates allow us to create generic functions that admit any data type as parameters andreturn a value without having to overload the function with all the possible data types. Untilcertain point they fulfill the functionality of a macro. Its prototype is any of the two followingones:template function_declaration;template function_declaration;

    34. Differentiate between a template class and class template?Ans:Template class:A generic definition or a parameterized class not instantiated until the client provides the neededinformation. Its jargon for plain templates.Class template:A class template specifies how individual classes can be constructed much like the way a classspecifies how individual objects can be constructed. Its jargon for plain classes.

    35. What is the difference between a copy constructor and an overloaded assignmentoperator?Ans: A copy constructor constructs a new object by using the content of the argument object. Anoverloaded assignment operator assigns the contents of an existing object to another existingobject of the same class.

    36. What is a virtual destructor?Ans: The simple answer is that a virtual destructor is one that is declared with the virtualattribute.

    37. What is an incomplete type?Ans: Incomplete type refers to pointers in which there is non availability of the implementationof the referenced location or it points to some location whose value is not available formodification.Example:int *i=0400 // i points to address 400*i=0; //set the value of memory location pointed by i.Incomplete types are otherwise called uninitialized pointers.

    38. What do you mean by Stack unwinding?Ans: It is a process during exception handling when the destructor is called for all local objectsbetween the place where the exception was thrown and where it is caught.

  • 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. Acontainer class acts as a generic holder. A container class has a predefined behavior and a well-known interface. A container class is a supporting class whose purpose is to hide the topologyused for maintaining the list of objects in memory. When a container class contains a group ofmixed objects, the container is called a heterogeneous container; when the container is holding agroup 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 thirdparty software component or an object with the non-compatible interface or a non-object-oriented 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 doesnot exist. One common use for a null object is a return value from a member function that issupposed 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 logicalcondition to ensure the correct working of a class. Class invariants must hold when an object iscreated, and they must be preserved under all operations of the class. In particular all classinvariants are both preconditions and post-conditions for all operations or member functions ofthe 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 functionor using the address of the memory block after it is freed. Example: The following code snippetshows this:class Sample{public:int *ptr;Sample(int i){ptr = new int(i);}~Sample(){

  • delete ptr;}void PrintVal(){cout

  • 50. What do you mean by early binding?Ans:Early binding refers to the events that occur at compile time. Early binding occurs whenall information needed to call a function is known at compile time. Examples of early bindinginclude normal function calls, overloaded function calls, and overloaded operators. Theadvantage of early binding is efficiency.

    51. What do you mean by late binding?Ans: Late binding refers to function calls that are not resolved until run time. Virtual functionsare used to achieve late binding. When access is via a base pointer or reference, the virtualfunction actually called is determined by the type of object pointed to by the pointer.

  • Data Structure Questions1. What is data structure?Ans: The logical and mathematical model of a particular organization of data is called datastructure. There are two types of data structurei) Linearii) Nonlinear

    2. What are the goals of Data Structure?Ans: It must rich enough in structure to reflect the actual relationship of data in real world.The structure should be simple enough for efficient processing of data.

    3. What does abstract Data Type Mean?Ans: Data type is a collection of values and a set of operations on these values. Abstract datatype refer to the mathematical concept that define the data type.It is a useful tool for specifying the logical properties of a data type.ADT consists of two parts1) Values definition2) Operation definitionExample:-The value definition for the ADT RATIONAL states that RATIONAL value consistsof two integers, second doesnt equal to zero.The operator definition for ADT RATIONAL includes the operation of creation (make rational)addition, multiplication and test for equality.

    4. What is the difference between a Stack and an Array?Ans:i) Stack is a ordered collection of itemsii) Stack is a dynamic object whose size is constantly changing as items are pushed and popped .iii) Stack may contain different data typesiv) Stack is declared as a structure containing an array to hold the element of the stack, and aninteger to indicate the current stack top within the array.ARRAYi) Array is an ordered collection of itemsii) Array is a static object i.e. no of item is fixed and is assigned by the declaration of the arrayiii) It contains same data types.iv) Array can be home of a stack i.e. array can be declared large enough for maximum size of thestack.

    5. What do you mean by recursive definition?Ans: The definition which defines an object in terms of simpler cases of itself is called recursivedefinition.

    6. What is sequential search?Ans: In sequential search each item in the array is compared with the item being searched until amatch occurs. It is applicable to a table organized either as an array or as a linked list.

  • 7. What actions are performed when a function is called?Ans: When a function is calledi) arguments are passedii) local variables are allocated and initializedii) transferring control to the function

    8. What actions are performed when a function returns?Ans:i) Return address is retrievedii) Functions data area is freediii) Branch is taken to the return address

    9. What is a linked list?Ans: A linked list is a linear collection of data elements, called nodes, where the linear order isgiven by pointers. Each node has two parts first part contain the information of the elementsecond part contains the address of the next node in the list.

    10. What are the advantages of linked list over array (static data structure)?Ans:The disadvantages of array arei) unlike linked list it is expensive to insert and delete elements in the arrayii) One cant double or triple the size of array as it occupies block of memory space.

    In linked listi) each element in list contains a field, called a link or pointer which contains the address of thenext elementii) Successive elements need not occupy adjacent space in memory.

    11. Can we apply binary search algorithm to a sorted linked list, why?Ans: No we cannot apply binary search algorithm to a sorted linked list, since there is no way ofindexing the middle element in the list. This is the drawback in using linked list as a datastructure.

    12. What do you mean by free pool?Ans: Pool is a list consisting of unused memory cells which has its own pointer.

    13. What do you mean by garbage collection?Ans: It is a technique in which the operating system periodically collects all the deleted spaceonto the free storage list.It takes place when there is minimum amount of space left in storage list or when CPU is ideal.The alternate method to this is to immediately reinsert the space into free storage list which istime consuming.

  • 14. What do you mean by overflow and underflow?Ans: When new data is to be inserted into the data structure but there is no available space i.e.free storage list is empty this situation is called overflow.When we want to delete data from a data structure that is empty this situation is calledunderflow.

    15. What are the disadvantages array implementations of linked list?Ans:i) The no of nodes needed cant be predicted when the program is written.ii) The no of nodes declared must remain allocated throughout its execution

    16. What is a queue?Ans: A queue is an ordered collection of items from which items may be deleted at one end(front end) and items inserted at the other end (rear end).It obeys FIFO rule there is no limit to the number of elements a queue contains.

    17. What is a priority queue?Ans: The priority queue is a data structure in which the intrinsic ordering of the elements(numeric or alphabetic)Determines the result of its basic operation. It is of two typesi) Ascending priority queue- Here smallest item can be removed (insertion is arbitrary)ii) Descending priority queue- Here largest item can be removed (insertion is arbitrary)

    18. What are the disadvantages of sequential storage?Ans:i) Fixed amount of storage remains allocated to the data structure even if it contains less element.ii) No more than fixed amount of storage is allocated causing overflow

    19. What are the disadvantages of representing a stack or queue by a linked list?Ans:i) A node in a linked list (info and next field) occupies more storage than a correspondingelement in an array.ii) Additional time spent in managing the available list.

    20. What is dangling pointer and how to avoid it?Ans: After a call to free(p) makes a subsequent reference to *p illegal, i.e. though the storage top is freed but the value of p(address) remain unchanged .so the object at that address may beused as the value of *p (i.e. there is no way to detect the illegality).Here p is called danglingpointer.To avoid this it is better to set p to NULL after executing free(p).The null pointer value doesntreference a storage location it is a pointer that doesnt point to anything.

  • 21. What are the disadvantages of linear list?Ans:i) We cannot reach any of the nodes that precede node (p)ii) If a list is traversed, the external pointer to the list must be persevered in order to reference thelist again

    22. Define circular list?Ans: In linear list the next field of the last node contain a null pointer, when a next field in thelast node contain a pointer back to the first node it is called circular list.Advantages From any point in the list it is possible to reach at any other point

    23. What are the disadvantages of circular list?Ans:i) We cant traverse the list backwardii) If a pointer to a node is given we cannot delete the node

    24. Define double linked list?Ans: It is a collection of data elements called nodes, where each node is divided into three partsi) An info field that contains the information stored in the nodeii) Left field that contain pointer to node on left sideiii) Right field that contain pointer to node on right side

    25. Is it necessary to sort a file before searching a particular item ?Ans:If less work is involved in searching a element than to sort and then extract, then we dont go forsortIf frequent use of the file is required for the purpose of retrieving specific element, it is moreefficient to sort the file.Thus it depends on situation.

    26. What are the issues that hamper the efficiency in sorting a file?Ans: The issues arei) Length of time required by the programmer in coding a particular sorting programii) Amount of machine time necessary for running the particular programiii)The amount of space necessary for the particular program .

    27. Calculate the efficiency of sequential search?Ans: The number of comparisons depends on where the record with the argument key appears inthe tableIf it appears at first position then one comparisonIf it appears at last position then n comparisonsAverage=(n+1)/2 comparisonsUnsuccessful search n comparisonsNumber of comparisons in any case is O (n).

  • 28. Is any implicit arguments are passed to a function when it is called?Ans: Yes there is a set of implicit arguments that contain information necessary for the functionto execute and return correctly. One of them is return address which is stored within thefunctions data area, at the time of returning to calling program the address is retrieved and thefunction branches to that location.

    29. Parenthesis is never required in Postfix or Prefix expressions, why?Ans: Parenthesis is not required because the order of the operators in the postfix /prefixexpressions determines the actual order of operations in evaluating the expression

    30. List out the areas in which data structures are applied extensively?Ans:Compiler Design,Operating System,Database Management System,Statistical analysis package,Numerical Analysis,Graphics,Artificial Intelligence,Simulation

    31. What are the major data structures used in the following areas : network data model &Hierarchical data model.Ans:RDBMS Array (i.e. Array of structures)Network data model GraphHierarchical data model Trees

    32. If you are using C language to implement the heterogeneous linked list, what pointertype will you use?Ans: The heterogeneous linked list contains different data types in its nodes and we need a link,pointer to connect them. It is not possible to use ordinary pointers for this. So we go for voidpointer. Void pointer is capable of storing pointer to any type as it is a generic pointer type.

    33. Minimum number of queues needed to implement the priority queue?Ans: Two. One queue is used for actual storing of data and another for storing priorities.

    34. What is the data structures used to perform recursion?Ans: Stack. Because of its LIFO (Last In First Out) property it remembers its caller so knowswhom to return when the function has to return. Recursion makes use of system stack for storingthe return addresses of the function calls.Every recursive function has its equivalent iterative (non-recursive) function. Even when suchequivalent iterative procedures are written, explicit stack is to be used.

  • 35. What are the notations used in Evaluation of Arithmetic Expressions using prefix andpostfix forms?Ans: Polish and Reverse Polish notations.

    36. Convert the expression ((A + B) * C (D E) ^ (F + G)) to equivalent Prefix andPostfix notations.Ans: Prefix Notation:^ * +ABC DE + FGPostfix 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 nosorting 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) noneAns: (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 haveformed 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 14nodes, 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 treesbut not vice versa.

    44. In RDBMS, what is the efficient data structure used in the internal storagerepresentation?Ans: B+