300+ Top Computer Networks Lab Viva Questions and Answers

Computer Networks VIVA Questions :-

1. What is  Network?
A network is a set of devices connected by physical media links. A network is recursively is a connection of two or more nodes by a physical link or two or more networks connected by one or more nodes.

2. What is a Link?
At the lowest level, a network can consist of two or more computers directly connected by some physical medium such as coaxial cable or optical fiber. Such a physical medium is called as Link.

3. What is a node?
A network can consist of two or more computers directly connected by some physical medium such as coaxial cable or optical fiber. Such a physical medium is called as Links and the computer it connects is called as Nodes.

4. What is a gateway or Router?
A node that is connected to two or more networks is commonly called as router or Gateway. It generally forwards message from one network to another.

5. What is point-point link?
If the physical links are limited to a pair of nodes it is said to be point-point link.

6. What is Multiple Access?
If the physical links are shared by more than two nodes, it is said to be Multiple Access.

7. What are the advantages of Distributed Processing?

  1. Security/Encapsulation
  2. Distributed database
  3. Faster Problem solving
  4. Security through redundancy
  5. Collaborative Processing

8. What are the criteria necessary for an effective and efficient network?

  • Performance : It can be measured in many ways, including transmit time and response time.
  • Reliability : It is measured by frequency of failure, the time it takes a link to recover from a failure, and the network’s robustness.
  • Security : Security issues includes protecting data from unauthorized access and virues.

9. Name the factors that affect the performance of the network?

  1. Number of Users
  2. Type of transmission medium
  3. Hardware
  4. Software

10. Name the factors that affect the reliability of the network?

  • Frequency of failure
  • Recovery time of a network after a failure

Computer Networks Viva Questions

11. Name the factors that affect the security of the network?

  • Unauthorized Access
  • Viruses

12. What is Protocol?
A protocol is a set of rules that govern all aspects of information communication.

13. What are the key elements of protocols?
The key elements of protocols are

  1. Syntax : It refers to the structure or format of the data, that is the order in which they are presented.
  2. Semantics : It refers to the meaning of each section of bits.
  3. Timing : Timing refers to two characteristics: When data should be sent and how fast they can be sent.

14. What are the key design issues of a computer Network?

  • Connectivity
  • Cost-effective Resource Sharing
  • Support for common Services
  • Performance

15. Define Bandwidth and Latency?
Network performance is measured in Bandwidth (throughput) and Latency (Delay). Bandwidth of a network is given by the number of bits that can be transmitted over the network in a certain period of time. Latency corresponds to how long it t5akes a message to travel from one end off a network to the other. It is strictly measured in terms of time.

16. Define Routing?
The process of determining systematically hoe to forward messages toward the destination nodes based on its address is called routing.

17. What is a peer-peer process?
The processes on each machine that communicate at a given layer are called peer-peer process.

18. When a switch is said to be congested?
It is possible that a switch receives packets faster than the shared link can accommodate and stores in its memory, for an extended period of time, then the switch will eventually run out of buffer space, and some packets will have to be dropped and in this state is said to congested state.

19. What is semantic gap?
Defining a useful channel involves both understanding the applications requirements and recognizing the limitations of the underlying technology. The gap between what applications expects and what the underlying technology can provide is called semantic gap.

20. What is Round Trip Time?
The duration of time it takes to send a message from one end of a network to the other and back, is called RTT.

21. Define the terms Unicasting, Multiccasting and Broadcasting?

  • If the message is sent from a source to a single destination node, it is called Unicasting.
  • If the message is sent to some subset of other nodes, it is called Multicasting.
  • If the message is sent to all the m nodes in the network it is called Broadcasting.

22. What is Multiplexing?
Multiplexing is the set of techniques that allows the simultaneous transmission of multiple signals across a single data link.

23. Name the categories of Multiplexing?

A. Frequency Division Multiplexing (FDM)
B. Time Division Multiplexing (TDM)

  • Synchronous TDM
  • ASynchronous TDM Or Statistical TDM.

C. Wave Division Multiplexing (WDM)

24. What is FDM?
FDM is an analog technique that can be applied when the bandwidth of a link is greater than the combined bandwidths of the signals to be transmitted.

25. What is WDM?
WDM is conceptually the same as FDM, except that the multiplexing and demultiplexing involve light signals transmitted through fiber optics channel.

26. What is TDM?
TDM is a digital process that can be applied when the data rate capacity of the transmission medium is greater than the data rate required by the sending and receiving devices.

27. What is Synchronous TDM?
In STDM, the multiplexer allocates exactly the same time slot to each device at all times, whether or not a device has anything to transmit.

28. List the layers of OSI

  • Physical Layer
  • Data Link Layer
  • Network Layer
  • Transport Layer
  • Session Layer
  • Presentation Layer
  • Application Layer

29. Which layers are network support layers?

  1. Physical Layer
  2. Data link Layer and
  3. Network Layers

30. Which layers are user support layers?

  • Session Layer
  • Presentation Layer and
  • Application Layer

31. Which layer links the network support layers and user support layers?
The Transport layer links the network support layers and user support layers.

32. What are the concerns of the Physical Layer?
Physical layer coordinates the functions required to transmit a bit stream over a physical medium.

  1. Physical characteristics of interfaces and media
  2. Representation of bits
  3. Data rate
  4. Synchronization of bits
  5. Line configuration
  6. Physical topology
  7. Transmission mode

33. What are the responsibilities of Data Link Layer?
The Data Link Layer transforms the physical layer, a raw transmission facility, to a reliable link and is responsible for node-node delivery.

  • Framing
  • Physical Addressing
  • Flow Control
  • Error Control
  • Access Control

34. What are the responsibilities of Network Layer?
The Network Layer is responsible for the source-to-destination delivery of packet possibly across multiple networks (links).
a. Logical Addressing
b. Routing

35. What are the responsibilities of Transport Layer?
The Transport Layer is responsible for source-to-destination delivery of the entire message.

  • Service-point Addressing
  • Segmentation and reassembly
  • Connection Control
  • Flow Control
  • Error Control

36. What are the responsibilities of Session Layer?
The Session layer is the network dialog Controller. It establishes, maintains and synchronizes the interaction between the communicating systems.

  1. Dialog control
  2. Synchronization

37. What are the responsibilities of Presentation Layer?
The Presentation layer is concerned with the syntax and semantics of the information exchanged between two systems.

  1. Translation
  2. Encryption
  3. Compression

38. What are the responsibilities of Application Layer?
The Application Layer enables the user, whether human or software, to access the network. It provides user interfaces and support for services such as e-mail, shared database management and other types of distributed information services.

  • Network virtual Terminal
  • File transfer, access and Management (FTAM)
  • Mail services
  • Directory Services

39. What are the two classes of hardware building blocks?
Nodes and Links.

40. What are the different link types used to build a computer network?

  • Cables
  • Leased Lines
  • Last-Mile Links
  • Wireless Links

41. What are the categories of Transmission media?
a. Guided Media
i. Twisted – Pair cable
1. Shielded TP
2. Unshielded TP
ii. Coaxial Cable
iii. Fiber-optic cable
b. Unguided Media
i. Terrestrial microwave
ii. Satellite Communication

42. What are the types of errors?

  • Single-Bit error : In a single-bit error, only one bit in the data unit has changed
  • Burst Error : A Burst error means that two or more bits in the data have changed.

43. What is Error Detection? What are its methods?
Data can be corrupted during transmission. For reliable communication errors must be deducted and Corrected. Error Detection uses the concept of redundancy, which means adding extra bits for detecting errors at the destination. The common Error Detection methods are

  • Vertical Redundancy Check (VRC)
  • Longitudinal Redundancy Check (VRC)
  • Cyclic Redundancy Check (VRC)
  • Checksum

44. What is Redundancy?
The concept of including extra information in the transmission solely for the purpose of comparison. This technique is called redundancy.

45. What is VRC?
It is the most common and least expensive mechanism for Error Detection. In VRC, a parity bit is added to every data unit so that the total number of 1s becomes even for even parity. It can detect all single-bit errors. It can detect burst errors only if the total number of errors in each data unit is odd.

46. What is LRC?
In LRC, a block of bits is divided into rows and a redundant row of bits is added to the whole block. It can detect burst errors. If two bits in one data unit are damaged and bits in exactly the same positions in another data unit are also damaged, the LRC checker will not detect an error. In LRC a redundant data unit follows n data units.

47. What is CRC?
CRC, is the most powerful of the redundancy checking techniques, is based on binary division.

48. What is Checksum?
Checksum is used by the higher layer protocols (TCP/IP) for error detection

49. List the steps involved in creating the checksum.
a. Divide the data into sections
b. Add the sections together using 1’s complement arithmetic
c. Take the complement of the final sum, this is the checksum.

50. What are the Data link protocols?
Data link protocols are sets of specifications used to implement the data link layer. The categories of Data Link protocols are

  1. Asynchronous Protocols
  2. Synchronous Protocols
    a. Character Oriented Protocols
    b. Bit Oriented protocols

51. Compare Error Detection and Error Correction:
The correction of errors is more difficult than the detection. In error detection, checks only any error has occurred. In error correction, the exact number of bits that are corrupted and location in the message are known. The number of the errors and the size of the message are important factors.

52. What is Forward Error Correction?
Forward error correction is the process in which the receiver tries to guess the message by using redundant bits.

53. Define Retransmission?
Re transmission is a technique in which the receiver detects the occurrence of an error and asks the sender to resend the message. Re sending is repeated until a message arrives that the receiver believes is error-freed.

54. What are Data Words?
In block coding, we divide our message into blocks, each of k bits, called datawords. The block coding process is one-to-one. The same dataword is always encoded as the same codeword.

55. What are Code Words?
“r” redundant bits are added to each block to make the length n = k + r. The resulting n-bit blocks are called codewords. 2n – 2k codewords that are not used. These codewords are invalid or illegal.

56. What is a Linear Block Code?
A linear block code is a code in which the exclusive OR (addition modulo-2) of two valid codewords creates another valid codeword.

