300+ TOP Operating System LAB VIVA Questions and Answers

Operating System VIVA Questions :-

1.What is an operating system?
An operating system is a program that acts as an intermediary between the user and the computer hardware. The purpose of an OS is to provide a convenient environment in which user can execute programs in a convenient and efficient manner.It is a resource allocator responsible for allocating system resources and a control program which controls the operation of the computer h/w.

2.What are the various components of a computer system?

  1. The hardware
  2. The operating system
  3. The application programs
  4. The users.

3.What is purpose of different operating systems?
The machine Purpose Workstation individual usability &Resources utilization Mainframe Optimize utilization of hardware PC Support complex games, business application Hand held PCs Easy interface & min. power consumption

4.What are the different operating systems?
1. Batched operating systems
2. Multi-programmed operating systems
3. timesharing operating systems
4. Distributed operating systems
5. Real-time operating systems

6.What is a boot-strap program?
Bootstrapping is a technique by which a simple computer program activates a more complicated system of programs. It comes from an old expression “to pull oneself up by one’s bootstraps.”

7.What is BIOS?
A BIOS is software that is put on computers. This allows the user to configure the input and output of a computer. A BIOS is also known as firmware.

8.Explain the concept of the batched operating systems?
In batched operating system the users gives their jobs to the operator who sorts the programs according to their requirements and executes them. This is time consuming but makes the CPU busy all the time.

9.Explain the concept of the multi-programmed operating systems?
A multi-programmed operating systems can execute a number of programs concurrently. The operating system fetches a group of programs from the job-pool in the secondary storage which contains all the programs to be executed, and places them in the main memory. This process is called job scheduling. Then it chooses a program from the ready queue and gives them to CPU to execute. When a executing program needs some I/O operation then the operating system fetches another program and hands it to the CPU for execution, thus keeping the CPU busy all the time.

10.Explain the concept of the time sharing operating systems?
It is a logical extension of the multi-programmed OS where user can interact with the program. The CPU executes multiple jobs by switching among them, but the switches occur so frequently that the user feels as if the operating system is running only his program.

11.Explain the concept of the multi-processor systems or parallel systems?
They contain a no. of processors to increase the speed of execution, and reliability, and economy. They are of two types:
1. Symmetric multiprocessing
2. Asymmetric multiprocessing
In Symmetric multi processing each processor run an identical copy of the OS, and these copies communicate with each other as and when needed.But in Asymmetric multiprocessing each processor is assigned a specific task.

12.Explain the concept of the Distributed systems?
Distributed systems work in a network. They can share the network resources,communicate with each other

13.Explain the concept of Real-time operating systems?
A real time operating system is used when rigid time requirement have been placed on the operation of a processor or the flow of the data; thus, it is often used as a control device in a dedicated application. Here the sensors bring data to the computer. The computer must analyze the data and possibly adjust controls to
modify the sensor input.
They are of two types:
1. Hard real time OS
2. Soft real time OS
Hard-real-time OS has well-defined fixed time constraints. But soft real time operating systems have less stringent timing constraints.

14.Define MULTICS?
MULTICS (Multiplexed information and computing services) operating system was developed from 1965-1970 at Massachusetts institute of technology as a computing utility. Many of the ideas used in MULTICS were subsequently used in UNIX.

15.What is SCSI?
Small computer systems interface.

16.What is a sector?
Smallest addressable portion of a disk.

17.What is cache-coherency?
In a multiprocessor system there exist several caches each may containing a copy of same variable A. Then a change in one cache should immediately be reflected in all other caches this process of maintaining the same value of a data in all the caches s called cache-coherency.

18.What are residence monitors?
Early operating systems were called residence monitors.

19.What is dual-mode operation?
In order to protect the operating systems and the system programs from the malfunctioning programs the two mode operations were evolved:
1. System mode.
2. User mode.
Here the user programs cannot directly interact with the system resources, instead they request the operating system which checks the request and does the required task for the user programs-DOS was written for / intel 8088 and has no dual-mode. Pentium provides dual-mode operation.

20.What are the operating system components?
1. Process management
2. Main memory management
3. File management
4. I/O system management
5. Secondary storage management
6. Networking
7. Protection system
8. Command interpreter system

21.What are operating system services?
1. Program execution
2. I/O operations
3. File system manipulation
4. Communication
5. Error detection
6. Resource allocation
7. Accounting
8. Protection

22.What are system calls?
System calls provide the interface between a process and the operating system. System calls for modern Microsoft windows platforms are part of the win32 API, which is available for all the compilers written for Microsoft windows.

23.What is a layered approach and what is its advantage?

Layered approach is a step towards modularizing of the system, in which the operating system is broken up into a number of layers (or levels), each built on top of lower layer. The bottom layer is the hard ware and the top most is the user interface.The main advantage of the layered approach is modularity. The layers are
selected such that each uses the functions (operations) and services of only lower layer. This approach simplifies the debugging and system verification.

24.What is micro kernel approach and site its advantages?

Micro kernel approach is a step towards modularizing the operating system where all nonessential components from the kernel are removed and implemented as system and user level program, making the kernel smaller.The benefits of the micro kernel approach include the ease of extending the operating system. All new services are added to the user space and consequently do not require modification of the kernel. And as kernel is smaller it is easier to upgrade it. Also this approach provides more security and reliability since most services are running as user processes rather than kernel’s keeping the kernel intact.

25.What are a virtual machines and site their advantages?

It is the concept by which an operating system can create an illusion that a process has its own processor with its own (virtual) memory.
The operating system implements virtual machine concept by using CPU scheduling and virtual memory.

1. The basic advantage is it provides robust level of security as each virtual machine is isolated from all other VM. Hence the system resources are completely protected.
2. Another advantage is that system development can be done without disrupting normal operation. System programmers are given their own virtual machine, and as system development is done on the virtual machine instead of on the actual
physical machine.
3. Another advantage of the virtual machine is it solves the compatibility problem.
EX: Java supplied by Sun micro system provides a specification for java virtual machine.

