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.

200+ TOP CAO LAB VIVA Questions And Answers

CAO LAB VIVA Questions with Answers :-

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

CAO VIVA Questions And Answers :-

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

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

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

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

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

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

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

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

46. What are the four commonly used flags?

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

CAO VIVA Questions with Answers pdf :-

200+ TOP OOPS LAB VIVA Questions and Answers Pdf

OOPS LAB VIVA Questions :-

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

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

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

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

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

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

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

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

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

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

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

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

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

13. What isfriend function?

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

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

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

Example:
class complex {
double real, imag;

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

a=1.2, b=6

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

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

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

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

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

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

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

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

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

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

24. What are tokens?

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

25. Difference between overloading and overriding?

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

OOPS VIVA Questions pdf :-

26. Difference between class and an object?

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

45. What is static and dynamic binding?

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

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

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

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

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

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

300+ TOP UML LAB VIVA Questions and Answers

UML VIVA Questions and Answers :-

1. What is UML?
UML stands for the Unified Modeling Language.
It is a graphical language for

  1. visualizing
  2. constructing
  3. documenting the artifacts of a system.

It allows you to create a blue print of all the aspects of the system, before actually physically implementing the system.

2. What are the advantages of creating a model?

  • Modeling is a proven and well-accepted engineering technique which helps build a model.
  • Model is a simplification of reality; it is a blueprint of the actual system that needs to be built.
  • Model helps to visualize the system.
  • Model helps to specify the structural and behavior of the system.
  • Model helps make templates for constructing the system.
  • Model helps document the system.

3. What are the different views that are considered when building an object-oriented software system?
Normally there are 5 views.

  1. Use Case view – This view exposes the requirements of a system.
  2. Design View – Capturing the vocabulary.
  3. Process View – modeling the distribution of the systems processes and threads.
  4. Implementation view – addressing the physical implementation of the system.
  5. Deployment view – focus on the modeling the components required for deploying the system.

4. What are the major three types of modeling used?
The 3 Major types of modeling are

  • architectural,
  • behavioral, and
  • structural.

5. Name 9 modeling diagrams that are frequently used?
9 Modeling diagrams that are commonly used are

  1. Use case diagram
  2. Class Diagram
  3. Object Diagram
  4. Sequence Diagram
  5. statechart Diagram
  6. Collaboration Diagram
  7. Activity Diagram
  8. Component diagram
  9. Deployment Diagram.

6. How would you define Architecture?
Architecture is not only taking care of the structural and behavioral aspect of a software system but also taking into account the software usage, functionality, performance, reuse, economic and technology constraints.

7.What is SDLC (Software Development Life Cycle)?
SDLC is a system including processes that are

  • Use case driven,
  • Architecture centric,
  • Iterative, and
  • Incremental.

UML VIVA Questions and Answers :-

8. What is the Life Cycle divided into?
This Life cycle is divided into phases.
Each Phase is a time span between two milestones.
The milestones are

  • Inception,
  • Elaboration,
  • Construction, and
  • Transition.

9. What are the Process Workflows that evolve through these phases?
The Process Workflows that evolve through these phases are

  • Business Modeling,
  • Requirement gathering,
  • Analysis and Design,
  • Implementation,
  • Testing,
  • Deployment.
    Supporting Workflows are Configuration, change management, and Project management.

10. What are Relationships?
There are different kinds of relationships:

  • Dependencies,
  • Generalization, and
  • Association.

Dependencies are relationships between two entities.
A change in specification of one thing may affect another thing.
Most commonly it is used to show that one class uses another class as an argument in the signature of the operation.

Generalization is relationships specified in the class subclass scenario, it is shown when one entity inherits from other.
Associations are structural relationships that are:
a room has walls,
Person works for a company.

Aggregation is a type of association where there is a has a relationship.
As in the following examples: A room has walls, or if there are two classes room and walls then the relation ship is called a association and further defined as an aggregation.

11. How are the diagrams divided?
The nine diagrams are divided into static diagrams and dynamic diagrams.

12. Static Diagrams (Also called Structural Diagram):
The following diagrams are static diagrams.

  • Class diagram,
  • Object diagram,
  • Component Diagram,
  • Deployment diagram.

13. Dynamic Diagrams (Also called Behavioral Diagrams):
The following diagrams are dynamic diagrams.

  • Use Case Diagram,
  • Sequence Diagram,
  • Collaboration Diagram,
  • Activity diagram,
  • Statechart diagram.

14. What are Messages?
A message is the specification of a communication, when a message is passed that results in action that is in turn an executable statement.

15. What is an Use Case?

  • A use case specifies the behavior of a system or a part of a system.
  • Use cases are used to capture the behavior that need to be developed.
  • It involves the interaction of actors and the system.

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