57. What are Cyclic Codes?
Cyclic codes are special linear block codes with one extra property. In a cyclic code, if a codeword is cyclically shifted (rotated), the result is another codeword.

58. Define Encoder?
A device or program that uses predefined algorithms to encode, or compress audio or video data for storage or transmission use. A circuit that is used to convert between digital video and analog video.

59. Define Decoder?
A device or program that translates encoded data into its original format (e.g. it decodes the data). The term is often used in reference to MPEG-2 video and sound data, which must be decoded before it is output.

60. What is Framing?
Framing in the data link layer separates a message from one source to a destination, or from other messages to other destinations, by adding a sender address and a destination address. The destination address defines where the packet has to go and the sender address helps the recipient acknowledge the receipt.

Computer Networks VIVA Questions and Answers :-

61. What is Fixed Size Framing?
In fixed-size framing, there is no need for defining the boundaries of the frames. The size itself can be used as a delimiter.

62. Define Character Stuffing?
In byte stuffing (or character stuffing), a special byte is added to the data section of the frame when there is a character with the same pattern as the flag. The data section is stuffed with an extra byte. This byte is usually called the escape character (ESC), which has a predefined bit pattern. Whenever the receiver encounters the ESC character, it removes it from the data section and treats the next character as data, not a delimiting flag.

63. What is Bit Stuffing?
Bit stuffing is the process of adding one extra 0 whenever five consecutive Is follow a 0 in the data, so that the receiver does not mistake the pattern 0111110 for a flag.

64. What is Flow Control?
Flow control refers to a set of procedures used to restrict the amount of data that the sender can send before waiting for acknowledgment.

65. What is Error Control ?
Error control is both error detection and error correction. It allows the receiver to inform the sender of any frames lost or damaged in transmission and coordinates the retransmission of those frames by the sender. In the data link layer, the term error control refers primarily to methods of error detection and re transmission.

66. What Automatic Repeat Request (ARQ)?
Error control is both error detection and error correction. It allows the receiver to inform the sender of any frames lost or damaged in transmission and coordinates the retransmission of those frames by the sender. In the data link layer, the term error control refers primarily to methods of error detection and retransmission. Error control in the data link layer is often implemented simply: Any time an error is detected in an exchange, specified frames are retransmitted. This process is called automatic repeat request (ARQ).

67. What is Stop-and-Wait Protocol?
In Stop and wait protocol, sender sends one frame, waits until it receives confirmation from the receiver (okay to go ahead), and then sends the next frame.

68. What is Stop-and-Wait Automatic Repeat Request?
Error correction in Stop-and-Wait ARQ is done by keeping a copy of the sent frame and retransmitting of the frame when the timer expires.

69. What is usage of Sequence Number in Relaible Transmission?
The protocol specifies that frames need to be numbered. This is done by using sequence numbers. A field is added to the data frame to hold the sequence number of that frame. Since we want to minimize the frame size, the smallest range that provides unambiguous communication. The sequence numbers can wrap around.

70. What is Pipelining ?
In networking and in other areas, a task is often begun before the previous task has ended. This is known as pipelining.

71. What is Sliding Window?
The sliding window is an abstract concept that defines the range of sequence numbers that is the concern of the sender and receiver. In other words, he sender and receiver need to deal with only part of the possible sequence numbers.

72. What is Piggy Backing?
A technique called piggybacking is used to improve the efficiency of the bidirectional protocols. When a frame is carrying data from A to B, it can also carry control information about arrived (or lost) frames from B; when a frame is carrying data from B to A, it can also carry control information about the arrived (or lost) frames from A.

73. What are the two types of transmission technology available?
(i) Broadcast and (ii) point-to-point

74. What is subnet?
A generic term for section of a large networks usually separated by a bridge or router.

75. Difference between the communication and transmission.
Transmission is a physical movement of information and concern issues like bit polarity, synchronisation, clock etc.
Communication means the meaning full exchange of information between two communication media.

76. What are the possible ways of data exchange?
(i) Simplex (ii) Half-duplex (iii) Full-duplex.

77. What is SAP?
Series of interface points that allow other computers to communicate with the other layers of network protocol stack.

78. What do you meant by “triple X” in Networks?
The function of PAD (Packet Assembler Disassembler) is described in a document known as X.3. The standard protocol has been defined between the terminal and the PAD, called X.28; another standard protocol exists between hte PAD and the network, called X.29. Together, these three recommendations are often called “triple X”.

79. What is frame relay, in which layer it comes?
Frame relay is a packet switching technology. It will operate in the data link layer.

80. What is terminal emulation, in which layer it comes?
Telnet is also called as terminal emulation. It belongs to application layer.

81. What is Beaconing?
The process that allows a network to self-repair networks problems. The stations on the network notify the other stations on the ring when they are not receiving the transmissions. Beaconing is used in Token ring and FDDI networks.

82. What is redirector?
Redirector is software that intercepts file or prints I/O requests and translates them into network requests. This comes under presentation layer.

83. What is NETBIOS and NETBEUI?

  • NETBIOS is a programming interface that allows I/O requests to be sent to and received from a remote computer and it hides the networking hardware from applications.
  • NETBEUI is NetBIOS extended user interface. A transport protocol designed by microsoft and IBM for the use on small subnets.

84. What is RAID?
A method for providing fault tolerance by using multiple hard disk drives.

85. What is passive topology?
When the computers on the network simply listen and receive the signal, they are referred to as passive because they don’t amplify the signal in any way. Example for passive topology -linear bus.

86. What is Brouter?
Hybrid devices that combine the features of both bridges and routers.

87. What is cladding?
A layer of a glass surrounding the center fiber of glass inside a fiber-optic cable.

88. What is point-to-point protocol?
A communications protocol used to connect computers to remote networking services including Internet service providers.

89. How Gateway is different from Routers?
A gateway operates at the upper levels of the OSI model and translates information between two completely different network architectures or data formats.

90. What is attenuation?
The degeneration of a signal over distance on a network cable is called attenuation.

91. What is MAC address?
The address for a device as it is identified at the Media Access Control (MAC) layer in the network architecture. MAC address is usually stored in ROM on the network adapter card and is unique.

92. Difference between bit rate and baud rate.
Bit rate is the number of bits transmitted during one second whereas baud rate refers to the number of signal units per second that are required to represent those bits.
baud rate = (bit rate / N)
where N is no-of-bits represented by each signal shift.

93. What is Bandwidth?
Every line has an upper limit and a lower limit on the frequency of signals it can carry. This limited range is called the bandwidth.

94. What are the types of Transmission media?
Signals are usually transmitted over some transmission media that are broadly classified in to two categories.
a.) Guided Media: These are those that provide a conduit from one device to another that include twisted-pair, coaxial cable and fiber-optic cable. A signal traveling along any of these media is directed and is contained by the physical limits of the medium. Twisted-pair and coaxial cable use metallic that accept and transport signals in the form of electrical current. Optical fiber is a glass or plastic cable that accepts and transports signals in the form of light.
b.) Unguided Media: This is the wireless media that transport electromagnetic waves without using a physical conductor. Signals are broadcast either through air. This is done through radio communication, satellite communication and cellular telephony.

95. What is Project 802?
It is a project started by IEEE to set standards to enable intercommunication between equipment from a variety of manufacturers. It is a way for specifying functions of the physical layer, the data link layer and to some extent the network layer to allow for interconnectivity of major LAN protocols.
It consists of the following:
1. 802.1 is an internetworking standard for compatibility of different LANs and MANs across protocols.
2. 802.2 Logical link control (LLC) is the upper sublayer of the data link layer which is non-architecture-specific, that is remains the same for all IEEE-defined LANs.
3. Media access control (MAC) is the lower sublayer of the data link layer that contains some distinct modules each carrying proprietary information specific to the LAN product being used. The modules are Ethernet LAN (802.3), Token ring LAN (802.4), Token bus LAN (802.5).
4. 802.6 is distributed queue dual bus (DQDB) designed to be used in MANs.

96. What is Protocol Data Unit?
The data unit in the LLC level is called the protocol data unit (PDU). The PDU contains of four fields a destination service access point (DSAP), a source service access point (SSAP), a control field and an information field. DSAP, SSAP are addresses used by the LLC to identify the protocol stacks on the receiving and sending machines that are generating and using the data. The control field specifies whether the PDU frame is a information frame (I – frame) or a supervisory frame (S – frame) or a unnumbered frame (U – frame).

97. What are the different type of networking / internetworking devices?
1. Repeater: Also called a regenerator, it is an electronic device that operates only at physical layer. It receives the signal in the network before it becomes weak, regenerates the original bit pattern and puts the refreshed copy back in to the link.
2. Bridges: These operate both in the physical and data link layers of LANs of same type. They divide a larger network in to smaller segments. They contain logic that allow them to keep the traffic for each segment separate and thus are repeaters that relay a frame only the side of the segment containing the intended recipent and control congestion.
3. Routers: They relay packets among multiple interconnected networks (i.e. LANs of different type). They operate in the physical, data link and network layers. They contain software that enable them to determine which of the several possible paths is the best for a particular transmission.
4. Gateways: They relay packets among networks that have different protocols (e.g. between a LAN and a WAN). They accept a packet formatted for one protocol and convert it to a packet formatted for another protocol before forwarding it. They operate in all seven layers of the OSI model.

98. What is ICMP?
ICMP is Internet Control Message Protocol, a network layer protocol of the TCP/IP suite used by hosts and gateways to send notification of datagram problems back to the sender. It uses the echo test / reply to test whether a destination is reachable and responding. It also handles both control and error messages.

99. What are the data units at different layers of the TCP / IP protocol suite?
The data unit created at the application layer is called a message, at the transport layer the data unit created is called either a segment or an user datagram, at the network layer the data unit created is called the datagram, at the data link layer the datagram is encapsulated in to a frame and finally transmitted as signals along the transmission media.