26.What is a process?
A program in execution is called a process. Or it may also be called a unit of work. A process needs some system resources as CPU time, memory, files, and i/o devices to accomplish the task. Each process is represented in the operating system by a process control block or task control block (PCB).Processes are of two types:
1. Operating system processes
2. User processes

27.What are the states of a process?
1. New
2. Running
3. Waiting
4. Ready
5. Terminated

28.What are various scheduling queues?
1. Job queue
2. Ready queue
3. Device queue

29.What is a job queue?
When a process enters the system it is placed in the job queue.

30.What is a ready queue?
The processes that are residing in the main memory and are ready and waiting to execute are kept on a list called the ready queue.

31.What is a device queue?
A list of processes waiting for a particular I/O device is called device queue.

32.What is a long term scheduler & short term schedulers?
Long term schedulers are the job schedulers that select processes from the job queue and load them into memory for execution. The short term schedulers are the CPU schedulers that select a process form the ready queue and allocate the CPU to one of them.

33.What is context switching?
Transferring the control from one process to other process requires saving the state of the old process and loading the saved state for new process. This task is known as context switching.

34.What are the disadvantages of context switching?
Time taken for switching from one process to other is pure over head. Because the system does no useful work while switching. So one of the solutions is to go for threading when ever possible.

35.What are co-operating processes?
The processes which share system resources as data among each other. Also the processes can communicate with each other via interprocess communication facility generally used in distributed systems. The best example is chat program used on the www.

36.What is a thread?
A thread is a program line under execution. Thread sometimes called a light-weight process, is a basic unit of CPU utilization; it comprises a thread id, a program counter, a register set, and a stack.

37.What are the benefits of multithreaded programming?
1. Responsiveness (needn’t to wait for a lengthy process)
2. Resources sharing
3. Economy (Context switching between threads is easy)
4. Utilization of multiprocessor architectures (perfect utilization of the multiple processors).

38.What are types of threads?
1. User thread
2. Kernel thread
User threads are easy to create and use but the disadvantage is that if they perform a blocking system calls the kernel is engaged completely to the single user thread blocking other processes. They are created in user space.Kernel threads are supported directly by the operating system. They are slower to create and manage. Most of the OS like Windows NT, Windows 2000, Solaris2, BeOS, and Tru64 Unix support kernel threading.

39.Which category the java thread do fall in?
Java threads are created and managed by the java virtual machine, they do not easily fall under the category of either user or kernel thread……

40.What are multithreading models?
Many OS provide both kernel threading and user threading. They are called multithreading models. They are of three types:
1. Many-to-one model (many user level thread and one kernel thread).
2. One-to-one model
3. Many-to –many
In the first model only one user can access the kernel thread by not allowing multi-processing. Example: Green threads of Solaris.The second model allows multiple threads to run on parallel processing systems. Creating user thread needs to create corresponding kernel thread (disadvantage).Example: Windows NT, Windows 2000, OS/2.The third model allows the user to create as many threads as necessary and the corresponding kernel threads can run in parallel on a multiprocessor.
Example: Solaris2, IRIX, HP-UX, and Tru64 Unix.

41.What is a P-thread?
P-thread refers to the POSIX standard (IEEE 1003.1c) defining an API for thread creation and synchronization. This is a specification for thread behavior, not an implementation. The windows OS have generally not supported the P-threads.

42.What are java threads?
Java is one of the small number of languages that support at the language level for the creation and management of threads. However, because threads are managed by the java virtual machine (JVM), not by a user-level library or kernel, it is difficult to classify Java threads as either user- or kernel-level.

43.What is process synchronization?
A situation, where several processes access and manipulate the same data concurrently and the outcome of the execution depends on the particular order in which the access takes place, is called race condition. To guard against the race condition we need to ensure that only one process at a time can be manipulating
the same data. The technique we use for this is called process synchronization.

44.What is critical section problem?
Critical section is the code segment of a process in which the process may be changing common variables, updating tables, writing a file and so on. Only one process is allowed to go into critical section at any given time (mutually exclusive).The critical section problem is to design a protocol that the processes can use to
co-operate. The three basic requirements of critical section are:
1. Mutual exclusion
2. Progress
3. bounded waiting
Bakery algorithm is one of the solutions to CS problem.

45.What is a semaphore?
It is a synchronization tool used to solve complex critical section problems. A semaphore is an integer variable that, apart from initialization, is accessed only through two standard atomic operations: Wait and Signal.

46.What is bounded-buffer problem?
Here we assume that a pool consists of n buffers, each capable of holding one item. The semaphore provides mutual exclusion for accesses to the buffer pool and is initialized to the value 1.The empty and full semaphores count the number of empty and full buffers, respectively. Empty is initialized to n, and full is initialized to 0.

47.What is readers-writers problem?
Here we divide the processes into two types:
1. Readers (Who want to retrieve the data only)
2. Writers (Who want to retrieve as well as manipulate)
We can provide permission to a number of readers to read same data at same time.But a writer must be exclusively allowed to access. There are two solutions to this problem:
1. No reader will be kept waiting unless a writer has already obtained permission to use the shared object. In other words, no reader should wait for other readers to complete simply because a writer is waiting.
2. Once a writer is ready, that writer performs its write as soon as possible. In other words, if a writer is waiting to access the object, no new may start reading.

48.What is dining philosophers’ problem?

Consider 5 philosophers who spend their lives thinking and eating. The philosophers share a common circular table surrounded by 5 chairs, each belonging to one philosopher. In the center of the table is a bowl of rice, and the table is laid with five single chop sticks. When a philosopher thinks, she doesn’t interact with her colleagues.
From time to time, a philosopher gets hungry and tries to pick up two chop sticks that are closest to her .A philosopher may pick up only one chop stick at a time. Obviously she can’t pick the stick in some others hand. When a hungry philosopher has both her chopsticks at the same time, she eats without releasing her chopsticks. When she is finished eating, she puts down both of her chopsticks and start thinking again.