100. What is difference between ARP and RARP?

  • The address resolution protocol (ARP) is used to associate the 32 bit IP address with the 48 bit physical address, used by a host or a router to find the physical address of another host on its network by sending a ARP query packet that includes the IP address of the receiver.
  • The reverse address resolution protocol (RARP) allows a host to discover its Internet address when it knows only its physical address.

101. What is the minimum and maximum length of the header in the TCP segment and IP datagram?
The header should have a minimum length of 20 bytes and can have a maximum length of 60 bytes.

102. What is the range of addresses in the classes of internet addresses?
Class A – 0.0.0.0 – 127.255.255.255
Class B – 128.0.0.0 – 191.255.255.255
Class C – 192.0.0.0 – 223.255.255.255
Class D – 224.0.0.0 – 239.255.255.255
Class E – 240.0.0.0 – 247.255.255.255

103. What is the difference between TFTP and FTP application layer protocols?
The Trivial File Transfer Protocol (TFTP) allows a local host to obtain files from a remote host but does not provide reliability or security. It uses the fundamental packet delivery services offered by UDP.
The File Transfer Protocol (FTP) is the standard mechanism provided by TCP / IP for copying a file from one host to another. It uses the services offer by TCP and so is reliable and secure. It establishes two connections (virtual circuits) between the hosts, one for data transfer and another for control information.

104. What are major types of networks and explain?

  • Server-based network: provide centralized control of network resources and rely on server computers to provide security and network administration
  • Peer-to-peer network: computers can act as both servers sharing resources and as clients using the resources.

105. What are the important topologies for networks?

  1. BUS topology: In this each computer is directly connected to primary network cable in a single line.
    Advantages: Inexpensive, easy to install, simple to understand, easy to extend.
  2. STAR topology: In this all computers are connected using a central hub.
    Advantages: Can be inexpensive, easy to install and reconfigure and easy to trouble shoot physical problems.
  3. RING topology: In this all computers are connected in loop. Advantages: All computers have equal access to network media, installation can be simple, and signal does not degrade as much as in other topologies because each computer regenerates it.

106. What is mesh network?
A network in which there are multiple network links between computers to provide multiple paths for data to travel.

107. What is difference between baseband and broadband transmission?
In a baseband transmission, the entire bandwidth of the cable is consumed by a single signal. In broadband transmission, signals are sent on multiple frequencies, allowing multiple signals to be sent simultaneously.

108. Explain 5-4-3 rule?
In a Ethernet network, between any two points on the network ,there can be no more than five network segments or four repeaters, and of those five segments only three of segments can be populated.

109. What MAU?
In token Ring , hub is called Multistation Access Unit(MAU).

110. What is the difference between routable and non- routable protocols?
Routable protocols can work with a router and can be used to build large networks. Non-Routable protocols are designed to work on small, local networks and cannot be used with a router.

111. Why should you care about the OSI Reference Model?
It provides a framework for discussing network operations and design.

112. What is logical link control?
One of two sublayers of the data link layer of OSI reference model, as defined by the IEEE 802 standard. This sublayer is responsible for maintaining the link between computers when they are sending data across the physical network connection.

113. What is virtual channel?
Virtual channel is normally a connection from one source to one destination, although multicast connections are also permitted. The other name for virtual channel is virtual circuit.

114. What is virtual path?
Along any transmission path from a given source to a given destination, a group of virtual circuits can be grouped together into what is called path.

115. What is packet filter?
Packet filter is a standard router equipped with some extra functionality. The extra functionality allows every incoming or outgoing packet to be inspected. Packets meeting some criterion are forwarded normally. Those that fail the test are dropped.

116. What is traffic shaping?
One of the main causes of congestion is that traffic is often busy. If hosts could be made to transmit at a uniform rate, congestion would be less common. Another open loop method to help manage congestion is forcing the packet to be transmitted at a more predictable rate. This is called traffic shaping.

117. What is multicast routing?
Sending a message to a group is called multicasting, and its routing algorithm is called multicast routing.

118. What is region?
When hierarchical routing is used, the routers are divided into what we will call regions, with each router knowing all the details about how to route packets to destinations within its own region, but knowing nothing about the internal structure of other regions.

119. What is silly window syndrome?
It is a problem that can ruin TCP performance. This problem occurs when data are passed to the sending TCP entity in large blocks, but an interactive application on the receiving side reads 1 byte at a time.

120. What are Digrams and Trigrams?
The most common two letter combinations are called as digrams. e.g. th, in, er, re and an. The most common three letter combinations are called as trigrams. e.g. the, ing, and, and ion.

Computer Networks VIVA Questions with Answers pdf download

200+ TOP OOPS LAB VIVA Questions and Answers Pdf

OOPS LAB VIVA Questions :-

1. What is OOPS?
OOPS is abbreviated as Object Oriented Programming system in which programs are considered as a collection of objects. Each object is nothing but an instance of a class.

2. Write basic concepts of OOPS?
Following are the concepts of OOPS and are as follows:.

  • Abstraction.
  • Encapsulation.
  • Inheritance.
  • Polymorphism.

3. What is a class?
A class is simply a representation of a type of object. It is the blueprint/ plan/ template that describe the details of an object.

4. What is an object?
Object is termed as an instance of a class, and it has its own state, behavior and identity.

5. What is Encapsulation?
Encapsulation is an attribute of an object, and it contains all data which is hidden. That hidden data can be restricted to the members of that class.

6. What is Polymorphism?
Polymorphism is nothing butassigning behavior or value in a subclass to something that was already declared in the main class. Simply, polymorphism takes more than one form.

7. What is Inheritance?
Inheritance is a concept where one class shares the structure and behavior defined in another class. Ifinheritance applied on one class is called Single Inheritance, and if it depends on multiple classes, then it is called multiple Inheritance.

8. What are manipulators?
Manipulators are the functions which can be used in conjunction with the insertion (<<) and extraction (>>) operators on an object. Examples are endl and setw.

9. Define a constructor?
Constructor is a method used to initialize the state of an object, and it gets invoked at the time of object creation.

10. Define Destructor?
Destructor is a method which is automatically called when the object ismade ofscope or destroyed. Destructor name is also same asclass name but with the tilde symbol before the name.

11. What is Inline function?
Inline function is a technique used by the compilers and instructs to insert complete body of the function wherever that function is used in the program source code.

12. What is avirtual function?
Virtual function is a member function ofclass and its functionality can be overridden in its derived class. This function can be implemented by using a keyword called virtual, and it can be given during function declaration.Virtual function can be achieved in C++, and it can be achieved in C Language by using function pointers or pointers to function.

13. What isfriend function?

Friend function is a friend of a class that is allowed to access to Public, private or protected data in that same class. If the function is defined outside the class cannot access such information.
Friend can be declared anywhere in the class declaration, and it cannot be affected by access control keywords like private, public or protected.

14. What is function overloading?
Function overloading is defined as a normal function, but it has the ability to perform different tasks. It allows creation of several methods with the same name which differ from each other by type of input and output of the function.
Example:
void add(int& a, int& b);
void add(double& a, double& b);
void add(struct bob& a, struct bob& b);

15. What is operator overloading?
Operator overloading is a function where different operators are applied and depends on the arguments. Operator,-,* can be used to pass through the function , and it has their own precedence to execute.

Example:
class complex {
double real, imag;

public:
complex(double r, double i) :
real(r), imag(i) {}
complex operator+(complex a, complex b);
complex operator*(complex a, complex b);
complex& operator=(complex a, complex b);
}

a=1.2, b=6

16. What is an abstract class?
An abstract class is a class which cannot be instantiated. Creation of an object is not possible withabstract class , but it can be inherited. An abstract class can be contain members, methods and also Abstract method.

A method that is declared as abstract and does not have implementation is known as abstract method.

Syntax:
abstract void show(); //no body and abstract keyword

17. What is a ternary operator?
Ternary operator is said to be an operator which takes three arguments. Arguments and results are of different data types , and it is depends on the function. Ternary operator is also called asconditional operator.

18. What is the use of finalize method?
Finalize method helps to perform cleanup operations on the resources which are not currently used. Finalize method is protected , and it is accessible only through this class or by a derived class.

19. What are different types of arguments?
A parameter is a variable used during the declaration of the function or subroutine and arguments are passed to the function , and it should match with the parameter defined. There are two types of Arguments.
Call by Value – Value passed will get modified only inside the function , and it returns the same value whatever it is passed it into the function.
Call by Reference – Value passed will get modified in both inside and outside the functions and it returns the same or different value.

20. What is super keyword?
Super keyword is used to invoke overridden method which overrides one of its superclass methods. This keyword allows to access overridden methods and also to access hidden members of the super class.It also forwards a call from a constructor to a constructor in the super class.

21. What is method overriding?
Method overriding is a feature that allows sub class to provide implementation of a method that is already defined in the main class. This will overrides the implementation in the superclass by providing the same method name, same parameter and same return type.

22. What is an interface?
An interface is a collection of abstract method. If the class implements an inheritance, and then thereby inherits all the abstract methods of an interface.

23. What is exception handling?
Exception is an event that occurs during the execution of a program. Exceptions can be of any type – Run time exception, Error exceptions. Those exceptions are handled properly through exception handling mechanism like try, catch and throw keywords.

24. What are tokens?

Token is recognized by a compiler and it cannot be broken down into component elements. Keywords, identifiers, constants, string literals and operators are examples of tokens.
Even punctuation characters are also considered as tokens – Brackets, Commas, Braces and Parentheses.

25. Difference between overloading and overriding?

Overloading is static binding whereas Overriding is dynamic binding. Overloading is nothing but the same method with different arguments , and it may or may not return the same value in the same class itself.
Overriding is the same method names with same arguments and return types associates with the class and its child class.

OOPS VIVA Questions pdf :-

26. Difference between class and an object?

An object is an instance of a class. Objects hold any information , but classes don’t have any information. Definition of properties and functions can be done at class and can be used by the object.
Class can have sub-classes, and an object doesn’t have sub-objects.

27. What is an abstraction?
Abstraction is a good feature of OOPS , and it shows only the necessary details to the client of an object. Means, it shows only necessary details for an object, not the inner details of an object. Example – When you want to switch On television, it not necessary to show all the functions of TV. Whatever is required to switch on TV will be showed by using abstract class.