49.What is a deadlock?
Suppose a process request resources; if the resources are not available at that time the process enters into a wait state. A waiting process may never again change state, because the resources they have requested are held by some other waiting processes. This situation is called deadlock.

50.What are necessary conditions for dead lock?
1. Mutual exclusion (where at least one resource is non-sharable)
2. Hold and wait (where a process hold one resource and waits for other resource)
3. No preemption (where the resources can’t be preempted)
4. circular wait (where p[i] is waiting for p[j] to release a resource. i= 1,2,…n
j=if (i!=n) then i+1
else 1 )

OS LAB VIVA Questions ::

51.What is resource allocation graph?

This is the graphical description of deadlocks. This graph consists of a set of edges E and a set of vertices V. The set of vertices V is partitioned into two different types of nodes P={p1,p2,…,pn}, the set consisting of all the resources in the system, R={r1,r2,…rn}.A directed edge Pi?Rj is called a request edge; a directed edge Rj?
Pi is called an assignment edge. Pictorially we represent a process Pi as a circle, and each resource type Rj as square.Since resource type Rj may have more than one instance, we represent each such instance as a dot within the square.When a request is fulfilled the request edge is transformed into an assignment edge. When a process releases a resource the assignment edge is deleted. If the cycle involves a set of resource types, each of which has only a single instance, then a deadlock has occurred. Each process involved in the cycle is deadlock.

52.What are deadlock prevention techniques?

  1. Mutual exclusion : Some resources such as read only files shouldn’t be mutually exclusive. They should be sharable. But some resources such as printers must be
    mutually exclusive.
  2. Hold and wait : To avoid this condition we have to ensure that if a process is requesting for a resource it should not hold any resources.
  3. No preemption : If a process is holding some resources and requests another resource that cannot be immediately allocated to it (that is the process must wait), then all the resources currently being held are preempted(released autonomously).
  4. Circular wait : the way to ensure that this condition never holds is to impose a total ordering of all the resource types, and to require that each process requests resources in an increasing order of enumeration.

53.What is a safe state and a safe sequence?

A system is in safe state only if there exists a safe sequence. A sequence of processes is a safe sequence for the current allocation state if, for each Pi, the resources that the Pi can still request can be satisfied by the currently available resources plus the resources held by all the Pj, with j

54.What are the deadlock avoidance algorithms?

A dead lock avoidance algorithm dynamically examines the resource-allocation state to ensure that a circular wait condition can never exist. The resource allocation state is defined by the number of available and allocated resources, and the maximum demand of the process.There are two algorithms:
1. Resource allocation graph algorithm
2. Banker’s algorithm
a. Safety algorithm
b. Resource request algorithm

55. What are the basic functions of an operating system?

Operating system controls and coordinates the use of the hardware among the various applications programs for various uses. Operating system acts as resource allocator and manager. Since there are many possibly conflicting requests for resources the operating system must decide which requests are allocated resources to operating the computer system efficiently and fairly. Also operating system is control program which controls the user programs to prevent errors and improper use of the computer. It is especially concerned with the operation and control of I/O devices.

56.Explain briefly about, processor, assembler, compiler, loader, linker and the functions executed by them.

  • Processor:- A processor is the part a computer system that executes instructions .It is also called a CPU
  • Assembler:- An assembler is a program that takes basic computer instructions and converts them into a pattern of bits that the computer’s processor can use to perform its basic operations. Some people call these instructions assembler language and others use the term assembly language.
  • Compiler:- A compiler is a special program that processes statements written in a particular programming language and turns them into machine language or “code” that a computer’s processor uses. Typically, a programmer writes language statements in a language such as Pascal or C one line at a time using an editor. The file that is created contains what are called the source statements. The programmer then runs the appropriate language compiler, specifying the name of the file that contains the source statements.
  • Loader:- In a computer operating system, a loader is a component that locates a given program (which can be an application or, in some cases, part of the operating system itself) in offline storage (such as a hard disk), loads it into main storage (in a personal computer, it’s called random access memory), and gives that program control of the compute
  • Linker:- Linker performs the linking of libraries with the object code to make the object code into an executable machine code.

57. What is a Real-Time System?

A real time process is a process that must respond to the events within a certain time period. A real time operating system is an operating system that can run real time processes successfully

58. What is the difference between Hard and Soft real-time systems?

A hard real-time system guarantees that critical tasks complete on time. This goal requires that all delays in the system be bounded from the retrieval of the stored data to the time that it takes the operating system to finish any request made of it. A soft real time system where a critical real-time task gets priority over other tasks and retains that priority until it completes. As in hard real time systems kernel delays need to be bounded

59. What is virtual memory?

A virtual memory is hardware technique where the system appears to have more memory that it actually does. This is done by time-sharing, the physical memory and storage parts of the memory one disk when they are not actively being used

60. What is cache memory?

Cache memory is random access memory (RAM) that a computer microprocessor can access more quickly than it can access regular RAM. As the microprocessor processes data, it looks first in the cache memory and if it finds the data there (from a previous reading of data), it does not have to do the more time-consuming reading of data

61.Differentiate between Complier and Interpreter?

An interpreter reads one instruction at a time and carries out the actions implied by that instruction. It does not perform any translation. But a compiler translates the entire instructions.

62.What are different tasks of Lexical Analysis?

The purpose of the lexical analyzer is to partition the input text, delivering a sequence of comments and basic symbols. Comments are character sequences to be ignored, while basic symbols are character sequences that correspond to terminal symbols of the grammar defining the phrase structure of the input

63. Why paging is used?

Paging is solution to external fragmentation problem which is to permit the logical address space of a process to be noncontiguous, thus allowing a process to be allocating physical memory wherever the latter is available.

64. What is Context Switch?

Switching the CPU to another process requires saving the state of the old process and loading the saved state for the new process. This task is known as a context switch.Context-switch time is pure overhead, because the system does no useful work while switching. Its speed varies from machine to machine, depending on the memory speed, the number of registers which must be copied, the existed of special instructions(such as a single instruction to load or store all registers).

65. Distributed Systems?

Distribute the computation among several physical processors.
Loosely coupled system – each processor has its own local memory; processors communicate with one another through various communications lines, such as high-speed buses or telephone lines
Advantages of distributed systems:
->Resources Sharing
->Computation speed up – load sharing
->Reliability
->Communications

66.Difference between Primary storage and secondary storage?

Main memory: – only large storage media that the CPU can access directly.
Secondary storage: – extension of main memory that provides large nonvolatile storage capacity.

67. What is CPU Scheduler?

  • Selects from among the processes in memory that are ready to execute, and allocates the CPU to one of them.
  • CPU scheduling decisions may take place when a process:
    1.Switches from running to waiting state.
    2.Switches from running to ready state.
    3.Switches from waiting to ready.
    4.Terminates.
  • Scheduling under 1 and 4 is nonpreemptive.
  • All other scheduling is preemptive.

68. What do you mean by deadlock?

Deadlock is a situation where a group of processes are all blocked and none of them can become unblocked until one of the other becomes unblocked.The simplest deadlock is two processes each of which is waiting for a message from the other

69. What is Dispatcher?

->Dispatcher module gives control of the CPU to the process selected by the short-term scheduler; this involves:
Switching context
Switching to user mode
Jumping to the proper location in the user program to restart that program
Dispatch latency – time it takes for the dispatcher to stop one process and start another running.

70. What is Throughput, Turnaround time, waiting time and Response time?

Throughput – number of processes that complete their execution per time unit
Turnaround time – amount of time to execute a particular process
Waiting time – amount of time a process has been waiting in the ready queue
Response time – amount of time it takes from when a request was submitted until the first response is produced, not output (for time-sharing environment)

71. Explain the difference between microkernel and macro kernel?

Micro-Kernel: A micro-kernel is a minimal operating system that performs only the essential functions of an operating system. All other operating system functions are performed by system processes.
Monolithic: A monolithic operating system is one where all operating system code is in a single executable image and all operating system code runs in system mode.

72.What is multi tasking, multi programming, multi threading?

Multi programming: Multiprogramming is the technique of running several programs at a time using timesharing.It allows a computer to do several things at the same time. Multiprogramming creates logical parallelism.
The concept of multiprogramming is that the operating system keeps several jobs in memory simultaneously. The operating system selects a job from the job pool and starts executing a job, when that job needs to wait for any i/o operations the CPU is switched to another job. So the main idea here is that the CPU is never idle.
Multi tasking: Multitasking is the logical extension of multiprogramming .The concept of multitasking is quite similar to multiprogramming but difference is that the switching between jobs occurs so frequently that the users can interact with each program while it is running. This concept is also known as time-sharing systems. A time-shared operating system uses CPU scheduling and multiprogramming to provide each user with a small portion of time-shared system.
Multi threading: An application typically is implemented as a separate process with several threads of control. In some situations a single application may be required to perform several similar tasks for example a web server accepts client requests for web pages, images, sound, and so forth. A busy web server may have several of clients concurrently accessing it. If the web server ran as a traditional single-threaded process, it would be able to service only one client at a time. The amount of time that a client might have to wait for its request to be serviced could be enormous.
So it is efficient to have one process that contains multiple threads to serve the same purpose. This approach would multithread the web-server process, the server would create a separate thread that would listen for client requests when a request was made rather than creating another process it would create another thread to service the request.
So to get the advantages like responsiveness, Resource sharing economy and utilization of multiprocessor architectures multithreading concept can be used

73. Give a non-computer example of preemptive and non-preemptive scheduling?

Consider any system where people use some kind of resources and compete for them. The non-computer examples for preemptive scheduling the traffic on the single lane road if there is emergency or there is an ambulance on the road the other vehicles give path to the vehicles that are in need. The example for preemptive scheduling is people standing in queue for tickets.

74. What is starvation and aging?

Starvation: Starvation is a resource management problem where a process does not get the resources it needs for a long time because the resources are being allocated to other processes.
Aging: Aging is a technique to avoid starvation in a scheduling system. It works by adding an aging factor to the priority of each request. The aging factor must increase the request’s priority as time passes and must ensure that a request will eventually be the highest priority request (after it has waited long enough)

75. Different types of Real-Time Scheduling?

Hard real-time systems – required to complete a critical task within a guaranteed amount of time.
Soft real-time computing – requires that critical processes receive priority over less fortunate ones.

76. What are the Methods for Handling Deadlocks?

Ensure that the system will never enter a deadlock state.
->Allow the system to enter a deadlock state and then recover.
->Ignore the problem and pretend that deadlocks never occur in the system; used by most operating systems, including
UNIX.

77. What is a Safe State and its’ use in deadlock avoidance?

When a process requests an available resource, system must decide if immediate allocation leaves the system in a safe state
->System is in safe state if there exists a safe sequence of all processes.
->Sequence is safe if for each Pi, the resources that Pi can still request can be satisfied by
currently available resources + resources held by all the Pj, with j
If Pi resource needs are not immediately available, then Pi can wait until all Pj have finished.
When Pj is finished, Pi can obtain needed resources, execute, return allocated resources, and terminate.
When Pi terminates, Pi+1 can obtain its needed resources, and so on.
->Deadlock Avoidance Þ ensure that a system will never enter an unsafe state.

78. Recovery from Deadlock?

Process Termination:
->Abort all deadlocked processes.
->Abort one process at a time until the deadlock cycle is eliminated.
->In which order should we choose to abort?
Priority of the process.
How long process has computed, and how much longer to completion.
Resources the process has used.
Resources process needs to complete.
How many processes will need to be terminated?
Is process interactive or batch?
Resource Preemption:
->Selecting a victim – minimize cost.
->Rollback – return to some safe state, restart process for that state.
->Starvation – same process may always be picked as victim, include number of rollback in cost factor.

79.Difference between Logical and Physical Address Space?