28. What are access modifiers?
Access modifiers determine the scope of the method or variables that can be accessed from other various objects or classes. There are 5 types of access modifiers , and they are as follows:.

  • Private.
  • Protected.
  • Public.
  • Friend.
  • Protected Friend.

29. What is sealed modifiers?
Sealed modifiers are the access modifiers where it cannot be inherited by the methods. Sealed modifiers can also be applied to properties, events and methods. This modifier cannot be applied to static members.

30. How can we call the base method without creating an instance?
Yes, it is possible to call the base method without creating an instance. And that method should be,.Static method.Doing inheritance from that class.-Use Base Keyword from derived class.

31. What is the difference between new and override?
The new modifier instructs the compiler to use the new implementation instead of the base class function. Whereas, Override modifier helps to override the base class function.

32. What are the various types of constructors?
There are three various types of constructors , and they are as follows:.

  1. Default Constructor – With no parameters.
  2. Parametric Constructor – With Parameters. Create a new instance of a class and also passing arguments simultaneously.
  3. Copy Constructor – Which creates a new object as a copy of an existing object.

33. What is early and late binding?
Early binding refers to assignment of values to variables during design time whereas late binding refers to assignment of values to variables during run time.

34. What is ‘this’ pointer?
THIS pointer refers to the current object of a class. THIS keyword is used as a pointer which differentiates between the current object with the global object. Basically, it refers to the current object.

35. What is the difference between structure and a class?

  • Structure default access type is public , but class access type is private. A structure is used for grouping data whereas class can be used for grouping data and methods.
  • Structures are exclusively used for data and it doesn’t require strict validation , but classes are used to encapsulates and inherit data which requires strict validation.

36. What is the default access modifier in a class?
The default access modifier of a class is Private by default.

37. What is pure virtual function?
A pure virtual function is a function which can be overridden in the derived class but cannot be defined. A virtual function can be declared as Pure by using the operator =0.

Example -.
Virtual void function1() // Virtual, Not pure
Virtual void function2() = 0 //Pure virtual

38. What are all the operators that cannot be overloaded?
Following are the operators that cannot be overloaded -.

Scope Resolution (:: )
Member Selection (.)
Member selection through a pointer to function (.*)

39. What is dynamic or run time polymorphism?
Dynamic or Run time polymorphism is also known as method overriding in which call to an overridden function is resolved during run time, not at the compile time. It means having two or more methods with the same name,same signature but with different implementation.

40. Do we require parameter for constructors?
No, we do not require parameter for constructors.

41. What is a copy constructor?
This is a special constructor for creating a new object as a copy of an existing object. There will be always only on copy constructor that can be either defined by the user or the system.

42. What does the keyword virtual represented in the method definition?
It means, we can override the method.

43. Whether static method can use non static members?
False.

44. What arebase class, sub class and super class?

  • Base class is the most generalized class , and it is said to be a root class.
  • Sub class is a class that inherits from one or more base classes.
  • Super class is the parent class from which another class inherits.

45. What is static and dynamic binding?

Binding is nothing but the association of a name with the class. Static binding is a binding in which name can be associated with the class during compilation time , and it is also called as early Binding.
Dynamic binding is a binding in which name can be associated with the class during execution time , and it is also called as Late Binding.

46. How many instances can be created for an abstract class?
Zero instances will be created for an abstract class.

47. Which keyword can be used for overloading?
Operator keyword is used for overloading.

48. What is the default access specifier in a class definition?
Private access specifier is used in a class definition.

49. Which OOPS concept is used as reuse mechanism?
Inheritance is the OOPS concept that can be used as reuse mechanism.

50. Which OOPS concept exposes only necessary information to the calling functions?
Data Hiding / Abstraction

200+ TOP CAO LAB VIVA Questions And Answers

CAO LAB VIVA Questions with Answers :-

1. What are the types of computer?
Personal computer, notebook computer, workstations, enterprise or mainframes.

2. What are the functional units of a computer?
Input unit, memory unit, arithmetic and logic unit, output unit and control unit.

3. What is a program?
A list of instructions that performs a task is called a program. Usually the program is stored in memory.

4. What is object program?
Compiling a high-level language source program in to a list of machine instructions constituting a machine language program is called an object program. It is the assembled machine language program.

5. What do you mean by bits?
Each number, character, or instruction is encoded as a string of binary digits called as bits, each having one of two possible values, 0 or 1.

6. Define RAM.
Memory in which any location can be reached in a short fixed time after specifying its address is called random-access memory (RAM).

7. Define word length.
The number of bits in each word is often referred to as the word length of the computer. Typical word lengths range from 16 to 64 bits.

8. Define memory access time?
The time required to access one word is called as memory access time. This time is fixed and independent of the location of the word being accessed. It typically ranges from a few nanoseconds (ns) to about 100 ns for modern RAM units.

9. What is memory hierarchy?
The memory of a computer is normally implemented as a memory hierarchy of three or four levels of semiconductor RAM units with different speeds and sizes. The small, fast RAM units are called caches. The large and slowest unit is referred to as main memory.

10. What is primary storage and secondary storage?
Primary memory is a fast memory that operates at electronic speeds. It is expensive. Secondary memory is used when large amounts of data and many programs have to be stored, particularly for information that is accessed infrequently.

11. What are registers?
Registers are high speed storage elements. Each register can store one word of data. Access time to registers is faster than access time to the fastest cache memory.

12. What are timing signals?
Timing signals are generated by the control circuits. These are signals that determine when a given action should take place. Data transfers between the processor and memory are also controlled by the control unit through the timing signals.

13. Explain briefly the operation of Add LOCA, R0.
This instruction adds the operand at memory location LOCA to the operand in a register in the processor, R0, and places the sum in to register R0. The original contents of location LOCA are preserved, whereas those of R0 are overwritten.

14. What is instruction register?
The instruction register (IR) holds the instruction that is currently being executed. Its output is available to the control circuits which generate the timing signals that control the various processing elements involved in executing the instruction.

15. What is program counter?
The program counter (PC) keeps track of the execution of a program. It contains the memory address of the next instruction to be fetched and executed.

16. What is MAR and MDR?
The memory address register (MAR) holds the address of the location to be accessed. The memory data register (MDR) contains the data to be written into or read out of the addressed location.

17. What is an interrupt?
An interrupt is a request from an I/O device for service by the processor. The processor provides the requested service by executing an appropriate interrupt-service routine.

18. Define bus.
A group of lines that serves as a connecting path for several devices is called a bus. In addition to the lines that carry data, the bus must have lines for address and control purposes.

19. What is a compiler?
It is a system software program that translates the high-level language program into a suitable machine language program.

20. What is a text editor?
It is a system program used for entering and editing application programs.

21. What is a file?
A file is simply a sequence of alphanumeric characters or binary data that is stored in memory or in secondary storage. A file can be referred by a name chosen by the user.

22. Define OS.
Operating system (OS) is a large program, or a collection of routines, that is used to control the sharing of and interaction among various computer units as they execute application programs.

23. What is multiprogramming or multitasking?
The operating system manages the concurrent execution of several application programs to make the best possible use of computer resources. This pattern of concurrent execution is called multiprogramming or multitasking.

24. What is elapsed time?
It is a measure of performance of the entire computer system. It is affected by the speed of the processor, the disk and the printer.

25. What is processor time?
The sum of the periods during which the processor is active is called the processor time.

26. What are clock and clock cycles?
The timing signals that control the processor circuits are called as clocks. The clock defines regular time intervals called clock cycles.

27. Give the basic performance equation.
T = (N * S)/R
Where, T – performance parameter
N – actual number of instruction executions
S – average number of basic steps needed to execute one machine instruction
R – clock rate in cycles per second.

28. What is pipelining?
The technique of overlapping the execution of successive instruction for substantial improvement in performance is called pipelining.

29. What is superscalar execution?
In this type of execution, multiple functional units are used to create parallel paths through which different instructions can be executed in parallel. so it is possible to start the execution of several instructions in every clock cycle. This mode of operation is called superscalar execution.

30. What is RISC and CISC?
The processors with simple instructions are called as Reduced Instruction Set Computers(RISC). The processors with more complex instructions are called as Complex Instruction Set Computers (CISC).

31. Define SPEC rating.
Running time on the reference computer
SPEC rating = Running time on the computer under test

32. Define byte addressable memory.
Byte locations have addresses 0,1,2….Thus if the word length of the machine is 32 bits, successive words are located at addresses 0,4,8….with each word consisting of 4 bytes. This is called byte addressable memory.

33. What is big-endian and little-endian?
The name big-endian is used when lower byte addresses are used for the more significant bytes (the leftmost bytes) of the word. The name little-endian is used when lower byte addresses are used for the less significant bytes (the rightmost bytes) of the word.

34. What is aligned address?
Words are said to be aligned in memory if they begin at a byte address that is a multiple of the number of bytes in a word.

35. Explain briefly the operation of ‘load’.
The load operation transfers a copy of the contents of a specific memory location to the processor. The memory contents remain unchanged. To start a load operation, the processor sends the address of the
desired location to the memory and requests that its contents be read. The memory reads the data stored at that address and sends them to the processor.

36. Explain briefly the operation of ‘store’.
The store operation transfers an item of information from the processor to a specific memory location, destroying the former contents of that location. The processor sends the address of the desired location to the memory, together with the data to be written into that memory location.

37. What is register transfer notation?
R3 <- [R1] + [R2]
This type of notation is known as register transfer instruction (RTN). The right-hand side of an RTN expression always denotes a value, and the left-hand side is the name of a location where the value is to be placed, overwriting the old contents of that location.

CAO VIVA Questions And Answers :-

38. What is a one address instruction?
The instruction that contains the memory address of only one operand is called one address instruction.
Eg. Load A, Store A.

39. What is a two address instruction?
The instruction that contains the memory address of two operands is called two byte address instruction.
Eg. Add A,B , Move B,C.