->The concept of a logical address space that is bound to a separate physical address space is central to proper memory management.
Logical address – generated by the CPU; also referred to as virtual address.
Physical address – address seen by the memory unit.
->Logical and physical addresses are the same in compile-time and load-time address-binding schemes; logical (virtual) and physical addresses differ in execution-time address-binding scheme

80. Binding of Instructions and Data to Memory?

Address binding of instructions and data to memory addresses can happen at three different stages
Compile time: If memory location known a priori, absolute code can be generated; must recompile code if starting location changes.
Load time: Must generate relocatable code if memory location is not known at compile time.
Execution time: Binding delayed until run time if the process can be moved during its execution from one memory segment to another. Need hardware support for address maps (e.g., base and limit registers).

81. What is Memory-Management Unit (MMU)?

Hardware device that maps virtual to physical address.
In MMU scheme, the value in the relocation register is added to every address generated by a user process at the time it is sent to memory.
->The user program deals with logical addresses; it never sees the real physical addresses

82. What are Dynamic Loading, Dynamic Linking and Overlays?

Dynamic Loading:

  • Routine is not loaded until it is called
  • Better memory-space utilization; unused routine is never loaded.
  • Useful when large amounts of code are needed to handle infrequently occurring cases.
  • No special support from the operating system is required implemented through program design.
    Dynamic Linking:
  • Linking postponed until execution time.
  • Small piece of code, stub, used to locate the appropriate memory-resident library routine.
  • Stub replaces itself with the address of the routine, and executes the routine.
  • Operating system needed to check if routine is in processes’ memory address.
  • Dynamic linking is particularly useful for libraries.
    Overlays:
  • Keep in memory only those instructions and data that are needed at any given time.
  • Needed when process is larger than amount of memory allocated to it.
  • Implemented by user, no special support needed from operating system, programming design of overlay structure is complex.

83. What is fragmentation? Different types of fragmentation?

Fragmentation occurs in a dynamic memory allocation system when many of the free blocks are too small to satisfy any request.
External Fragmentation: External Fragmentation happens when a dynamic memory allocation algorithm allocates some memory and a small piece is left over that cannot be effectively used. If too much external fragmentation occurs, the amount of usable memory is drastically reduced.Total memory space exists to satisfy a request, but it is not contiguous
Internal Fragmentation: Internal fragmentation is the space wasted inside of allocated memory blocks because of restriction on the allowed sizes of allocated blocks.Allocated memory may be slightly larger than requested memory; this size difference is memory internal to a partition, but not being used Reduce external fragmentation by compaction
->Shuffle memory contents to place all free memory together in one large block.
->Compaction is possible only if relocation is dynamic, and is done at execution time.

84. Explain Demand Paging, Page fault interrupt, and Trashing?

Demand Paging: Demand paging is the paging policy that a page is not read into memory until it is requested, that is, until there is a page fault on the page.
Page fault interrupt: A page fault interrupt occurs when a memory reference is made to a page that is not in memory.The present bit in the page table entry will be found to be off by the virtual memory hardware and it will signal an interrupt.
Trashing: The problem of many page faults occurring in a short time, called “page thrashing,”

85. Explain Segmentation with paging?

Segments can be of different lengths, so it is harder to find a place for a segment in memory than a page. With segmented virtual memory, we get the benefits of virtual memory but we still have to do dynamic storage allocation of physical memory. In order to avoid this, it is possible to combine segmentation and paging into a two-level virtual memory system. Each segment descriptor points to page table for that segment.This give some of the advantages of paging (easy placement) with some of the advantages of segments (logical division of the program).

86. Under what circumstances do page faults occur? Describe the actions taken by the operating system when a page fault occurs?

A page fault occurs when an access to a page that has not been brought into main memory takes place. The operating system verifies the memory access, aborting the program if it is invalid. If it is valid, a free frame is located and I/O is requested to read the needed page into the free frame. Upon completion of I/O, the process table and page table are updated and the instruction is restarted

87. What is the cause of thrashing? How does the system detect thrashing? Once it detects thrashing, what can the system do to eliminate this problem?

Thrashing is caused by under allocation of the minimum number of pages required by a process, forcing it to continuously page fault. The system can detect thrashing by evaluating the level of CPU utilization as compared to the level of multiprogramming. It can be eliminated by reducing the level of multiprogramming.

300+ TOP Mobile Application Development LAB VIVA Questions & Answers

MOBILE APPLICATION DEVELOPMENT LAB VIVA Questions :-

1. What is Android?
It is an open-sourced operating system that is used primarily on mobile devices, such as cell phones and tablets. It is a Linux kernel-based system that’s been equipped with rich components that allows developers to create and run apps that can perform both basic and advanced functions.

2. What Is the Google Android SDK?
The Google Android SDK is a toolset that developers need in order to write apps on Android enabled devices. It contains a graphical interface that emulates an Android driven handheld environment, allowing them to test and debug their codes.

3. What is the Android Architecture?
Android Architecture is made up of 4 key components:

  1. Linux Kernel
  2. Libraries
  3. Android Framework
  4. Android Applications

4. Describe the Android Framework.
The Android Framework is an important aspect of the Android Architecture. Here you can find all the classes and methods that developers would need in order to write applications on the Android environment.

5. What is AAPT?
AAPT is short for Android Asset Packaging Tool. This tool provides developers with the ability to deal with zip-compatible archives, which includes creating, extracting as well as viewing its contents.

6. What is the importance of having an emulator within the Android environment?
The emulator lets developers “play” around an interface that acts as if it were an actual mobile device. They can write and test codes, and even debug. Emulators are a safe place for testing codes especially if it is in the early design phase.

7. What is the use of an activityCreator?
An activity Creator is the first step towards the creation of a new Android project. It is made up of a shell script that will be used to create new file system structure necessary for writing codes within the Android IDE.

8 . Describe Activities.
Activities are what you refer to as the window to a user interface. Just as you create windows in order to display output or to ask for an input in the form of dialog boxes, activities play the same role, though it may not always be in the form of a user interface.

9. What are Intents?
Intents displays notification messages to the user from within the Android enabled device. It can be used to alert the user of a particular state that occurred. Users can be made to respond to intents.

10. Differentiate Activities from Services.
Activities can be closed, or terminated anytime the user wishes. On the other hand, services are designed to run behind the scenes, and can act independently. Most services run continuously, regardless of whether there are certain or no activities being executed.

11. What items are important in every Android project?
These are the essential items that are present each time an Android project is created:

  • Android Manifest.xml
  • build.xml
  • bin/
  • src/
  • res/
  • assets/

12. What is the importance of XML-based layouts?
The use of XML-based layouts provides a consistent and somewhat standard means of setting GUI definition format. In common practice, layout details are placed in XML files while other items are placed in source files.

13. What are containers?
Containers, as the name itself implies, holds objects and widgets together, depending on which specific items are needed and in what particular arrangement that is wanted. Containers may hold labels, fields, buttons, or even child containers, as examples.

14. What is Orientation?
Orientation, which can be set using set Orientation(), dictates if the Linear Layout is represented as a row or as a column. Values are set as either HORIZONTAL or VERTICAL.

15. What is the importance of Android in the mobile market?
Developers can write and register apps that will specifically run under the Android environment. This means that every mobile device that is Android enabled will be able to support and run these apps. With the growing popularity of Android mobile devices, developers can take advantage of this trend by creating and uploading their apps on the Android Market for distribution to anyone who wants to download it.

16. What do you think are some disadvantages of Android?
Given that Android is an open-source platform, and the fact that different Android operating systems have been released on different mobile devices, there’s no clear cut policy to how applications can adapt with various OS versions and upgrades.
–> One app that runs on this particular version of Android OS may or may not run on another version.
–> Another disadvantage is that since mobile devices such as phones and tabs come in different sizes and forms, it poses a challenge for developers to create apps that can adjust correctly to the right screen size and other varying features and specs.

17. What is adb?
Adb is short for “Android Debug Bridge”. It allows developers the power to execute remote shell commands. Its basic function is to allow and control communication towards and from the emulator port.

18. What are the four essential states of an activity?

  1. Active – if the activity is at the foreground
  2. Paused – if the activity is at the background and still visible
  3. Stopped – if the activity is not visible and therefore is hidden or obscured by another activity
  4. Destroyed – when the activity process is killed or completed terminated

19. What is ANR?
ANR is short for Application Not Responding. This is actually a dialog that appears to the user whenever an application have been unresponsive for a long period of time.

20. Which elements can occur only once and must be present?
Among the different elements, the and elements must be present and can occur only once. The rest are optional, and can occur as many times as needed.

21. How are escape characters used as attribute?
Escape characters are preceded by double backslashes. For example, a newline character is created using ‘\\n’

22. What is the importance of settings permissions in app development?
Permissions allow certain restrictions to be imposed primarily to protect data and code. Without these, codes could be compromised, resulting to defects in functionality.

23. What is the function of an intent filter?
Because every component needs to indicate which intents they can respond to, intent filters are used to filter out intents that these components are willing to receive. One or more intent filters are possible, depending on the services and activities that is going to make use of it.

24. Enumerate the three key loops when monitoring an activity?

  • Entire lifetime – activity happens between on Create and on Destroy
  • Visible lifetime – activity happens between on Start and on Stop
  • Foreground lifetime – activity happens between on Resume and on Pause