40. What is a three address instruction?
The instruction that contains the memory address of three operands is called three byte address instruction.
Eg. Add A,B,C.

41. What is a zero address instruction?
Instructions in which the locations of all operands are defined implicitly is called zero address instruction. Such instructions are found in machines that store operands in a structure called push down stack.

42. What is straight line sequencing?
To begin executing a program, the address of its first instruction must be placed into PC. Then the processor control circuits use the information in the PC to fetch and execute instructions, one at a time, in the order of increasing addresses. This is called straight line sequencing.

43. Define conditional branch.
A conditional branch instruction causes a branch only if a specified condition is satisfied. If the condition is not satisfied, the PC is incremented in the normal way and next instruction in the sequential address is
fetched and executed.

44. Define conditional code flags.
The processor keeps track of information about the results of various operations for use by subsequent conditional branch instructions. This is done by recording the required information in individual bits called as conditional code flags.

45. Define conditional code register (OR) status register.
The conditional code flags are usually grouped together in a special processor register called conditional code registers or status registers.

46. What are the four commonly used flags?

  • N (negative) – set to 1 if the result is negative; otherwise, cleared to 0
  • Z (zero)- set to 1 if the result is 0; otherwise, cleared to 0
  • V (overflow) – set to 1 if arithmetic overflow occurs; otherwise, cleared to 0
  • C (carry)- set to 1 if the carry-out results from the operation; otherwise, cleared to 0

47. What is addressing modes?
The different ways in which the location of a operand is specified in an instruction is referred to as addressing modes.

48. What are the various addressing modes?
Register mode, absolute mode, immediate mode, indirect mode, index mode, relative mode, auto increment mode, auto decrement mode.

49. Define register mode addressing.
In register mode addressing the operand is the contents of a process register. The name of the register is given in the instruction.

50. Define absolute mode addressing.
In absolute mode addressing the operand is in a memory location. The address of this location is given explicitly in the instruction. This is also called direct mode addressing.

51. Define immediate mode addressing.
In immediate mode addressing, the operand is given explicitly in the instruction.
Eg. Move #200,R0.

52. Define indirect mode addressing.
In indirect mode addressing the effective address of the operands is the content of a register or memory location whose address appears in the instruction.
Eg: Add (R2),R0.

53. What is a pointer?
The register or memory location that contains the address of an operand is called a pointer.
Eg: A= *B. Here B is a pointer variable.

54. Define index mode addressing.
In index mode addressing, the effective address of the operand is generated by adding a constant value to the register.
EA= X + [Ri].

55. Define relative mode addressing.
In relative mode addressing the effective address is determined by the index mode using the program counter in the place of the general purpose register Ri.

56. Define Auto increment mode.
In this mode the effective address of the operand is the contents of a register specified in the instruction. After accessing the operand, the contents of this register are automatically incremented to point to the next item in a list. It can be written as (Ri)+.

57. Define Auto decrement mode.
In this mode the contents of a register specified in the instruction are first automatically decremented and then used as the effective address of the operand. . It can be written as -(Ri).

58. What are mnemonics?
When writing programs for a specific computer, words such as Move, Add, Increment and Branch are replaced by acronyms such as MOV, ADD, INC and BR. This is called mnemonics.

59. What is an assembler?
Programs written in assembly language can be automatically translated in to a sequence of machine instructions by a program called an assembler.

60. What is a source program?
The user program in its original alphanumeric text format is called a source program.

61. What are assembler directives?
Consider the example SUM EQU 200. This statement does not denote an instruction that will be executed when the object program is run. This will not even appear in the object program. It simply informs the assembler that the name SUM should be replaced by the value 200 wherever it appears in
the program. Such statements are called assembler directives.

62. What is symbol table?
As the assembler scans through a source program, it keeps track of all names and the numeric values that correspond to them in a table called symbol table. Thus, when a name appears a second time, it is replaced with its value from the table.

63. What is a two pass assembler?
During the first pass of the assembler it creates a complete symbol table. At the end of this pass, all the names will be assigned numeric values. The assembler then goes through the source program second time and substitutes values for all names from the symbol table. Such an assembler is called a two-pass assembler.

64. What is a loader?
The assembler stores the object program on a magnetic disk. The object program must be loaded into the memory of the computer before it is executed. For this to happen, another utility program must already be loaded in the memory. This program is called a loader.

65. What is the use of debugger program?
The debugger program enables the user to stop execution of the object program at some points of interest and to examine the contents of various processor registers and memory locations.

66. What are device interface?
The buffer registers DATAIN and DATAOUT and the status flags SIN and SOUT are part of circuitry and they are commonly known as device interface.

67. Define memory mapped I/O.
Many computers use an arrangement called memory mapped I/O in which some memory address values are used to refer to peripheral device buffer registers, such as DATAIN and DATAOUT. This no special instructions are needed to access the contents of these registers.

68. What is a stack?
A stack is a list of data elements, usually words or bytes , with the accessing restriction that elements can be added or removed at one end of the list only. This end is called the top of the stack, and the other end is called the bottom of the stack.

69. Why is stack called as last-in-first-out?
Stack is called as last-in-first-out (LIFO), because the last data item placed on the stack is the first one removed when retrieval begins. The term push is used to describe placing a new item on the stack and pop is used to describe removing the top item from the stack.

70. What is a stack pointer?
Stack pointer (SP) is a processor register that is used to keep track of the address of the element of the stack that is at the top at any given time. It could be one of the general purpose registers or a register dedicated to this function.

71. What is a queue?
Queue is a data structure similar to the stack. Here new data are added at the back (high address end) and retrieved from the front (low address end) of the queue. Queue is also called as first-in-first-out (FIFO).

CAO VIVA Questions with Answers pdf :-

200+ TOP Data Structures LAB VIVA Questions and Answers

Data Structures VIVA Questions :-

1. What is data structure?
The logical and mathematical model of a particular organization of data is called data structure. There are two types of data structure

  1. Linear
  2. Nonlinear

2. What are the goals of Data Structure?

  • 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?
Data type is a collection of values and a set of operations on these values. Abstract data type 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 parts

  1. Values definition
  2. Operation definition

4. What is the difference between a Stack and an Array?

  • Stack is a ordered collection of items
  • Stack is a dynamic object whose size is constantly changing as items are pushed and popped .
  • Stack may contain different data types
  • Stack is declared as a structure containing an array to hold the element of the stack, and an integer to indicate the current stack top within the array.

ARRAY

  • Array is an ordered collection of items
  • Array is a static object i.e. no of item is fixed and is assigned by the declaration of the array
  • It contains same data types.
  • Array can be home of a stack i.e. array can be declared large enough for maximum size of the stack.

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

6. What is sequential search?
In sequential search each item in the array is compared with the item being searched until a match 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?
When a function is called

  1. arguments are passed
  2. local variables are allocated and initialized
  3. transferring control to the function

8. What actions are performed when a function returns?

  • Return address is retrieved
  • Function’s data area is freed
  • Branch is taken to the return address

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

10. What are the advantages of linked list over array (static data structure)?
The disadvantages of array are

  • unlike linked list it is expensive to insert and delete elements in the array
  • One can’t double or triple the size of array as it occupies block of memory space.

In linked list

  • each element in list contains a field, called a link or pointer which contains the address of the next element
  • Successive element’s need not occupy adjacent space in memory.

11. Can we apply binary search algorithm to a sorted linked list, why?
No we cannot apply binary search algorithm to a sorted linked list, since there is no way of indexing the middle element in the list. This is the drawback in using linked list as a data structure.

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

13. What do you mean by garbage collection?
It is a technique in which the operating system periodically collects all the deleted space onto 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 is time consuming.

14. What do you mean by overflow and underflow?

  • 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 called underflow.

15. What are the disadvantages array implementations of linked list?

  1. The no of nodes needed can’t be predicted when the program is written.
  2. The no of nodes declared must remain allocated throughout its execution

16. What is a queue?
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?
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 types

  • Ascending priority queue- Here smallest item can be removed (insertion is arbitrary)
  • Descending priority queue- Here largest item can be removed (insertion is arbitrary)

18. What are the disadvantages of sequential storage?
1.Fixed amount of storage remains allocated to the data structure even if it contains less element.
2.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?

  1. A node in a linked list (info and next field) occupies more storage than a corresponding element in an array.
  2. Additional time spent in managing the available list.

20. What is dangling pointer and how to avoid it?

After a call to free(p) makes a subsequent reference to *p illegal, i.e. though the storage to p is freed but the value of p(address) remain unchanged .so the object at that address may be used as the value of *p (i.e. there is no way to detect the illegality).Here p is called dangling pointer.
To avoid this it is better to set p to NULL after executing free(p).The null pointer value doesn’t reference a storage location it is a pointer that doesn’t point to anything.

21. What are the disadvantages of linear list?

  1. We cannot reach any of the nodes that precede node (p)
  2. If a list is traversed, the external pointer to the list must be persevered in order to reference the list again

22. Define circular list?
In linear list the next field of the last node contain a null pointer, when a next field in the last 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?

  1. We can’t traverse the list backward
  2. If a pointer to a node is given we cannot delete the node

24. Define double linked list?
It is a collection of data elements called nodes, where each node is divided into three parts

  1. An info field that contains the information stored in the node
  2. Left field that contain pointer to node on left side
  3. Right field that contain pointer to node on right side

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

26. What are the issues that hamper the efficiency in sorting a file?
The issues are

  1. Length of time required by the programmer in coding a particular sorting program
  2. Amount of machine time necessary for running the particular program
  3. The amount of space necessary for the particular program .

27. Calculate the efficiency of sequential search?
The number of comparisons depends on where the record with the argument key appears in the table

  1. If it appears at first position then one comparison
  2. If it appears at last position then n comparisons
  3. Average=(n+1)/2 comparisons
  4. Unsuccessful search n comparisons
  5. Number of comparisons in any case is O (n).

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

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

30. List out the areas in which data structures are applied extensively?

  • 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?
RDBMS – Array (i.e. Array of structures)
Network data model – Graph
Hierarchical data model – Trees