25. When is the on Stop(. method invoked?
A call to on Stop method happens when an activity is no longer visible to the user, either because another activity has taken over or if in front of that activity.

Mobile Application (Android. VIVA Questions and Answers :-

26. Is there a case wherein other qualifiers in multiple resources take precedence over locale?
Yes, there are actually instances wherein some qualifiers can take precedence over locale. There are two known exceptions, which are the MCC (mobile country code. and MNC (mobile network code. qualifiers.

27. What are the different states wherein a process is based?
There are 4 possible states:

  1. foreground activity
  2. visible activity
  3. background activity
  4. empty process

28. How can the ANR be prevented?
One technique that prevents the Android system from concluding a code that has been responsive for a long period of time is to create a child thread. Within the child thread, most of the actual workings of the codes can be placed, so that the main thread runs with minimal periods of unresponsive times.

29. What role does Dalvik play in Android development?
Dalvik serves as a virtual machine, and it is where every Android application runs. Through Dalvik, a device is able to execute multiple virtual machines efficiently through better memory management.

30. What is the Android Manifest.xml?
This file is essential in every application. It is declared in the root directory and contains information about the application that the Android system must know before the codes can be executed.

31. What is the proper way of setting up an Android-powered device for app development?
The following are steps to be followed prior to actual application development in an Android-powered device:

  • Declare your application as “debuggable” in your Android Manifest.
  • Turn on “USB Debugging” on your device.
  • Set up your system to detect your device.

32. Enumerate the steps in creating a bounded service through AIDL.
1. create the .aidl file, which defines the programming interface
2. implement the interface, which involves extending the inner abstract Stub class as well as implanting its methods.
3. expose the interface, which involves implementing the service to the clients.

33. What is the importance of Default Resources?
When default resources, which contain default strings and files, are not present, an error will occur and the app will not run. Resources are placed in specially named subdirectories under the project res/ directory.

34. When dealing with multiple resources, which one takes precedence?
Assuming that all of these multiple resources are able to match the configuration of a device, the ‘locale’ qualifier almost always takes the highest precedence over the others.

35. When does ANR occur?
The ANR dialog is displayed to the user based on two possible conditions. One is when there is no response to an input event within 5 seconds, and the other is when a broadcast receiver is not done executing within 10 seconds.

36. What is AIDL?
AIDL, or Android Interface Definition Language, handles the interface requirements between a client and a service so both can communicate at the same level through interprocess communication or IPC. This process involves breaking down objects into primitives that Android can understand. This part is required simply because a process cannot access the memory of the other process.

37. What data types are supported by AIDL?
AIDL has support for the following data types:

  • string
  • charSequence
  • List
  • Map
  • all native Java data types like int,long, char and Boolean

38. What is a Fragment?
A fragment is a part or portion of an activity. It is modular in a sense that you can move around or combine with other fragments in a single activity. Fragments are also reusable.

39. What is a visible activity?
A visible activity is one that sits behind a foreground dialog. It is actually visible to the user, but not necessarily being in the foreground itself.

40. When is the best time to kill a foreground activity?
The foreground activity, being the most important among the other states, is only killed or terminated as a last resort, especially if it is already consuming too much memory. When a memory paging state has been reach by a foreground activity, then it is killed so that the user interface can retain its responsiveness to the user.

41. Is it possible to use or add a fragment without using a user interface?
Yes, it is possible to do that, such as when you want to create a background behavior for a particular activity. You can do this by using add(Fragment,string. method to add a fragment from the activity.

42. How do you remove icons and widgets from the main screen of the Android device?
To remove an icon or shortcut, press and hold that icon. You then drag it downwards to the lower part of the screen where a remove button appears.

43. What are the core components under the Android application architecture?
There are 5 key components under the Android application architecture:

  1. services
  2. intent
  3. resource externalization
  4. notifications
  5. content providers

44. What composes a typical Android application project?
A project under Android development, upon compilation, becomes an .apk file. This apk file format is actually made up of the AndroidManifest.xml file, application code, resource files, and other related files.

45. What is a Sticky Intent?
A Sticky Intent is a broadcast from sendStickyBroadcast(. method such that the intent floats around even after the broadcast, allowing others to collect data from it.

46. Do all mobile phones support the latest Android operating system?
Some Android-powered phone allows you to upgrade to the higher Android operating system version. However, not all upgrades would allow you to get the latest version. It depends largely on the capability and specs of the phone, whether it can support the newer features available under the latest Android version.

47. What is portable wi-fi hotspot?
Portable Wi-Fi Hotspot allows you to share your mobile internet connection to other wireless device. For example, using your Android-powered phone as a Wi-Fi Hotspot, you can use your laptop to connect to the Internet using that access point.

48. What is an action?
In Android development, an action is what the intent sender wants to do or expected to get as a response. Most application functionality is based on the intended action.

49. What is the difference between a regular bitmap and a nine-patch image?
In general, a Nine-patch image allows resizing that can be used as background or other image size requirements for the target device. The Nine-patch refers to the way you can resize the image: 4 corners that are unscaled, 4 edges that are scaled in 1 axis, and the middle one that can be scaled into both axes.

50. What language is supported by Android for application development?
The main language supported is Java programming language. Java is the most popular language for app development, which makes it ideal even for new Android developers to quickly learn to create and deploy applications in the Android environment.

MOBILE APPLICATION DEVELOPMENT LAB VIVA Questions and Answers pdf free download ::

400+ TOP Digital Logic Design VIVA Questions and Answers

Digital Logic Design VIVA Questions :-

1) Explain about setup time and hold time, what will happen if there is setup time and hold tine violation, how to overcome this?

  • Set up time is the amount of time before the clock edge that the input signal needs to be stable to guarantee it is accepted properly on the clock edge.
  • Hold time is the amount of time after the clock edge that same input signal has to be held before changing it to make sure it is sensed properly at the clock edge.
  • Whenever there are setup and hold time violations in any flip-flop, it enters a state where its output is unpredictable: this state is known as metastable state (quasi stable state); at the end of metastable state, the flip-flop settles down to either ‘1’ or ‘0’. This whole process is known as metastability

2) What is skew, what are problems associated with it and how to minimize it?

  • In circuit design, clock skew is a phenomenon in synchronous circuits in which the clock signal (sent from the clock circuit) arrives at different components at different times.
  • This is typically due to two causes. The first is a material flaw, which causes a signal to travel faster or slower than expected. The second is distance: if the signal has to travel the entire length of a circuit, it will likely (depending on the circuit’s size) arrive at different parts of the circuit at different times. Clock skew can cause harm in two ways. Suppose that a logic path travels through combinational logic from a source flip-flop to a destination flip-flop. If the destination flip-flop receives the clock tick later than the source flip-flop, and if the logic path delay is short enough, then the data signal might arrive at the destination flip-flop before the clock tick, destroying there the previous data that should have been clocked through. This is called a hold violation because the previous data is not held long enough at the destination flip-flop to be properly clocked through. If the destination flip-flop receives the clock tick earlier than the source flip-flop, then the data signal has that much less time to reach the destination flip-flop before the next clock tick. If it fails to do so, a setup violation occurs, so-called because the new data was not set up and stable before the next clock tick arrived. A hold violation is more serious than a setup violation because it cannot be fixed by increasing the clock period.
  • Clock skew, if done right, can also benefit a circuit. It can be intentionally introduced to decrease the clock period at which the circuit will operate correctly, and/or to increase the setup or hold safety margins. The optimal set of clock delays is determined by a linear program, in which a setup and a hold constraint appears for each logic path. In this linear program, zero clock skew is merely a feasible point.
    Clock skew can be minimized by proper routing of clock signal (clock distribution tree) or putting variable delay buffer so that all clock inputs arrive at the same time

3) What is slack?

  • ‘Slack’ is the amount of time you have that is measured from when an event ‘actually happens’ and when it ‘must happen’.. The term ‘actually happens’ can also be taken as being a predicted time for when the event will ‘actually happen’.
  • When something ‘must happen’ can also be called a ‘deadline’ so another definition of slack would be the time from when something ‘actually happens’ (call this Tact) until the deadline (call this Tdead).
    Slack = Tdead – Tact.
  • Negative slack implies that the ‘actually happen’ time is later than the ‘deadline’ time…in other words it’s too late and a timing violation….you have a timing problem that needs some attention.

4) What is glitch? What causes it (explain with waveform)? How to overcome it?

The following figure shows a synchronous alternative to the gated clock using a data path. The flip-flop is clocked at every clock cycle and the data path is controlled by an enable. When the enable is Low, the multiplexer feeds the output of the register back on itself. When the enable is High, new data is fed to the flip-flop and the register changes its state

5) Given only two xor gates one must function as buffer and another as inverter?

  1. Tie one of xor gates input to 1 it will act as inverter.
  2. Tie one of xor gates input to 0 it will act as buffer.

6) What is difference between latch and flipflop?