32. If you are using C language to implement the heterogeneous linked list, what pointer type will you use?
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 void pointer. 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?
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?

Stack. Because of its LIFO (Last In First Out) property it remembers its ‘caller’ so knows whom to return when the function has to return. Recursion makes use of system stack for storing the return addresses of the function calls.
Every recursive function has its equivalent iterative (non-recursive) function. Even when such equivalent iterative procedures are written, explicit stack is to be used.

35. What are the notations used in Evaluation of Arithmetic Expressions using prefix and postfix forms?
Polish and Reverse Polish notations.

36. Convert the expression ((A + B) * C – (D – E) ^ (F + G)) to equivalent Prefix and Postfix notations?
1.Prefix Notation:
^ – * +ABC – DE + FG
2.Postfix Notation:
AB + C * DE – – FG + ^

37. Sorting is not possible by using which of the following methods?
(a) Insertion
(b) Selection
(c) Exchange
(d) Deletion
(d) Deletion.
Using insertion we can perform insertion sort, using selection we can perform selection sort, using exchange we can perform the bubble sort (and other similar sorting methods). But no sorting method can be done just using deletion.

38. List out few of the Application of tree data-structure?

The manipulation of Arithmetic expression,
Symbol Table construction,
Syntax analysis.

39. List out few of the applications that make use of Multilinked Structures?
Sparse matrix, Index generation.

40. in tree construction which is the suitable efficient data structure?
(A) Array (b) Linked list (c) Stack (d) Queue (e) none
(b) Linked list

41. What is the type of the algorithm used in solving the 8 Queens problem?
Backtracking

42. In an AVL tree, at what condition the balancing is to be done?
If the ‘pivotal value’ (or the ‘Height factor’) is greater than 1 or less than –1.

43. In RDBMS, what is the efficient data structure used in the internal storage representation?
B+ tree. Because in B+ tree, all the data is stored only in leaf nodes, that makes searching easier. This corresponds to the records that shall be stored in leaf nodes.

45. One of the following tree structures, which is, efficient considering space and time complexities?
a) Incomplete Binary Tree.
b) Complete Binary Tree.
c) Full Binary Tree.
b) Complete Binary Tree.
By the method of elimination:
Full binary tree loses its nature when operations of insertions and deletions are done. For incomplete binary trees,
extra property of complete binary tree is maintained even after operations like additions and deletions are done on it.

46. What is a spanning Tree?
A spanning tree is a tree associated with a network. All the nodes of the graph appear on the tree once. A minimum spanning tree is a spanning tree organized so that the total edge weight between nodes is minimized.

47. Does the minimum spanning tree of a graph give the shortest distance between any 2 specified nodes?
No.Minimal spanning tree assures that the total weight of the tree is kept at its minimum. But it doesn’t mean that the distance between any two nodes involved in the minimum-spanning tree is minimum.

48. Whether Linked List is linear or Non-linear data structure?
According to Storage Linked List is a Non-linear one.

400+ TOP JAVA LAB VIVA Questions and Answers Pdf

JAVA LAB VIVA Questions with Answers :-

1. What is Java?
Java is a high-level programming language originally developed by Sun Microsystems and released in 1995. Java runs on a variety of platforms, such as Windows, Mac OS, and the various versions of UNIX.

2. What is the most important feature of Java?
Java is a platform independent language.

3. What do you mean by platform independence?
Platform independence means that we can write and compile the java code in one platform (eg Windows) and can execute the class in any other supported platform eg (Linux,Solaris,etc).

4. What are the supported platforms by Java Programming Language?
Java runs on a variety of platforms, such as Windows, Mac OS, and the various versions of UNIX/Linux like HP-Unix, Sun Solaris, Redhat Linux, Ubuntu, CentOS, etc.

5. What is the difference between a JDK and a JVM?
JDK is Java Development Kit which is for development purpose and it includes execution environment also. But JVM is purely a run time environment and hence you will not be able to compile your source files using a JVM.

      Click Here   —————->JAVA Interview Questions<———————–

6. What are the access modifiers in Java?
There are 3 access modifiers. Public, protected and private, and the default one if no identifier is specified is called friendly, but programmer cannot specify the friendly identifier explicitly.

7. What is are packages?
A package is a collection of related classes and interfaces providing access protection and namespace management.

8. What is meant by Inheritance and what are its advantages?
Inheritance is the process of inheriting all the features from a class. The advantages of inheritance are reusability of code and accessibility of variables and methods of the super class by sub classes.

9. What is the difference between superclass and subclass?
A super class is a class that is inherited whereas sub class is a class that does the inheriting.

10. What is an abstract class?
An abstract class is a class designed with implementation gaps for sub classes to fill in and is deliberately incomplete.

JAVA VIVA Questions

11. What are the states associated in the thread?
Thread contains ready, running, waiting and dead states.

12. What is synchronization?
Synchronization is the mechanism that ensures that only one thread is accessed the resources at a time.

13. What is deadlock?
When two threads are waiting each other and can’t precede the program is said to be deadlock.

14. What is an applet?
Applet is a dynamic and interactive program that runs inside a web page displayed by a java capable browser

15. What is the lifecycle of an applet?
init() method – Can be called when an applet is first loaded
start() method – Can be called each time an applet is started.
paint() method – Can be called when the applet is minimized or maximized.
stop() method – Can be used when the browser moves off the applet’s page.
destroy() method – Can be called when the browser is finished with the applet.

16. How do you set security in applets?
using setSecurity Manager() method

17. What is a layout manager and what are different types of layout managers available in java AWT?
A layout manager is an object that is used to organize components in a container. The different layouts are available are FlowLayout, BorderLayout, CardLayout, GridLayout and GridBagLayout

18. What is JDBC?
JDBC is a set of Java API for executing SQL statements. This API consists of a set of classes and interfaces to enable programs to write pure Java Database applications.

19. What are drivers available?
a) JDBC-ODBC Bridge driver b) Native API Partly-Java driver
c) JDBC-Net Pure Java driver d) Native-Protocol Pure Java driver

20. What is stored procedure?
Stored procedure is a group of SQL statements that forms a logical unit and performs a particular task. Stored Procedures are used to encapsulate a set of operations or queries to execute on database. Stored procedures can be compiled and executed with different parameters and results and may have any combination of input/output parameters.

21. What is the Java API?
The Java API is a large collection of ready-made software components that provide many useful capabilities, such as graphical user interface (GUI) widgets.

22. Why there are no global variables in Java?
Global variables are globally accessible. Java does not support globally accessible variables due to following reasons:

  1. The global variables breaks the referential transparency
  2. Global variables creates collisions in namespace.

23. What are Encapsulation, Inheritance and Polymorphism?
Encapsulation is the mechanism that binds together code and data it manipulates and keeps both safe from outside interference and misuse. Inheritance is the process by which one object acquires the properties of another object. Polymorphism is the feature that allows one interface to be used for general class actions.

24. What is the use of bin and lib in JDK?
Bin contains all tools such as javac, appletviewer, awt tool, etc., whereas lib contains API and all packages.

25. What is method overloading and method overriding?
Method overloading: When a method in a class having the same method name with different arguments is said to be method overloading. Method overriding : When a method in a class having the same method name with same arguments is said to be method overriding.

26. What is the difference between this() and super()?
this() can be used to invoke a constructor of the same class whereas super() can be used to invoke a super class constructor.

27. What is Domain Naming Service(DNS)?
It is very difficult to remember a set of numbers(IP address) to connect to the Internet. The Domain Naming Service(DNS) is used to overcome this problem. It maps one particular IP address to a string of characters. For example, www. mascom. com implies com is the domain name reserved for US commercial sites, moscom is the name of the company and www is the name of the specific computer, which is mascom’s server.

28. What is URL?
URL stands for Uniform Resource Locator and it points to resource files on the Internet. URL has four components: http://www. address. com:80/index.html, where http – protocol name, address – IP address or host name, 80 – port number and index.html – file path.

29. What is RMI and steps involved in developing an RMI object?
Remote Method Invocation (RMI) allows java object that executes on one machine and to invoke the method of a Java object to execute on another machine. The steps involved in developing an RMI object are:

  • Define the interfaces
  • Implementing these interfaces
  • Compile the interfaces and their implementations with the java compiler
  • Compile the server implementation with RMI compiler
  • Run the RMI registry
  • Run the application.

30. What is RMI architecture?
RMI architecture consists of four layers and each layer performs specific functions: a) Application layer – contains the actual object definition. b) Proxy layer – consists of stub and skeleton. c) Remote Reference layer – gets the stream of bytes from the transport layer and sends it to the proxy layer. d) Transportation layer – responsible for handling the actual machine-to-machine communication.

31. Why Java?
The programs that we are writing are very similar to their counterparts in several other languages, so our choice of language is not crucial. We use Java because it is widely available, embraces a full set of modern abstractions, and has a variety of automatic checks for mistakes in programs, so it is suitable for learning to program. There is no
perfect language, and you certainly will be programming in other languages in the future.

32. Do I really have to type in the programs in the book to try them out?
Everyone should type in HelloWorld.java, but you can find all of the code in this book (and much more) on this booksite.

33. What are Java’s rules regarding tabs, spaces and newline characters?
There are not many. Java compilers treat them all to be equivalent. For example, we could also write HelloWorld as follows:

public class HelloWorld { public static void main (
String [] args) { System.out.println(“Hello World”) ; } }

But we do normally adhere to spacing and indenting conventions when we write Java programs, just as we always indent paragraphs and lines consistently when we write prose or poetry.

34. What are the rules regarding quotation marks?
Material inside quotation marks is an exception to the rule of the previous question:
things within quotes are taken literally so that you can precisely specify what gets printed. If you put any number of successive spaces within the quotes, you get that number of spaces in the output. If you accidentally omit a quotation mark, the compiler may get very confused, because it needs that mark to distinguish between characters in the string and other parts of the program. To print a quotation mark, a newline, or a tab, use \”, \n, or \t, respectively, within the quotation marks.

35. What is the meaning of the words public, static and void?
These keywords specify certain properties of main() that you will learn about later in the book. For the moment, we just include these keywords in the code (because they are required) but do not refer to them in the text.

36. What happens when you omit a brace or misspell one of the words, like public or
static or main?
It depends upon precisely what you do. Such errors are called syntax errors. Try it out and see.

37. Can a program use more than one command-line argument?
Yes, you can put several, though we normally use only a few. You refer to the second one as args[1], the third one as args[2], and so forth. Note that we start counting from 0 in Java.

38. What Java systems libraries and methods are available for me to use?
There are thousands of them, but we introduce them to you in a deliberate fashion in this book to avoid overwhelming you with choices.

39. How should I format my code? How should I comment my code?
Programmers use coding guidelines to make programs easier to read, understand, and maintain. As you gain experience, you will develop a coding style, just as you develop style when writing prose. Appendix B provides some guidelines for formatting and commenting your code. We recommend returning to this appendix after you’ve written a few programs.

40. What exactly is a .class file?
It’s a binary file (sequence of 0s and 1s). If you are using Unix or OS X, you can examine its contents by typing od -x HelloWorld.class at the command prompt. This displays the results in hexadecimal (base 16). In deference to Java’s name, the first word of every .class file is cafe.

41. How do I get the | symbol on my keyboard?
It’s there. Often it’s above the \ symbol.

42. Java prints out a ton of digits when I System.out.println() a double. How can I format it so it displays only 3 digits after the decimal place?
Use the method System.out.printf() described in Section 1.5.

43. Why does the integer quotient -0/3 yield 0, but the double quotient -0.0/3.0 yields – 0.0?
Java represent integers using something called two’s complement notation, and there is only one representation of 0. (You’ll learn about this in Section 5.1.) Java represents doubles using IEEE specifications, and there are two distinct representations of the number zero, 0 and -0. (You’ll learn about this in Section 9.1.)

44. What happens when I use / and % with a negative numerator?
Try it and see. -47 / 5 = -9 and -47 % 5 = -2. The quotient is always rounded toward zero. To ensure the Euclidean property b * (a / b) + (a % b) = a, the result of the remainder operator can be negative. This convention was inherited from ancestral

languages like FORTRAN and C. Some languages (but not Java) include both remainder and modulo operators because it is often convenient to have a version that returns only nonnegative integers.

45. Can I use % with real numbers?
Yes. If angle is nonnegative, then angle % (2 * Math.PI) converts the angle to be
between 0 and 2 π.

46. How do I print a “?
Since ” is a special character when dealing with strings, you must escape the convention rules by using \”. For example, System.out.println(“The pig said \”Oink Oink\” afterwards”);.

47. OK, so then how do I print a \?
Use “\\”.

48. Why do I need to declare the type of a variable in Java?
By specifying the type, the compiler can alert you of potential errors, say if you try to multiply an integer with a string. For the same reason, when doing physics calculations, it is always a good idea to keep track of the units and make sure they “type check.” For small programs, this may not seem important; for large programs it is crucial. The Ariane 5 rocket exploded 40 seconds after takeoff because of a bug in its software that incorrectly converted a 64 bit real number into a 16 bit integer.

49. Why is the type for real numbers called double?
Historically, the type for floating point numbers was float, but they had limited
accuracy. The type double was introduced as a floating point type with twice as much
accuracy.

50. Is it correct to say that using parentheses can only change
Almost, with one surprising exception. The literal value 2147483648 (2^31) is only permitted as an operand of the unary minus operator, i.e., -2147483648. Enclosing it in parentheses, i.e., -(2147483648), leads to a compile-time error.

51.What is JVM?
The Java interpreter along with the run time environment required to run the Java application in called as Java virtual machine(JVM)

52. What is the base class of all classes?
java.lang.Object

53. Explain Set Interface?
It is a collection of element which cannot contain duplicate elements. The Set interface contains only methods inherited from Collection and adds the restriction that duplicate elements are prohibited.

54. Explain TreeSet?
It is a Set implemented when we want elements in a sorted order.

55. What is Comparable Interface?
It is used to sort collections and arrays of objects using the collections.sort() and java.utils. The objects of the class implementing the Comparable interface can be ordered.

56. Difference between throw and throws?
It includes: Throw is used to trigger an exception where as throws is used in declaration of exception. Without throws, Checked exception cannot be handled where as checked exception can be propagated with throws.

57. Explain the following line used under Java Program: public static void main (String args[ ])
The following shows the explanation individually:

public: it is the access specifier.

static: it allows main() to be called without instantiating a particular instance of a class.

void: it affirns the compiler that no value is returned by main().

main(): this method is called at the beginning of a Java program.

String args[ ]: args parameter is an instance array of class String

58. Define JRE i.e. Java Runtime Environment?
Java Runtime Environment is an implementation of the Java Virtual Machine which executes Java programs. It provides the minimum requirements for executing a Java application;

59. What is JAR file?
JAR files is Java Archive fles and it aggregates many files into one. It holds Java classes in a library. JAR files are built on ZIP file format and have .jar file extension.

60. What is a WAR file?
This is Web Archive File and used to store XML, java classes, and JavaServer pages. which is used to distribute a collection of JavaServer Pages, Java Servlets, Java classes, XML files, static Web pages etc.

61. Define JIT compiler?
It improves the runtime performance of computer programs based on bytecode.

62. What is the difference between object oriented programming language and object based programming language?
Object based programming languages follow all the features of OOPs except Inheritance. JavaScript is an example of object based programming languages

63. What is the purpose of default constructor?
The java compiler creates a default constructor only if there is no constructor in the class.

64. Can a constructor be made final?
No, this is not possible.

65. What is static block?
It is used to initialize the static data member, It is excuted before main method at the time of classloading.

66. Define composition?
Holding the reference of the other class within some other class is known as composition.

67. What is function overloading?
If a class has multiple functions by same name but different parameters, it is known as Method Overloading.

68. What is function overriding?
If a subclass provides a specific implementation of a method that is already provided by its parent class, it is known as Method Overriding.

69. Difference between Overloading and Overriding?
Method overloading increases the readability of the program. Method overriding provides the specific implementation of the method that is already provided by its super class parameter must be different in case of overloading, parameter must be same in case of overriding.

70. What is final class?
Final classes are created so the methods implemented by that class cannot be overridden. It can’t be inherited.

71. What is NullPointerException?
A NullPointerException is thrown when calling the instance method of a null object, accessing or modifying the field of a null object etc.

72. What are the ways in which a thread can enter the waiting state?
A thread can enter the waiting state by invoking its sleep() method, by blocking on IO, by unsuccessfully attempting to acquire an object’s lock, or by invoking an object’s wait() method. It can also enter the waiting state by invoking its (deprecated) suspend() method.

73. How does multi-threading take place on a computer with a single CPU?
The operating system’s task scheduler allocates execution time to multiple tasks. By quickly switching between executing tasks, it creates the impression that tasks execute sequentially.

74. What invokes a thread’s run() method?
After a thread is started, via its start() method of the Thread class, the JVM invokes the thread’s run() method when the thread is initially executed.

75. Does it matter in what order catch statements for FileNotFoundException and IOException are written?
Yes, it does. The FileNoFoundException is inherited from the IOException. Exception’s subclasses have to be caught first.

76. What is the difference between yielding and sleeping?
When a task invokes its yield() method, it returns to the ready state. When a task invokes its sleep() method, it returns to the waiting state.

77. Why Vector class is used?
The Vector class provides the capability to implement a growable array of objects. Vector proves to be very useful if you don’t know the size of the array in advance, or you just need one that can change sizes over the lifetime of a program.

78. How many bits are used to represent Unicode, ASCII, UTF-16, and UTF-8 characters?
Unicode requires 16 bits and ASCII require 7 bits. Although the ASCII character set uses only 7 bits, it is usually represented as 8 bits. UTF-8 represents characters using 8, 16, and 18 bit patterns. UTF-16 uses 16-bit and larger bit patterns.

79. What are Wrapper classes?
These are classes that allow primitive types to be accessed as objects. Example: Integer, Character, Double, Boolean etc.

80. What is the difference between a Window and a Frame?
The Frame class extends Window to define a main application window that can have a menu bar.

81. Which package has light weight components?
javax.Swing package. All components in Swing, except JApplet, JDialog, JFrame and JWindow are lightweight components.

82. What is the difference between the paint() and repaint() methods?
The paint() method supports painting via a Graphics object. The repaint() method is used to cause paint() to be invoked by the AWT painting thread.

83. What is the purpose of File class?
It is used to create objects that provide access to the files and directories of a local file system.

84. What is the difference between the Reader/Writer class hierarchy and the InputStream/OutputStream class hierarchy?
The Reader/Writer class hierarchy is character-oriented, and the InputStream/OutputStream class hierarchy is byte-oriented.

85. Which class should you use to obtain design information about an object?
The Class class is used to obtain information about an object’s design and java.lang.Class class instance represent classes, interfaces in a running Java application.

86. What is the difference between static and non-static variables?
A static variable is associated with the class as a whole rather than with specific instances of a class. Non-static variables take on unique values with each object instance.

87. What is Serialization and deserialization?
Serialization is the process of writing the state of an object to a byte stream. Deserialization is the process of restoring these objects.

88. Can you write a Java class that could be used both as an applet as well as an application?
Yes, just add a main() method to the applet.

89. What is the difference between Swing and AWT components?
AWT components are heavy-weight, whereas Swing components are lightweight. Heavy weight components depend on the local windowing toolkit. For example, java.awt.Button is a heavy weight component, when it is running on the Java platform for Unix platform, it maps to a real Motif button.

90. What’s the difference between constructors and other methods?
Constructors must have the same name as the class and can not return a value. They are only called once while regular methods could be called many times.

91. Is there any limitation of using Inheritance?
Yes, since inheritance inherits everything from the super class and interface, it may make the subclass too clustering and sometimes error-prone when dynamic overriding or dynamic overloading in some situation.