The main difference between latch and FF is that latches are level sensitive while FF are edge sensitive. They both require the use of clock signal and are used in sequential logic. For a latch, the output tracks the input when the clock signal is high, so as long as the clock is logic 1, the output can change if the input also changes. FF on the other hand, will store the input only when there is a rising/falling edge of the clock.

7) Build a 4:1 mux using only 2:1 mux?

4:1 mux using only 2:1 mux

8.Difference between heap and stack?

The Stack is more or less responsible for keeping track of what’s executing in our code (or what’s been “called”). The Heap is more or less responsible for keeping track of our objects (our data, well… most of it – we’ll get to that later.).
Think of the Stack as a series of boxes stacked one on top of the next. We keep track of what’s going on in our application by stacking another box on top every time we call a method (called a Frame). We can only use what’s in the top box on the stack. When we’re done with the top box (the method is done executing) we throw it away and proceed to use the stuff in the previous box on the top of the stack. The Heap is similar except that its purpose is to hold information (not keep track of execution most of the time) so anything in our Heap can be accessed at any time. With the Heap, there are no constraints as to what can be accessed like in the stack. The Heap is like the heap of clean laundry on our bed that we have not taken the time to put away yet – we can grab what we need quickly. The Stack is like the stack of shoe boxes in the closet where we have to take off the top one to get to the one underneath it.

9) Difference between mealy and moore state machine?

A) Mealy and Moore models are the basic models of state machines. A state machine which uses only Entry Actions, so that its output depends on the state, is called a Moore model. A state machine which uses only Input Actions, so that the output depends on the state and also on inputs, is called a Mealy model. The models selected will influence a design but there are no general indications as to which model is better. Choice of a model depends on the application, execution means (for instance, hardware systems are usually best realized as Moore models) and personal preferences of a designer or programmer

B) Mealy machine has outputs that depend on the state and input (thus, the FSM has the output written on edges)
Moore machine has outputs that depend on state only (thus, the FSM has the output written in the state itself.

Adv and Disadv
In Mealy as the output variable is a function both input and state, changes of state of the state variables will be delayed with respect to changes of signal level in the input variables, there are possibilities of glitches appearing in the output variables. Moore overcomes glitches as output dependent on only states and not the input signal level.
All of the concepts can be applied to Moore-model state machines because any Moore state machine can be implemented as a Mealy state machine, although the converse is not true.
Moore machine: the outputs are properties of states themselves… which means that you get the output after the machine reaches a particular state, or to get some output your machine has to be taken to a state which provides you the output.The outputs are held until you go to some other state Mealy machine:
Mealy machines give you outputs instantly, that is immediately upon receiving input, but the output is not held after that clock cycle.

10) Difference between onehot and binary encoding?

Common classifications used to describe the state encoding of an FSM are Binary (or highly encoded) and One hot.
A binary-encoded FSM design only requires as many flip-flops as are needed to uniquely encode the number of states in the state machine. The actual number of flip-flops required is equal to the ceiling of the log-base-2 of the number of states in the FSM.
A onehot FSM design requires a flip-flop for each state in the design and only one flip-flop (the flip-flop representing the current or “hot” state) is set at a time in a one hot FSM design. For a state machine with 9- 16 states, a binary FSM only requires 4 flip-flops while a onehot FSM requires a flip-flop for each state in the design
FPGA vendors frequently recommend using a onehot state encoding style because flip-flops are plentiful in an FPGA and the combinational logic required to implement a onehot FSM design is typically smaller than most binary encoding styles. Since FPGA performance is typically related to the combinational logic size of the FPGA design, onehot FSMs typically run faster than a binary encoded FSM with larger combinational logic blocks

11) How to achieve 180 degree exact phase shift?

Never tell using inverter
a) dcm’s an inbuilt resource in most of fpga can be configured to get 180 degree phase shift.
b) Bufgds that is differential signaling buffers which are also inbuilt resource of most of FPGA can be used.

12) What is significance of ras and cas in SDRAM?

  • SDRAM receives its address command in two address words.
  • It uses a multiplex scheme to save input pins. The first address word is latched into the DRAM chip with the row address strobe (RAS).
  • Following the RAS command is the column address strobe (CAS) for latching the second address word.
  • Shortly after the RAS and CAS strobes, the stored data is valid for reading.

13) Tell some of applications of buffer?

a)They are used to introduce small delays
b)They are used to eliminate cross talk caused due to inter electrode capacitance due to close routing.
c)They are used to support high fanout,eg:bufg

14) Implement an AND gate using mux?

This is the basic question that many interviewers ask. for and gate, give one input as select line,incase if u r giving b as select line, connect one input to logic ‘0’ and other input to a.

15) What will happen if contents of register are shifter left, right?

  • It is well known that in left shift all bits will be shifted left and LSB will be appended with 0 and in right shift all bits will be shifted right and MSB will be appended with 0 this is a straightforward answer
  • What is expected is in a left shift value gets Multiplied by 2 eg:consider 0000_1110=14 a left shift will make it 0001_110=28, it the same fashion right shift will Divide the value by 2.

16)Given the following FIFO and rules, how deep does the FIFO need to be to prevent underflow or overflow?

RULES:
1) frequency(clk_A) = frequency(clk_B) / 4
2) period(en_B) = period(clk_A) * 100
3) duty_cycle(en_B) = 25%

Assume clk_B = 100MHz (10ns)
From (1), clk_A = 25MHz (40ns)
From (2), period(en_B) = 40ns * 400 = 4000ns, but we only output for
1000ns,due to (3), so 3000ns of the enable we are doing no output work. Therefore, FIFO size = 3000ns/40ns = 75 entries.

Digital Logic Design LAB VIVA Questions :

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 ::

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.

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.