92. What’s the difference between the methods sleep() and wait()?
The code sleep(2000); puts thread aside for exactly two seconds. The code wait(2000), causes a wait of up to two second. A thread could stop waiting earlier if it receives the notify() or notifyAll() call. The method wait() is defined in the class Object and the method sleep() is defined in the class Thread.

93. When ArithmeticException is thrown?
The ArithmeticException is thrown when integer is divided by zero or taking the remainder of a number by zero. It is never thrown in floating-point operations.

94. What is the Collections API?
The Collections API is a set of classes and interfaces that support operations on collections of objects.

95. Does garbage collection guarantee that a program will not run out of memory?
Garbage collection does not guarantee that a program will not run out of memory. It is possible for programs to use up memory resources faster than they are garbage collected. It is also possible for programs to create objects that are not subject to garbage collection.

96. What is the difference between a break statement and a continue statement?
A break statement results in the termination of the statement to which it applies (switch, for, do, or while). A continue statement is used to end the current loop iteration and return control to the loop statement.

97. If a variable is declared as private, where may the variable be accessed?
A private variable may only be accessed within the class in which it is declared.

98. What is JVM ? Why is Java called the “Platform Independent Programming Language” ?
A Java virtual machine (JVM) is a process virtual machine that can execute Java bytecode. Each Java source file is compiled into a bytecode file, which is executed by the JVM. Java was designed to allow application programs to be built that could be run on any platform, without having to be rewritten or recompiled by the programmer for each separate platform. A Java virtual machine makes this possible, because it is aware of the specific instruction lengths and other particularities of the underlying hardware platform.

99. What is the Difference between JDK and JRE ?
The Java Runtime Environment (JRE) is basically the Java Virtual Machine (JVM) where your Java programs are being executed. It also includes browser plugins for applet execution. The Java Development Kit (JDK) is the full featured Software Development Kit for Java, including the JRE, the compilers and tools (like JavaDoc, and Java Debugger), in order for a user to develop, compile and execute Java applications.

100. Explain the available thread states in a high-level.
During its execution, a thread can reside in one of the following states:

Runnable: A thread becomes ready to run, but does not necessarily start running immediately.

Running: The processor is actively executing the thread code.

Waiting: A thread is in a blocked state waiting for some external processing to finish.

Sleeping: The thread is forced to sleep.

Blocked on I/O: Waiting for an I/O operation to complete. Blocked on Synchronization: Waiting to acquire a lock.

Dead: The thread has finished its execution.

101. What is the primary benefit of Encapsulation?
The main benefit of encapsulation is the ability to modify our implemented code without breaking the code of others who use our code. With this Encapsulation gives maintainability, flexibility and extensibility to our code.

102. What is an Interface?
An interface is a collection of abstract methods. A class implements an interface, thereby inheriting the abstract methods of the interface.

103. Give some features of Interface?
It includes: Interface cannot be instantiated An interface does not contain any constructors. All of the methods in an interface are abstract.

104. Define Packages in Java?
A Package can be defined as a grouping of related types(classes, interfaces, enumerations and annotations ) providing access protection and name space management.

105. Why Packages are used?
Packages are used in Java in-order to prevent naming conflicts, to control access, to make searching/locating and usage of classes, interfaces, enumerations and annotations, etc., easier.

106. What do you mean by Multithreaded program?
A multithreaded program contains two or more parts that can run concurrently. Each part of such a program is called a thread, and each thread defines a separate path of execution.

107. What are the two ways in which Thread can be created?
Thread can be created by: implementing Runnable interface, extending the Thread class.

108. What is an applet?
An applet is a Java program that runs in a Web browser. An applet can be a fully functional Java application because it has the entire Java API at its disposal.

109. An applet extend which class?
An applet extends java.applet.Applet class.

110. Explain garbage collection in Java?
It uses garbage collection to free the memory. By cleaning those objects that is no longer reference by any of the program.

300+ TOP C Language LAB VIVA Questions with Answers Pdf

C Language LAB VIVA Questions :-

1. Who developed C language?

C language was developed by Dennis Ritchie in 1970 at Bell Laboratories.

2. Which type of language is C?

C is a high – level language and general purpose structured programming language.

3. What is a compiler?

Compile is a software program that transfer program developed in high level language intoexecutable object code

4. What is IDE?

The process of editing, compiling, running and debugging is managed by a single integratedapplication known as Integrated Development Environment (IDE)

5. What is a program?

A computer program is a collection of the instructions necessary to solve a specific problem.

6. What is an algorithm?

The approach or method that is used to solve the problem is known as algorithm.

7. What is structure of C program?

A C program contains Documentation section, Link section, Definition section, Globaldeclaration section, Main function and other user defined functions

8. What is a C token and types of C tokens?

The smallest individual units are known as C tokens. C has six types of tokens Keywords,Constants, Identifiers, Strings, Operators and Special symbols.

9.What is a Keyword?

Keywords are building blocks for program statements and have fixed meanings and thesemeanings cannot be changed.

10.How many Keywords (reserve words) are in C?

There are 32 Keywords in C language.

C Language LAB VIVA Questions
C Language LAB VIVA Questions

11.What is an Identifier?

Identifiers are user-defined names given to variables, functions and arrays.

12.What is a Constant and types of constants in C?

Constants are fixed values that do not change during the program execution. Types of constants are Numeric Constants (Integer and Real) and Character Constants (SingleCharacter, String Constants).

13.What are the Back Slash character constants or Escape sequence charactersavailable in C?

Back Slash character constant are \t, \n, \0

14.What is a variable?

Variables are user-defined names given to memory locations and are used to store values. Avariable may have different values at different times during program execution

15.What are the Data Types present in C?

Primary or Fundamental Data types (int, float, char), Derived Data types(arrays, pointers)and User-Defined data types(structures, unions, enum)

16.How to declare a variable?

The syntax for declaring variable isdata type variable_name-1, variable_name-2,….variable_name-n;

17.What is meant by initialization and how we initialize a variable?

While declaring a variable assigning value is known as initialization. Variable can beinitialized by using assignment operator (=).

18.What are integer variable, floating-point variable and character variable?

A variable which stores integer constants are called integer variable. A variable which storesreal values are called floating-point variable. A variable which stores character constants arecalled character variables.

19.How many types of operator or there in C?

C consist Arithmetic Operators (+, -, *, /,%), Relational Operators (<, <=, >, >=, !=), LogicalOperators (&&, ||, !), Assignment Operators (=, +=, -=, *=, /=), Increment and DecrementOperators (++, –), Conditional Operator(?:), Bitwise Operators(<<, >>, ~, &, |, ^) andSpecial Operators (. , ->, &, *, sizeof)

20. What is RAM ?

RAM – Random Access Memory is a temporary storage medium in a computer. RAM is a volatile memory i.e all data stored in RAM will be erased when the computer is switched off.

21. What do mean by network ?

Computer networking refers to connecting computers to share data, application software and hardware divices. Networks allow sharing of information among various computers and permit users to share files

22. List a few unconditional control statement in C.

  1. break statement
  2. continue statement
  3. goto statement
  4. exit() function

23. What is an array ?

An array is a collection of values of the same data type. Values in array are accessed using array name with subscripts in brackets[]. Synatax of array declaration is

data type array_ name[size];

24. What is Multidimensional Arrays

An array with more than one index value is called a multidimensional array. To declare a multidimensional array you can do follow syntax

data type array_ name[] [] []….;

25. Define string ?

An array of characters is known as a string.for example

char st[8]; this statement declares a string array with 80 characters .

26. Mention four important string handling functions in C languages .

There are four important string handling functions in C languages .

  • strlen();
  • trcpy();
  • strcat();
  • strcmp();

The header file #include is used when these functions are called in a C program.

27. Explain about the constants which help in debugging?

A #if directive test can be offered with #else and #else if directives. This allows conditional branching of the program to run sections of the code according to the result. Constants defined with a #define directive can be undefined with the #undef directive. The #ifdef directive has a companion directive #ifndef. These commands can be useful when debugging problem code to hide and unhide sections of the program.

28. Define and explain about ! Operator?

The logical operator ! NOT is a unary operator that is used before a single operand. It returns the inverse value of the given operand so if the variable “c” had a value of true then! C would return value of false. The not operator is very much useful in C programs because it can change the value of variables with successful iterations. This ensures that on each pass the value is changed.

29. What is operator precedence?

Operator precedence defines the order in which C evaluates expressions.

e.g. in the expression a=6+b*3, the order of precedence determines whether the addition or the multiplication is completed first. Operators on the same row have equal precedence.

30. Explain about the functions strcat() and strcmp()?

This function concatenates the source string at the end of the target string. Strcmp() function compares two strings to find out whether they are the same or different. The two strings are compared character by character until there is a mismatch or end of one of the strings is reached, whichever occurs first. If in case two strings are identical, a value of zero is returned. If there is no matches between two strings then a difference of the two non matching values are returned according to ASCII values.

31. Define function

A function is a module or block of program code which deals with a particular task. Each function has a name or identifier by which is used to refer to it in a program. A function can accept a number of parameters or values which pass information from outside, and consists of a number of statements and declarations, enclosed by curly braces { }, which make up the doing part of the object

32. Differentiate built-in functions and user – defined functions.

Built – in functions are used to perform standard operations such as finding the square root of a number, absolute value and so on. These are available along with the C compiler and are included in a program using the header files math.h, s tring.h and so on.

User defined functions are written by the user or programmer to compute a value or perform a task. It contains a statement block which is executed during the runtime whenever it is called by the main program.

33. Distinguish between actual and formal arguments.

Actual arguments are variables whose values are supplied to the function in any function call. Formal arguments are variables used to receive the values of actual arguments from the calling program.

34. Explain the concept and use of type void.

A function which does not return a value directly to the calling program is referred as a void function. The void functions are commonly used to perform a task and they can return many values through global variable declaration.

35. What is recursion ?

A function calling itself again and again to compute a value is referref to as recursive function or recursion. Recursion is useful for branching processes and is effective where terms are generated successively to compute a value.

c programming viva questions and answers pdf ::