Showing posts with label Study Materials. Show all posts
Showing posts with label Study Materials. Show all posts

C, C++ Tech Aptitude Questions

1. What is a modifier?
Answer:
A modifier, also called a modifying function is a member function that changes the value of at least one data member. In other words, an operation that modifies the state of an object. Modifiers are also known as ‘mutators’.

2. What is an accessor?
Answer:
An accessor is a class operation that does not modify the state of an object. The accessor functions need to be declared as const operations .
3. Differentiate between a template class and class template.
Answer:
Template class:
A generic definition or a parameterized class not instantiated until the client provides the needed information. It’s jargon for plain templates.
Class template:
A class template specifies how individual classes can be constructed much like the way a class specifies how individual objects can be constructed. It’s jargon for plain classes.

4. When does a name clash occur?
Answer:
A name clash occurs when a name is defined in more than one place. For example., two different class libraries could give two different classes the same name. If you try to use many class libraries at the same time, there is a fair chance that you will be unable to compile or link the program because of name clashes.

5. Define namespace.
Answer:
It is a feature in c++ to minimize name collisions in the global name space. This namespace keyword assigns a distinct name to a library that allows other libraries to use the same identifier names without creating any name collisions. Furthermore, the compiler uses the namespace signature for differentiating the definitions.

6. What is the use of ‘using’ declaration.
Answer:
A using declaration makes it possible to use a name from a namespace without the scope operator.

7. What is an Iterator class?
Answer:
A class that is used to traverse through the objects maintained by a container class. There are five categories of iterators:
 input iterators,
 output iterators,
 forward iterators,
 bidirectional iterators,
 random access.
An iterator is an entity that gives access to the contents of a container object without violating encapsulation constraints. Access to the contents is granted on a one-at a-time basis in order. The order can be storage order (as in lists and queues) or some arbitrary order (as in array indices) or according to some ordering relation (as in an ordered binary tree). The iterator is a construct, which provides an interface that, when called, yields either the next element in the container, or some value denoting the fact that there are no more elements to examine. Iterators hide the details of access to and update of the elements of a container class. The simplest and safest iterators are those that permit read-only access to the contents of a container class. The following code fragment shows how an iterator might appear in code:
cont_iter:=new cont_iterator();
x:=cont_iter.next();
while x/=none do
...
s(x);
...
x:=cont_iter.next();
end;
In this example, cont_iter is the name of the iterator. It is created on the first line by instantiation of cont_iterator class, an iterator class defined to iterate over some container class, cont. Succesive elements from the container are carried to x. The loop terminates when x is bound to some empty value. (Here, none)In the middle of the loop, there is s(x) an operation on x, the current element from the container. The next element of the container is obtained at the bottom of the loop.

9. List out some of the OODBMS available.
Answer:
 GEMSTONE/OPAL of Gemstone systems.
 ONTOS of Ontos.
 Objectivity of Objectivity inc.
 Versant of Versant object technology.
 Object store of Object Design.
 ARDENT of ARDENT software.
 POET of POET software.

10. List out some of the object-oriented methodologies.
Answer:
 Object Oriented Development (OOD) (Booch 1991,1994).
 Object Oriented Analysis and Design (OOA/D) (Coad and Yourdon 1991).
 Object Modelling Techniques (OMT) (Rumbaugh 1991).
 Object Oriented Software Engineering (Objectory) (Jacobson 1992).
 Object Oriented Analysis (OOA) (Shlaer and Mellor 1992).

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

12. What is a dangling pointer?
Answer:
A dangling pointer arises when you use the address of an object after its lifetime is over. This may occur in situations like returning addresses of the automatic variables from a function or using the address of the memory block after it is freed.
13. Differentiate between the message and method.
Answer:
Objects communicate by sending messages Provides response to a message to each other.
A message is sent to invoke a method. It is an implementation of an operation.

14. What is an adaptor class or Wrapper class?
Answer:
A class that has no functionality of its own. Its member functions hide the use of a third party software component or an object with the non-compatible interface or a nonobject- oriented implementation.

15. What is a Null object?
Answer:
It is an object of some class whose purpose is to indicate that a real object of that class does not exist. One common use for a null object is a return value from a member function that is supposed to return an object with some specified properties but cannot find such an object.

16. What is class invariant?
Answer:
A class invariant is a condition that defines all valid states for an object. It is a logical condition to ensure the correct working of a class. Class invariants must hold when an object is created, and they must be preserved under all operations of the class. In particular all class invariants are both preconditions and post-conditions for all operations or member functions of the class.

17. What do you mean by Stack unwinding?
Answer:
It is a process during exception handling when the destructor is called for all local objects between the place where the exception was thrown and where it is caught. 18. Define precondition and post-condition to a member function.
Answer:
Precondition:
A precondition is a condition that must be true on entry to a member function. A class is used correctly if preconditions are never false. An operation is not responsible for doing anything sensible if its precondition fails to hold. For example, the interface invariants of stack class say nothing about pushing yet another element on a stack that is already full. We say that isful() is a precondition of the push operation.
Post-condition:
A post-condition is a condition that must be true on exit from a member function if the precondition was valid on entry to that function. A class is implemented correctly if post-conditions are never false. For example, after pushing an element on the stack, we know that isempty() must necessarily hold. This is a post-condition of the push operation.

19. What are the conditions that have to be met for a condition to be an invariant of the
class?
Answer:
 The condition should hold at the end of every constructor.
 The condition should hold at the end of every mutator(non-const) operation.

20. What are proxy objects?
Answer:
Objects that stand for other objects are called proxy objects or surrogates.
Example:
template
class Array2D
{
public:
class Array1D
{
public:
T& operator[] (int index);
const T& operator[] (int index) const;
...
};
Array1D operator[] (int index);
const Array1D operator[] (int index) const;
...
};
The following then becomes legal:
Array2Ddata(10,20);
........
cout<Here data[3] yields an Array1D object and the operator [] invocation on that object yields the float in position(3,6) of the original two dimensional array. Clients of the Array2D class need not be aware of the presence of the Array1D class. Objects of this latter class stand for one-dimensional array objects that, conceptually, do not exist for lients of Array2D. Such clients program as if they were using real, live, two-dimensional arrays. Each Array1D object stands for a one-dimensional array that is absent from a conceptual model used by the clients of Array2D. In the above example, Array1D is a proxy class. Its instances stand for one-dimensional arrays that, conceptually, do not exist

21. Name some pure object oriented languages.
Answer:
 Smalltalk,
 Java,
 Eiffel,
 Sather.

22. Name the operators that cannot be overloaded.
Answer:
sizeof . .* .-> :: ?:

23. What is a node class?
Answer:
A node class is a class that,
 relies on the base class for services and implementation,
 provides a wider interface to te users than its base class,
 relies primarily on virtual functions in its public interface
 depends on all its direct and indirect base class
 can be understood only in the context of the base class
 can be used as base for further derivation
 can be used to create objects.
A node class is a class that has added new services or functionality beyond the services inherited from its base class.

24. What is an orthogonal base class?
Answer:
If two base classes have no overlapping methods or data they are said to be independent of, or orthogonal to each other. Orthogonal in the sense means that two classes operate in different dimensions and do not interfere with each other in any way. The same derived class may inherit such classes with no difficulty.

25. What is a container class? What are the types of container classes?
Answer:
A container class is a class that is used to hold objects in memory or external storage. A container class acts as a generic holder. A container class has a predefined ehavior and a well-known interface. A container class is a supporting class whose purpose is to hide the topology used for maintaining the list of objects in memory. When a container class contains a group of mixed objects, the container is called a heterogeneous container; when the container is holding a group of objects that are all the same, the container is called a homogeneous container.
26. What is a protocol class?
Answer:
An abstract class is a protocol class if:
 it neither contains nor inherits from classes that contain member data, non-virtual functions, or private (or protected) members of any kind.
 it has a non-inline virtual destructor defined with an empty implementation,
 all member functions other than the destructor including inherited functions, are declared pure virtual functions and left undefined.

27. What is a mixin class?
Answer:
A class that provides some but not all of the implementation for a virtual base class is often called mixin. Derivation done just for the purpose of redefining the virtual functions in the base classes is often called mixin inheritance. Mixin classes typically don't share common bases.

28. What is a concrete class?
Answer:
A concrete class is used to define a useful object that can be instantiated as an automatic variable on the program stack. The implementation of a concrete class is defined. The concrete class is not intended to be a base class and no attempt to minimize dependency on other classes in the implementation or behavior of the class.

29.What is the handle class?
Answer:
A handle is a class that maintains a pointer to an object that is programmatically accessible through the public interface of the handle class.
Explanation:
In case of abstract classes, unless one manipulates the objects of these classesthrough pointers and references, the benefits of the virtual functions are lost. User code may become dependent on details of implementation classes because an abstract type cannot be allocated statistically or on the stack without its size being known. Using pointers or references implies that the burden of memory management falls on the user. Another limitation of abstract class object is of fixed size. Classes however are used to represent concepts that require varying amounts of storage to implement them. A popular technique for dealing with these issues is to separate what is used as a single object in two parts: a handle providing the user interface and a representation holding all
or most of the object's state. The connection between the handle and the representation is typically a pointer in the handle. Often, handles have a bit more data than the simple epresentation pointer, but not much more. Hence the layout of the handle is typically table, even when the representation changes and also that handles are small enough to move around relatively freely so that the user needn’t use the pointers and the references.

30. What is an action class?
Answer:
The simplest and most obvious way to specify an action in C++ is to write a
function. However, if the action has to be delayed, has to be transmitted 'elsewhere'
before being performed, requires its own data, has to be combined with other actions, etc
then it often becomes attractive to provide the action in the form of a class that can
execute the desired action and provide other services as well. Manipulators used with
iostreams is an obvious example.
Explanation:
A common form of action class is a simple class containing just one virtual
function.
class Action
{
public:
virtual int do_it( int )=0;
virtual ~Action( );
}
Given this, we can write code say a member that can store actions for later
execution without using pointers to functions, without knowing anything about the
objects involved, and without even knowing the name of the operation it invokes. For
example:
class write_file : public Action
{
File& f;
public:
int do_it(int)
{
return fwrite( ).suceed( );
}
};
class error_message: public Action
{
response_box db(message.cstr( ),"Continue","Cancel","Retry");
switch (db.getresponse( ))
{
case 0: return 0;

case 1: abort();
case 2: current_operation.redo( );return 1;
}
};
A user of the Action class will be completely isolated from any knowledge of
derived classes such as write_file and error_message.

100 Technical Questions with answers

Technical Questions

1. A 2MB PCM(pulse code modulation) has
a) 32 channels
b) 30 voice channels & 1 signalling channel.
c) 31 voice channels & 1 signalling channel.
d) 32 channels out of which 30 voice channels, 1 signalling channel, & 1 Synchronizatio channel.
Ans: (c)

2. Time taken for 1 satellite hop in voice communication is
a) 1/2 second
b) 1 seconds
c) 4 seconds
d) 2 seconds
Ans: (a)

3. Max number of satellite hops allowed in voice communication is :
a) only one
b) more han one
c) two hops
d) four hops
Ans: (c)

4. What is the max. decimal number that can be accomodated in a byte.
a) 128
b) 256
c) 255
d) 512
Ans: (c)

5. Conditional results after execution of an instruction in a micro processor is stored in
a) register
b) accumulator
c) flag register
d) flag register part of PSW(Program Status Word)
Ans: (d)

6. Frequency at which VOICE is sampled is
a) 4 Khz
b) 8 Khz
c) 16 Khz
d) 64 Khz
Ans: (a)

7. Line of Sight is
a) Straight Line
b) Parabolic
c) Tx & Rx should be visible to each other
d) none
Ans: (c)

8. Purpose of PC(Program Counter) in a MicroProcessor is
a) To store address of TOS(Top Of Stack)
b) To store address of next instruction to be executed.
c) count the number of instructions.
d) to store base address of the stack.
Ans: (b)

9. What action is taken when the processor under execution is interrupted by a non-maskable interrupt?
a) Processor serves the interrupt request after completing the execution of the current instruction.
b) Processor serves the interupt request after completing the current task.
c) Processor serves the interupt request immediately.
d) Processor serving the interrupt request depends upon the priority of the current task under execution.
Ans: (a)

10. The status of the Kernel is
a) task
b) process
c) not defined.
d) none of the above.
Ans: (b)

11. To send a data packet using datagram , connection will be established
a) before data transmission.
b) connection is not established before data transmission.
c) no connection is required.
d) none of the above.
Ans: (c)

12. Word allignment is
a) alligning the address to the next word boundary of the machine.
b) alligning to even boundary.
c) alligning to word boundary.
d) none of the above.
Ans: (a)

13 When a 'C' function call is made, the order in which parameters passed to the function are pushed into the stack is
a) left to right
b) right to left
c) bigger variables are moved first than the smaller variales.
d) smaller variables are moved first than the bigger ones.e) none of the above.
Ans: (b)

14 What is the type of signalling used between two exchanges?
a) inband
b) common channel signalling
c) any of the above
d) none of the above.
Ans: (a)

15 Buffering is
a) the process of temporarily storing the data to allow for small variation in device speeds
b) a method to reduce cross talks
c) storage of data within transmitting medium until the receiver is ready to receive.
d) a method to reduce routing overhead.
Ans: (a)

16. Memory allocation of variables declared in a program is
a) allocated in RAM
b) allocated in ROM.
c) allocated on stack.
d) assigned to registers.
Ans: (c)

17. A software that allows a personal computer to pretend as a computer terminal is
a) terminal adapter
b) bulletin board
c) modem
d) terminal emulation
Ans: (d)

18. Find the output of the following program
int *p,*q;
p=(int *)1000;
q=(int *)2000;
printf("%d",(q-p));
Ans: 500

19. Which addressing mode is used in the following statements:
(a) MVI B,55 (b) MOV B,A (c) MOV M,A
Ans. (a) Immediate addressing mode.
(b) Register Addressing Mode
(c) Direct addressing mode

20. RS-232C standard is used in _____________.
Ans. Serial I/O

21. Memory. Management in Operating Systems is done by
a) Memory Management Unit
b) Memory management software of the Operating System
c) Kernel
Ans: (b)

22. What is done for a Push opertion?
Ans: SP is decremented and then the value is stored.

23. Binary equivalent of 52
Ans. 110100

24. Hexadecimal equivalent of 3452
Ans. 72A

25. Explain Just In Time Concept ?
Ans. Elimination of waste by purchasing manufacturing exactly when needed

26. A good way of unit testing s/w program is
Ans. User test

27. OOT uses
Ans. Encapsulated of detect methods

28.EDI useful in
Ans. Electronic Transmission

29. MRPII different from MRP
Ans. Modular version of man redundant initials

30. Hard disk time for R/W head to move to correct sector
Ans. Latency Time

31. The percentage of times a page number bound in associate register is called
Ans. Bit ratio

32. Expand MODEM
Ans. Modulator and Demodulator

33. RDBMS file system can be defined as
Ans. Interrelated

34. Super Key is
Ans. Primary key and Attribute

35. Windows 95 supports
(a) Multiuser
(b) n tasks
(c) Both
(d) None
Ans. (a)

36.In the command scanf, h is used for
Ans. Short int

37.A process is defined as
Ans. Program in execution

38.A thread is
Ans. Detachable unit of executable code

39.What is the advantage of Win NT over Win 95
Ans. Robust and secure


40.How is memory management done in Win95
Ans. Through paging and segmentation

41.What is meant by polymorphism
Ans. Redfinition of a base class method in a derived class

42.What is the essential feature of inheritance
Ans. All properties of existing class are derived

43.What does the protocol FTP do
Ans. Transfer a file b/w stations with user authentification

44.In the transport layer ,TCP is what type of protocol
Ans. Connection oriented

45.Why is a gateway used
Ans. To connect incompatible networks

46.How is linked list implemented
Ans. By referential structures

47.What method is used in Win95 in multitasking
Ans. Non preemptive check

48.What is a semaphore
Ans. A method synchronization of multiple processes

49.What is the precedence order from high to low, of the symbols () ++ /
Ans. () , ++, /


50.Preorder of A*(B+C)/D-G
Ans.*+ABC/-DG

51.What is the efficiency of merge sort
Ans. O (n log n)

52.In which layer are routers used
Ans. In network layer

53.Which of the following sorting algorithm has average sorting behavior -- Bubble sort, merge sort, heap sort, exchange sort
Ans. Heap sort

54.In binary search tree which traversal is used for getting ascending order values—Inorder, post order, preorder
Ans. Inorder

55.What are device drivers used for
Ans. To provide software for enabling the hardware

56.What is fork command in unix
Ans. System call used to create process

57.What is make command in unix
Ans. Used for creation of more than one file

58.In unix. profile contains
Ans. Start up program

59.In unix ' ls 'stores contents in
Ans. node block

60. Which of the following involves context switch,
(a) system call
(b) privileged instruction
(c) floating point exception
(d) all the above
(e) none of the above
Ans: (a)

61. In OST, terminal emulation is done in
(a) sessions layer
(b) application layer
(c) presentation layer
(d) transport layer
Ans: (b)

62. For 1 MB memory, the number of address lines required,
(a)11
(b)16
(c)22
(d)24
Ans. (b)

63. Semaphore is used for
(a) synchronization
(b) dead-lock avoidance
(c) box
(d) none
Ans. (a)

64. Which holds true for the following statement
class c: public A, public B
a) 2 member in class A, B should not have same name
b) 2 member in class A, C should not have same name
c) both
d) none
Ans. (a)

65.Preproconia.. does not do which one of the following
(a) macro
(b) conditional complication
(c) in type checking
(d) including load file
Ans. (c)

66. Piggy backing is a technique for
a) Flow control
b) Sequence
c) Acknowledgement
d) retransmission
Ans. (c)

67. Which is not a memory management scheme?
a) Buddy system
b) swapping
c) monitors
d) paging
Ans : c

68. There was a circuit given using three nand gates with two inputs and one output. Find the output.
a) OR
b) AND
c) XOR
d) NOT
Ans. (a)

69. Integrated check value (ICV) are used as:
Ans. The client computes the ICV and then compares it with the senders value.

70. When applets are downloaded from web sites , a byte verifier performs _________?
Ans. Status check.

71. An IP/IPX packet received by a computer using... having IP/IPX both how the packet is handled.
Ans. Read the, field in the packet header with to send IP or IPX protocol.

72. The UNIX shell ....
a) does not come with the rest of the systemb) forms the interface between the user and the kernalc) does not give any scope for programmingd) deos not allow calling one program from with in anothere) all of the above
Ans. (b)

73. In UNIX a files i-node ......?
Ans. Is a data structure that defines all specifications of a file like the file size, number of lines to a file, permissions etc.

74. The very first process created by the kernel that runs till the kernel process is halts is
a) Init
b) getty
c) both (a) and (b)
d) none of these
Ans. (a)

75. In the process table entry for the kernel process, the process id value is
(a) 0
(b) 1
(c) 2
(d) 255
(e) it does not have a process table entry
Ans. (a)

76. Which of the following API is used to hide a window
a) Show Window
b) Enable Window
c) Move Window
d) SetWindowPlacement
e) None of the above
Ans. (a)

77. Which function is the entry point for a DLL in MS Windows 3.1
a) Main
b) Winmain
c) Dllmain
d) Libmain
e) None
Ans. (b)

78. The standard source for standard input, standard output and standard error is
a) the terminal
b) /dev/null
c) /usr/you/input, /usr/you/output/, /usr/you/error respectively
d) None
Ans. (a)

79. The redirection operators > and >>
a) do the same function
b) differ : > overwrites, while >> appends
c) differ : > is used for input while >> is used for output
d) differ : > write to any file while >> write only to standard output
e) None of these
Ans. (b)

80. The command grep first second third /usr/you/myfile
a) prints lines containing the words first, second or third from the file /usr/you/myfile
b) searches for lines containing the pattern first in the filessecond, third, and /usr/you/myfile and prints them
c) searches the files /usr/you/myfile and third for lines containing the words first or second and prints them
d) replaces the word first with the word second in the files third and /usr/you/myfile
e) None of the above
Ans. (b)

81. You are creating a Index on EMPNO column in the EMPLOYEE table. Which statement will you use?
a) CREATE INdEX emp_empno_idx ON employee, empno;
b) CREATE INdEX emp_empno_idx FOR employee, empno;
c) CREATE INdEX emp_empno_idx ON employee(empno);
d) CREATE emp_empno_idx INdEX ON employee(empno);
Ans. c

82. Which program construct must return a value?
a) Package
b) Function
c) Anonymous block
d) Stored Proceduree) Application Procedure
Ans. b

83. Which Statement would you use to remove the EMPLOYEE_Id_PK PRIMARY KEY constraint and all depending constraints from the EMPLOYEE table?a
) ALTER TABLE employee dROP PRIMARY KEY CASCAdE;
b) ALTER TABLE employee dELETE PRIMARY KEY CASCAdE;
c) MOdIFY TABLE employee dROP CONSTRAINT employee_id_pk CASCAdE;
d) ALTER TABLE employee dROP PRIMARY KEY employee_id_pk CASCAdE;
e) MOdIFY TABLE employee dELETE PRIMARY KEY employee_id_pk CASCAdE;
Ans. a

84. Which three commands cause a transaction to end? (Choose three)
a) ALTER
b) GRANT c
) DELETE
d) INSERT
e) Updatef) ROLLBACK
Ans. a ,b ,f

85. Under which circumstance should you create an index on a table?
a) The table is small.
b) The table is updated frequently.
c) A columns values are static and contain a narrow range of values
d) Two columns are consistently used in the WHERE clause join condition of SELECT statements.
Ans.d

86. What was the first name given to Java Programming Language.
a) Oak - Java
b) Small Talk
c) Oak
d) None
Ans.a

87.When a bicycle is in motion,the force of friction exerted by the ground on the two wheels is such that it acts
(a) In the backward direction on the front wheel and in the forward direction on the rear wheel.
(b) In the forward direction on the front wheel and in the backward direction on the rear wheel.
(c) In the backward direction on both the front and rear wheels.
(d) In the backward direction on both the front and rear wheels.
Ans. (d)

88. A certain radioactive element A, has a half life = t seconds. In (t/2) seconds the fraction of the initial quantity of the element so far decayed is nearly
(a) 29%
(b) 15%
(c) 10%
(d) 45%
Ans. (a)

89. Which of the following plots would be a straight line ?
(a) Logarithm of decay rate against logarithm of time
(b) Logarithm of decay rate against logarithm of number of decaying nuclei
(c) Decay rate against time
(d) Number of decaying nuclei against time
Ans. (b)

90. A radioactive element x has an atomic number of 100. It decays directly into an element y which decays directly into element z. In both processes a charged particle is emitted. Which of the following statements would be true?
(a) y has an atomic number of 102
(b) y has an atomic number of 101
(c) z has an atomic number of 100
(d) z has an atomic number of 101
Ans. (b)

91. If the sum of the roots of the equation ax2 + bx + c=0 is equal to the sum of the squares of their reciprocals then a/c, b/a, c/b are in
(a) AP
(b) GP
(c) HP
(d) None of these
Ans. (c)

92. A man speaks the truth 3 out of 4 times. He throws a die and reports it to be a 6. What is the probability of it being a 6?
(a) 3/8
(b) 5/8
(c) 3/4
(d) None of the above
Ans. (a)

93. If cos2A + cos2B + cos2C = 1 then ABC is a
(a) Right angle triangle
(b) Equilateral triangle
(c) All the angles are acute
(d) None of these
Ans. (a)

94. Image of point (3,8) in the line x + 3y = 7 is
(a) (-1,-4)
(b) (-1,4)
(c) (2,-4)
(d) (-2,-4)
Ans. (a)

95. The mass number of a nucleus is
(a) Always less than its atomic number
(b) Always more than its atomic number
(c) Sometimes more than and sometimes equal to its atomic number
(d) None of the above
Ans. (c)

96. The maximum KE of the photoelectron emitted from a surface is dependent on
(a) The intensity of incident radiation
(b) The potential of the collector electrode
(c) The frequency of incident radiation
(d) The angle of incidence of radiation of the surface
Ans. (c)

97. Which of the following is not an essential condition for interference
(a) The two interfering waves must be propagated in almost the same direction or the two interfering waves must intersect at a very small angle
(b) The waves must have the same time period and wavelength
(c) Amplitude of the two waves should be the same
(d) The interfering beams of light must originate from the same source
Ans. (c)

98. When X-Ray photons collide with electrons
(a) They slow down
(b) Their mass increases
(c) Their wave length increases
(d) Their energy decreases
Ans. (c)

99. An electron emits energy
(a) Because its in orbit
(b) When it jumps from one energy level to another
(c) Electrons are attracted towards the nucleus
(d) The electrostatic force is insufficient to hold the electrons in orbits
Ans. (b)

100. How many bonds are present in CO2 (Carbon di Oxide) molecule?
(a) 1
(b) 2
(c) 0
(d) 4
Ans. (d)

100 Verbal (Words)

Verbal
1. Depreciation: deflation, depression, devaluation, fall, slump
2. Deprecate : feel and express disapproval,
3. Incentive : thing one encourages one to do (stimulus)
4. Echelon : level of authority or responsibility
5. Innovation : make changes or introduce new things
6. Intermittent : externally stopping and then starting
7. Detrimental: harmful
8. Conciliation : make less angry or more friendly
9. Orthodox: conventional or traditional, superstitious
10. Fallible : liable to error
11. Volatile : ever changing
12. Manifest: clear and obvious
13. Connotation : suggest or implied meaning of expression
14. Reciprocal: reverse or opposite
15. Agrarian : related to agriculture
16. Vacillate : undecided or dilemma
17. Expedient : fitting proper, desirable
18. Simulate : produce artificially resembling an existing one.
19. Access : to approach
20. Compensation: salary
21. Truncate : shorten by cutting
22. Adherence : stick
23. Heterogeneous: non similar things
24. Surplus : excessive
25. Assess : determine the amount or value
26. Cognizance : knowledge
27. Retrospective : review
28. Naive : innocent, rustic
29. Equivocate : tallying on both sides, lie, mislead
30. Postulate : frame a theory
31. Latent : dormant, secret
32. Fluctuation : wavering,
33. Eliminate : to reduce
34. Affinity : strong liking
35. Expedite : hasten
36. Console : to show sympathy
37. Adversary : opposition
38. Affable : lovable or approachable
39. Decomposition : rotten
40. Agregious : apart from the crowd, especially bad
41. Conglomeration: group, collection
42. Aberration: deviation
43. Augury : prediction
44. Creditability : ability to common belief, quality of being credible
45. Coincident: incidentally
46. Constituent : accompanying
47. Differential : having or showing or making use of
48. Litigation : engaging in a law suit
49. Moratorium: legally or officially determined period of delay before
fulfillment of the agreement of paying of debts.
50. Negotiate : discuss or bargain
51. Preparation : act of preparing
52. Preponderant : superiority of power or quality
53. Relevance : quality of being relevant
54. Apparatus : appliances
55. Ignorance : blindness, in experience
56. Obsession: complex enthusiasm
57. precipitate : speed, active
58. corroborative: refutable
59. obnoxious : harmless
60. sanction: hinder
61. empirical: experimental
62. aborigine: emigrant
63. corpulent : emaciated
64. officious: pragmate
65. Agitator : Firebrand :: Renegade : Turncoat
66. Burst : Sound :: Tinder : Fire
67. Star : cluster :: Tree : clump
68. Piston : Cylinder :: elevator : shaft
69. Mitigate : punishment :: commute : sentence
70. Erudite : scholar :: illiterate : ignorant
71. Fire : Ashes :: explosion : debris
72. mason : wall :: Author : Book
73. Fire : Ashes :: Event : memories
74. (a) cheerleaders : pompoms
(b) audience:seats
(c) team:goalposts
(d) conductor:podium
(e) referee:decision

Ans. (a)

75. archipelago:islands::

(a) arbor:bower
(b) garden:flower
(c) mountain:valley
(d) sand:dune
(e) constellation:star

Ans. (a)

76. crow:boastful ::

(a) smirk:witty
(b) conceal:s;y
(c) pout:sulky
(d) blush:coarse
(e) bluster:unhappy

Ans. (a)

77. bracket:shelf ::

(a) hammer:anvil
(b) girder:rivet
(c) strut:rafter
(d) valve:pipe
(e) bucket:well

Ans. (a)

78. taxonomy:classification ::

(a) etymology:derivation
(b) autonomy:authorization
(c) economy:rationalization
(d) tautology:justification
(e) ecology:urbanisation

Ans. (a)

79. moderator:debate ::

(a) legislator:election
(b) chef:banquet
(c) auditor:lecture
(d) conspirator:plot
(e) umpire:game

Ans. (a)

80. glossary:words ::

(a) catalogue:dates
(b) atlas:maps
(c) almanac:synonyms
(d) thesaurus:rhymes
(e) lexicon:numbers

Ans. (a)

81. lumber: bear ::

(a) roost:hen
(b) bray:donkey
(c) waddle:goose
(d) swoop:hawk
(e) chirp:sparrow

Ans. (a)

82. celerity:snail ::

(a) indolence:sloth
(b) cunning:weasel
(c) curiosity:cat
(d) humility:peacock
(e) obstinacy:mule

Ans. (a)

83. wood:sand ::

(a) coal:burn
(b) brick:lay
(c) oil:polish
(d) metal:burnish
(e) stone:quarry

Ans. (a)

84. carpenter:saw ::

(a) stenographer:typist
(b) painter:brush
(c) lawyer:brief
(d) runner:sneakers
(e) seamstress:scissors

Ans. (a)

85. horns:bull ::

(a) mane:lion
(b) wattles:turkey
(c) antlers:stag
(d) hooves:horse
(e) wings:eagle

Ans. (a)

86. gullible:duped ::

(a) credible:cheated
(b) careful:cautioned
(c) malleable:moulded
(d) myopic:mislead
(e) articulate:silenced

Ans. (a)

87. marathon:stamina ::

(a) relay:independence
(b) hurdle:perseverance
(c) sprint:celerity
(d) job:weariness
(e) ramble:directness

Ans. (a)

88. Skin:man ::

(a) hide:animal
(b) jump:start
(c) peel:potato
(d) eat:food
(e) wool:cloth

Ans. (a)

89. Bamboo:Shoot ::

(a) Bean:Sprout
(b) Peas:Pod
(c) Potato:Eye
(d) Carrot:Root
(e) Leaf:Stem

Ans. (a)

90. Deflect:Missile ::

(a) Siege:Castle
(b) Distract:Attraction
(c) Protect:Honour
(d) Drop:Catch
(e) Score:Goal

Ans. (a)

91. Editor:magazine ::

(a) captain:ship
(b) actor:movie
(c) director:film
(d) player:team
(e) jockey:horse

Ans. (a)

92. Volcano : Lava ::

(a) Fault:earthquate
(b) crack:wall
(c) tunnel:dig
(d) water:swim
(e) floor:polish

Ans. (a)

93. Disregarded
(a) heed
(b) hopeful
(c) evade
(d) dense
Ans. (a)

94. Obviate
(a) becloud
(b) necessitate
(c) rationalize
(d) execute
Ans. (b)

95. Superficial
(a) profound
(b) exaggerated
(c) subjective
(d) spirited
Ans. (a)

96. chief : tribe :: governer : state
97. epaulette : shoulder :: tiara : head
98. guttural : throat :: gastric : stomach
99. inept : clever :: languid : active
100. Erudite : scholar :: illiterate : ignorant

Antonyms and Synonyms

ANTONYMS:

1) TRACTABLE
(i) OBJECTIONABLE (ii) ENJOYABLE (iii) ADAPTABLE (iv) OBSTINATE

2) COVERT
(i) MANIFEST (ii) INVISIBLE (iii) SCARED (iv) ALTER

3) PENSIVE
(i) REPENTENT (ii) SAD (iii) THOUGHTLESS (iv) CARELESS

4) MITIGATE
(i) AGGRAVATE (ii) RELIEVE (iii) ELEMINATE (iv) EXHUMAN

5) DIVERGENT
(i) CONTRARY (ii) COMING TOGETHER
(iii) CONVERSANT (iv) CONTROVERSY

6) DOGMATIC
(i) SCEPTICAL (ii) RESILIENT (iii) STUBBORN (iv) SUSPICIOUS

7) CLUTCH
(i) HOLD (ii) GRAB (iii) RELEASE (iv) SPREAD

8) MOTLEY
(i) BULKY (ii) SPECKLED (iii) HOMOGENEOUS (iv) DIFFERENT

9) RELINQUISH
(i) PURSUE (ii) VANQUISH (iii) DESTROY (iv) DEVASTATE

10) TRANSIENT
(i) PERMANENT (ii) REMOVED

Compose x
Pristine x
Turbid x
Precipitate x
Revere x
Hamper x
Slur x
Protean x
Fascinate x
Fickle x
Synergy x
Hidebound
Monetary
Incompatible Choices-Indifferent, Faulty

Antonyms
1) Mollify ×
2) Inundate ×
3) Equanimity ×
4) Gauche ×
5) Exhume ×
6) Baleful ×
7) Anathematize ×
8) Enigmatic ×
9) Pariah ×
10) Turbid ×

Antonyms:
Awry *
Consensus *
Retrograde *
Galleon *
Chide *
Depravity *
Paradox *
Stilted *
Levity *
Fritty *
Genry *

Antonyms
---------------
11.exonerate:
12.sagacity:
13.commensurate:
14.nonchalant:
15.cryptic:
16:rupture:
17.revocable:
18.slump:
19.translucent:
20.dangle :



1.Rupture
a. break b. continue c. enthusiasm d. happiness

2. Revocable
a. alterable b. awakened c. final. d. called upon

3. Stump
a. calm b. safe c. prosperous d. waste

4. Translucent
a. clear b. opaque c. movement d. efficient

5. Dangle
a.sound b.ornament c.small d.secure

Networking concepts

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

32. What are major types of networks and explain?
 Server-based network
 Peer-to-peer network
Peer-to-peer network, computers can act as both servers sharing resources and as clients using the resources.
Server-based networks provide centralized control of network resources and rely on server computers to provide security and network administration

33. What are the important topologies for networks?
 BUS topology:
In this each computer is directly connected to primary network cable in a single line.
Advantages:
Inexpensive, easy to install, simple to understand, easy to extend.

 STAR topology:
In this all computers are connected using a central hub.
Advantages:
Can be inexpensive, easy to install and reconfigure and easy to trouble shoot physical problems.

 RING topology:
In this all computers are connected in loop.
Advantages:
All computers have equal access to network media, installation can be simple, and signal does not degrade as much as in other topologies because each computer regenerates it.

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

49. Expand IDEA.
IDEA stands for International Data Encryption Algorithm.

50. What is wide-mouth frog?
Wide-mouth frog is the simplest known key distribution center (KDC) authentication protocol.

51. What is Mail Gateway?
It is a system that performs a protocol translation between different electronic mail delivery protocols.

52. What is IGP (Interior Gateway Protocol)?
It is any routing protocol used within an autonomous system.

53. What is EGP (Exterior Gateway Protocol)?
It is the protocol the routers in neighboring autonomous systems use to identify the set of networks that can be reached within or via each autonomous system.

54. What is autonomous system?
It is a collection of routers under the control of a single administrative authority and that uses a common Interior Gateway Protocol.

55. What is BGP (Border Gateway Protocol)?
It is a protocol used to advertise the set of networks that can be reached with in an autonomous system. BGP enables this information to be shared with the autonomous system. This is newer than EGP (Exterior Gateway Protocol).

56. What is Gateway-to-Gateway protocol?
It is a protocol formerly used to exchange routing information between Internet core routers.

57. What is NVT (Network Virtual Terminal)?
It is a set of rules defining a very simple virtual terminal interaction. The NVT is used in the start of a Telnet session.

58. What is a Multi-homed Host?
It is a host that has a multiple network interfaces and that requires multiple IP addresses is called as a Multi-homed Host.

59. What is Kerberos?
It is an authentication service developed at the Massachusetts Institute of Technology. Kerberos uses encryption to prevent intruders from discovering passwords and gaining unauthorized access to files.

60. What is OSPF?
It is an Internet routing protocol that scales well, can route traffic along multiple paths, and uses knowledge of an Internet's topology to make accurate routing decisions.

61. What is Proxy ARP?
It is using a router to answer ARP requests. This will be done when the originating host believes that a destination is local, when in fact is lies beyond router.


62. What is SLIP (Serial Line Interface Protocol)?
It is a very simple protocol used for transmission of IP datagrams across a serial line.

63. What is RIP (Routing Information Protocol)?
It is a simple protocol used to exchange information between the routers.

64. What is source route?
It is a sequence of IP addresses identifying the route a datagram must follow. A source route may optionally be included in an IP datagram header.

Operating Systems

Following are a few basic questions that cover the essentials of OS:

1.Explain the concept of Reentrancy.
It is a useful, memory-saving technique for multiprogrammed timesharing systems. A Reentrant Procedure is one in which multiple users can share a single copy of a program during the same period. Reentrancy has 2 key aspects: The program code cannot modify itself, and the local data for each user process must be stored separately. Thus, the permanent part is the code, and the temporary part is the pointer back to the calling program and local variables used by that program. Each execution instance is called activation. It executes the code in the permanent part, but has its own copy of local variables/parameters. The temporary part associated with each activation is the activation record. Generally, the activation record is kept on the stack.
Note: A reentrant procedure can be interrupted and called by an interrupting program, and still execute correctly on returning to the procedure.

2.Explain Belady's Anomaly.
Also called FIFO anomaly. Usually, on increasing the number of frames allocated to a process' virtual memory, the process execution is faster, because fewer page faults occur. Sometimes, the reverse happens, i.e., the execution time increases even when more frames are allocated to the process. This is Belady's Anomaly. This is true for certain page reference patterns.

3.What is a binary semaphore? What is its use?
A binary semaphore is one, which takes only 0 and 1 as values. They are used to implement mutual exclusion and synchronize concurrent processes.

4.What is thrashing?
It is a phenomenon in virtual memory schemes when the processor spends most of its time swapping pages, rather than executing instructions. This is due to an inordinate number of page faults.

5.List the Coffman's conditions that lead to a deadlock.
a.Mutual Exclusion: Only one process may use a critical resource at a time.
b.Hold & Wait: A process may be allocated some resources while waiting for others.
c.No Pre-emption: No resource can be forcible removed from a process holding it.
d.Circular Wait: A closed chain of processes exist such that each process holds at least one resource needed by another process in the chain.


6.What are short-, long- and medium-term scheduling?
Long term scheduler determines which programs are admitted to the system for processing. It controls the degree of multiprogramming. Once admitted, a job becomes a process.
Medium term scheduling is part of the swapping function. This relates to processes that are in a blocked or suspended state. They are swapped out of real-memory until they are ready to execute. The swapping-in decision is based on memory-management criteria.
Short term scheduler, also know as a dispatcher executes most frequently, and makes the finest-grained decision of which process should execute next. This scheduler is invoked whenever an event occurs. It may lead to interruption of one process by preemption.

7.What are turnaround time and response time?
Turnaround time is the interval between the submission of a job and its completion. Response time is the interval between submission of a request, and the first response to that request.

8.What are the typical elements of a process image?
 User data: Modifiable part of user space. May include program data, user stack area, and programs that may be modified.
 User program: The instructions to be executed.
 System Stack: Each process has one or more LIFO stacks associated with it. Used to store parameters and calling addresses for procedure and system calls.
 Process control Block (PCB): Info needed by the OS to control processes.

9.What is the Translation Lookaside Buffer (TLB)?
In a cached system, the base addresses of the last few referenced pages is maintained in registers called the TLB that aids in faster lookup. TLB contains those page-table entries that have been most recently used. Normally, each virtual memory reference causes 2 physical memory accesses-- one to fetch appropriate page-table entry, and one to fetch the desired data. Using TLB in-between, this is reduced to just one physical memory access in cases of TLB-hit.

10.What is the resident set and working set of a process?
Resident set is that portion of the process image that is actually in real-memory at a particular instant. Working set is that subset of resident set that is actually needed for execution. (Relate this to the variable-window size method for swapping techniques.)

11.When is a system in safe state?
The set of dispatchable processes is in a safe state if there exists at least one temporal order in which all processes can be run to completion without resulting in a deadlock.

12.What is cycle stealing?
We encounter cycle stealing in the context of Direct Memory Access (DMA). Either the DMA controller can use the data bus when the CPU does not need it, or it may force the CPU to temporarily suspend operation. The latter technique is called cycle stealing. Note that cycle stealing can be done only at specific break points in an instruction cycle.

13.What is meant by arm-stickiness?
If one or a few processes have a high access rate to data on one track of a storage disk, then they may monopolize the device by repeated requests to that track. This generally happens with most common device scheduling algorithms (LIFO, SSTF, C-SCAN, etc). High-density multisurface disks are more likely to be affected by this than low density ones.

14.What are the stipulations of C2 level security?
C2 level security provides for:
 Discretionary Access Control
 Identification and Authentication
 Auditing
 Resource reuse

15.What is busy waiting?
The repeated execution of a loop of code while waiting for an event to occur is called busy-waiting. The CPU is not engaged in any real productive activity during this period, and the process does not progress toward completion.

16.Explain the popular multiprocessor thread-scheduling strategies.
 Load Sharing: Processes are not assigned to a particular processor. A global queue of threads is maintained. Each processor, when idle, selects a thread from this queue. Note that load balancing refers to a scheme where work is allocated to processors on a more permanent basis.
 Gang Scheduling: A set of related threads is scheduled to run on a set of processors at the same time, on a 1-to-1 basis. Closely related threads / processes may be scheduled this way to reduce synchronization blocking, and minimize process switching. Group scheduling predated this strategy.
 Dedicated processor assignment: Provides implicit scheduling defined by assignment of threads to processors. For the duration of program execution, each program is allocated a set of processors equal in number to the number of threads in the program. Processors are chosen from the available pool.
 Dynamic scheduling: The number of thread in a program can be altered during the course of execution.

17.When does the condition 'rendezvous' arise?
In message passing, it is the condition in which, both, the sender and receiver are blocked until the message is delivered.

18.What is a trap and trapdoor?
Trapdoor is a secret undocumented entry point into a program used to grant access without normal methods of access authentication. A trap is a software interrupt, usually the result of an error condition.

19.What are local and global page replacements?
Local replacement means that an incoming page is brought in only to the relevant process' address space. Global replacement policy allows any page frame from any process to be replaced. The latter is applicable to variable partitions model only.

20.Define latency, transfer and seek time with respect to disk I/O.
Seek time is the time required to move the disk arm to the required track. Rotational delay or latency is the time it takes for the beginning of the required sector to reach the head. Sum of seek time (if any) and latency is the access time. Time taken to actually transfer a span of data is transfer time.

21.Describe the Buddy system of memory allocation.
Free memory is maintained in linked lists, each of equal sized blocks. Any such block is of size 2^k. When some memory is required by a process, the block size of next higher order is chosen, and broken into two. Note that the two such pieces differ in address only in their kth bit. Such pieces are called buddies. When any used block is freed, the OS checks to see if its buddy is also free. If so, it is rejoined, and put into the original free-block linked-list.

22.What is time-stamping?
It is a technique proposed by Lamport, used to order events in a distributed system without the use of clocks. This scheme is intended to order events consisting of the transmission of messages. Each system 'i' in the network maintains a counter Ci. Every time a system transmits a message, it increments its counter by 1 and attaches the time-stamp Ti to the message. When a message is received, the receiving system 'j' sets its counter Cj to 1 more than the maximum of its current value and the incoming time-stamp Ti. At each site, the ordering of messages is determined by the following rules: For messages x from site i and y from site j, x precedes y if one of the following conditions holds....(a) if Ti
23.How are the wait/signal operations for monitor different from those for semaphores?
If a process in a monitor signal and no task is waiting on the condition variable, the signal is lost. So this allows easier program design. Whereas in semaphores, every operation affects the value of the semaphore, so the wait and signal operations should be perfectly balanced in the program.


24.In the context of memory management, what are placement and replacement algorithms?
Placement algorithms determine where in available real-memory to load a program. Common methods are first-fit, next-fit, best-fit. Replacement algorithms are used when memory is full, and one process (or part of a process) needs to be swapped out to accommodate a new program. The replacement algorithm determines which are the partitions to be swapped out.

25.In loading programs into memory, what is the difference between load-time dynamic linking and run-time dynamic linking?
For load-time dynamic linking: Load module to be loaded is read into memory. Any reference to a target external module causes that module to be loaded and the references are updated to a relative address from the start base address of the application module.
With run-time dynamic loading: Some of the linking is postponed until actual reference during execution. Then the correct module is loaded and linked.

26.What are demand- and pre-paging?
With demand paging, a page is brought into memory only when a location on that page is actually referenced during execution. With pre-paging, pages other than the one demanded by a page fault are brought in. The selection of such pages is done based on common access patterns, especially for secondary memory devices.

27.Paging a memory management function, while multiprogramming a processor management function, are the two interdependent?
Yes.

28.What is page cannibalizing?
Page swapping or page replacements are called page cannibalizing.

29.What has triggered the need for multitasking in PCs?
 Increased speed and memory capacity of microprocessors together with the support fir virtual memory and
 Growth of client server computing

30.What are the four layers that Windows NT have in order to achieve independence?
 Hardware abstraction layer
 Kernel
 Subsystems
 System Services.

31.What is SMP?
To achieve maximum efficiency and reliability a mode of operation known as symmetric multiprocessing is used. In essence, with SMP any process or threads can be assigned to any processor.

32.What are the key object oriented concepts used by Windows NT?
 Encapsulation
 Object class and instance

33.Is Windows NT a full blown object oriented operating system? Give reasons.
No Windows NT is not so, because its not implemented in object oriented language and the data structures reside within one executive component and are not represented as objects and it does not support object oriented capabilities .

34.What is a drawback of MVT?
It does not have the features like
 ability to support multiple processors
 virtual storage
 source level debugging

35.What is process spawning?
When the OS at the explicit request of another process creates a process, this action is called process spawning.

36.How many jobs can be run concurrently on MVT?
15 jobs

37.List out some reasons for process termination.
 Normal completion
 Time limit exceeded
 Memory unavailable
 Bounds violation
 Protection error
 Arithmetic error
 Time overrun
 I/O failure
 Invalid instruction
 Privileged instruction
 Data misuse
 Operator or OS intervention
 Parent termination.

38.What are the reasons for process suspension?
 swapping
 interactive user request
 timing
 parent process request

39.What is process migration?
It is the transfer of sufficient amount of the state of process from one machine to the target machine

40.what is mutant?
In Windows NT a mutant provides kernel mode or user mode mutual exclusion with the notion of ownership.

41.What is an idle thread?
The special thread a dispatcher will execute when no ready thread is found.

42.What is FtDisk?
It is a fault tolerance disk driver for Windows NT.

43.What are the possible threads a thread can have?
 Ready
 Standby
 Running
 Waiting
 Transition
 Terminated.

44.What are rings in Windows NT?
Windows NT uses protection mechanism called rings provides by the process to implement separation between the user mode and kernel mode.

45.What is Executive in Windows NT?
In Windows NT, executive refers to the operating system code that runs in kernel mode.

46.What are the sub-components of I/O manager in Windows NT?
 Network redirector/ Server
 Cache manager.
 File systems
 Network driver
 Device driver

47.What are DDks? Name an operating system that includes this feature.
DDks are device driver kits, which are equivalent to SDKs for writing device drivers. Windows NT includes DDks.

48.What level of security does Windows NT meets?
C2 level security.



C Aptitude Questions

C Questions

Note : All the programs are tested under Turbo C/C++ compilers.
It is assumed that,
 Programs run under DOS environment,
 The underlying machine is an x86 system,
 Program is compiled using Turbo C/C++ compiler.
The program output may depend on the information based on this assumptions (for example sizeof(int) == 2 may be assumed).

Predict the output or error(s) for the following:

1. void main()
{
int const * p=5;
printf("%d",++(*p));
}
Answer:
Compiler error: Cannot modify a constant value.
Explanation:
p is a pointer to a "constant integer". But we tried to change the value of the "constant integer".

2. main()
{
char s[ ]="man";
int i;
for(i=0;s[ i ];i++)
printf("\n%c%c%c%c",s[ i ],*(s+i),*(i+s),i[s]);
}
Answer:
mmmm
aaaa
nnnn
Explanation:
s[i], *(i+s), *(s+i), i[s] are all different ways of expressing the same idea. Generally array name is the base address for that array. Here s is the base address. i is the index number/displacement from the base address. So, indirecting it with * is same as s[i]. i[s] may be surprising. But in the case of C it is same as s[i].

3. main()
{
float me = 1.1;
double you = 1.1;
if(me==you)
printf("I love U");
else
printf("I hate U");
}
Answer:
I hate U
Explanation:
For floating point numbers (float, double, long double) the values cannot be predicted exactly. Depending on the number of bytes, the precession with of the value represented varies. Float takes 4 bytes and long double takes 10 bytes. So float stores 0.9 with less precision than long double.
Rule of Thumb:
Never compare or at-least be cautious when using floating point numbers with relational operators (== , >, <, <=, >=,!= ) .

4. main()
{
static int var = 5;
printf("%d ",var--);
if(var)
main();
}
Answer:
5 4 3 2 1
Explanation:
When static storage class is given, it is initialized once. The change in the value of a static variable is retained even between the function calls. Main is also treated like any other ordinary function, which can be called recursively.

5. main()
{
int c[ ]={2.8,3.4,4,6.7,5};
int j,*p=c,*q=c;
for(j=0;j<5;j++) {
printf(" %d ",*c);
++q; }
for(j=0;j<5;j++){
printf(" %d ",*p);
++p; }
}

Answer:
2 2 2 2 2 2 3 4 6 5
Explanation:
Initially pointer c is assigned to both p and q. In the first loop, since only q is incremented and not c , the value 2 will be printed 5 times. In second loop p itself is incremented. So the values 2 3 4 6 5 will be printed.

6. main()
{
extern int i;
i=20;
printf("%d",i);
}

Answer:
Linker Error : Undefined symbol '_i'
Explanation:
extern storage class in the following declaration,
extern int i;
specifies to the compiler that the memory for i is allocated in some other program and that address will be given to the current program at the time of linking. But linker finds that no other variable of name i is available in any other program with memory space allocated for it. Hence a linker error has occurred .

7. main()
{
int i=-1,j=-1,k=0,l=2,m;
m=i++&&j++&&k++||l++;
printf("%d %d %d %d %d",i,j,k,l,m);
}
Answer:
0 0 1 3 1
Explanation :
Logical operations always give a result of 1 or 0 . And also the logical AND (&&) operator has higher priority over the logical OR (||) operator. So the expression ‘i++ && j++ && k++’ is executed first. The result of this expression is 0 (-1 && -1 && 0 = 0). Now the expression is 0 || 2 which evaluates to 1 (because OR operator always gives 1 except for ‘0 || 0’ combination- for which it gives 0). So the value of m is 1. The values of other variables are also incremented by 1.

8. main()
{
char *p;
printf("%d %d ",sizeof(*p),sizeof(p));
}

Answer:
1 2
Explanation:
The sizeof() operator gives the number of bytes taken by its operand. P is a character pointer, which needs one byte for storing its value (a character). Hence sizeof(*p) gives a value of 1. Since it needs two bytes to store the address of the character pointer sizeof(p) gives 2.

9. main()
{
int i=3;
switch(i)
{
default:printf("zero");
case 1: printf("one");
break;
case 2:printf("two");
break;
case 3: printf("three");
break;
}
}
Answer :
three
Explanation :
The default case can be placed anywhere inside the loop. It is executed only when all other cases doesn't match.

10. main()
{
printf("%x",-1<<4);
}
Answer:
fff0
Explanation :
-1 is internally represented as all 1's. When left shifted four times the least significant 4 bits are filled with 0's.The %x format specifier specifies that the integer value be printed as a hexadecimal value.

11. main()
{
char string[]="Hello World";
display(string);
}
void display(char *string)
{
printf("%s",string);
}
Answer:
Compiler Error : Type mismatch in redeclaration of function display
Explanation :
In third line, when the function display is encountered, the compiler doesn't know anything about the function display. It assumes the arguments and return types to be integers, (which is the default type). When it sees the actual function display, the arguments and type contradicts with what it has assumed previously. Hence a compile time error occurs.

12. main()
{
int c=- -2;
printf("c=%d",c);
}
Answer:
c=2;
Explanation:
Here unary minus (or negation) operator is used twice. Same maths rules applies, ie. minus * minus= plus.
Note:
However you cannot give like --2. Because -- operator can only be applied to variables as a decrement operator (eg., i--). 2 is a constant and not a variable.

13. #define int char
main()
{
int i=65;
printf("sizeof(i)=%d",sizeof(i));
}
Answer:
sizeof(i)=1
Explanation:
Since the #define replaces the string int by the macro char

14. main()
{
int i=10;
i=!i>14;
Printf ("i=%d",i);
}
Answer:
i=0


Explanation:
In the expression !i>14 , NOT (!) operator has more precedence than ‘ >’ symbol. ! is a unary logical operator. !i (!10) is 0 (not of true is false). 0>14 is false (zero).

15. #include
main()
{
char s[]={'a','b','c','\n','c','\0'};
char *p,*str,*str1;
p=&s[3];
str=p;
str1=s;
printf("%d",++*p + ++*str1-32);
}
Answer:
77
Explanation:
p is pointing to character '\n'. str1 is pointing to character 'a' ++*p. "p is pointing to '\n' and that is incremented by one." the ASCII value of '\n' is 10, which is then incremented to 11. The value of ++*p is 11. ++*str1, str1 is pointing to 'a' that is incremented by 1 and it becomes 'b'. ASCII value of 'b' is 98.
Now performing (11 + 98 – 32), we get 77("M");
So we get the output 77 :: "M" (Ascii is 77).

16. #include
main()
{
int a[2][2][2] = { {10,2,3,4}, {5,6,7,8} };
int *p,*q;
p=&a[2][2][2];
*q=***a;
printf("%d----%d",*p,*q);
}
Answer:
SomeGarbageValue---1
Explanation:
p=&a[2][2][2] you declare only two 2D arrays, but you are trying to access the third 2D(which you are not declared) it will print garbage values. *q=***a starting address of a is assigned integer pointer. Now q is pointing to starting address of a. If you print *q, it will print first element of 3D array.

17. #include
main()
{
struct xx
{
int x=3;
char name[]="hello";
};
struct xx *s;
printf("%d",s->x);
printf("%s",s->name);
}
Answer:
Compiler Error
Explanation:
You should not initialize variables in declaration

18. #include
main()
{
struct xx
{
int x;
struct yy
{
char s;
struct xx *p;
};
struct yy *q;
};
}
Answer:
Compiler Error
Explanation:
The structure yy is nested within structure xx. Hence, the elements are of yy are to be accessed through the instance of structure xx, which needs an instance of yy to be known. If the instance is created after defining the structure the compiler will not know about the instance relative to xx. Hence for nested structure yy you have to declare member.

19. main()
{
printf("\nab");
printf("\bsi");
printf("\rha");
}
Answer:
hai
Explanation:
\n - newline
\b - backspace
\r - linefeed

20. main()
{
int i=5;
printf("%d%d%d%d%d%d",i++,i--,++i,--i,i);
}
Answer:
45545
Explanation:
The arguments in a function call are pushed into the stack from left to right. The evaluation is by popping out from the stack. and the evaluation is from right to left, hence the result.

21. #define square(x) x*x
main()
{
int i;
i = 64/square(4);
printf("%d",i);
}
Answer:
64
Explanation:
the macro call square(4) will substituted by 4*4 so the expression becomes i = 64/4*4 . Since / and * has equal priority the expression will be evaluated as (64/4)*4 i.e. 16*4 = 64

22. main()
{
char *p="hai friends",*p1;
p1=p;
while(*p!='\0') ++*p++;
printf("%s %s",p,p1);
}
Answer:
ibj!gsjfoet
Explanation:
++*p++ will be parse in the given order
 *p that is value at the location currently pointed by p will be taken
 ++*p the retrieved value will be incremented
 when ; is encountered the location will be incremented that is p++ will be executed
Hence, in the while loop initial value pointed by p is ‘h’, which is changed to ‘i’ by executing ++*p and pointer moves to point, ‘a’ which is similarly changed to ‘b’ and so on. Similarly blank space is converted to ‘!’. Thus, we obtain value in p becomes “ibj!gsjfoet” and since p reaches ‘\0’ and p1 points to p thus p1doesnot print anything.

23. #include
#define a 10
main()
{
#define a 50
printf("%d",a);
}
Answer:
50
Explanation:
The preprocessor directives can be redefined anywhere in the program. So the most recently assigned value will be taken.

24. #define clrscr() 100
main()
{
clrscr();
printf("%d\n",clrscr());
}
Answer:
100
Explanation:
Preprocessor executes as a seperate pass before the execution of the compiler. So textual replacement of clrscr() to 100 occurs.The input program to compiler looks like this :
main()
{
100;
printf("%d\n",100);
}
Note:
100; is an executable statement but with no action. So it doesn't give any problem

25. main()
{
printf("%p",main);
}
Answer:
Some address will be printed.
Explanation:
Function names are just addresses (just like array names are addresses).
main() is also a function. So the address of function main will be printed. %p in printf specifies that the argument is an address. They are printed as hexadecimal numbers.

27) main()
{
clrscr();
}
clrscr();

Answer:
No output/error
Explanation:
The first clrscr() occurs inside a function. So it becomes a function call. In the second clrscr(); is a function declaration (because it is not inside any function).

28) enum colors {BLACK,BLUE,GREEN}
main()
{

printf("%d..%d..%d",BLACK,BLUE,GREEN);

return(1);
}
Answer:
0..1..2
Explanation:
enum assigns numbers starting from 0, if not explicitly defined.

29) void main()
{
char far *farther,*farthest;

printf("%d..%d",sizeof(farther),sizeof(farthest));

}
Answer:
4..2
Explanation:
the second pointer is of char type and not a far pointer

30) main()
{
int i=400,j=300;
printf("%d..%d");
}
Answer:
400..300
Explanation:
printf takes the values of the first two assignments of the program. Any number of printf's may be given. All of them take only the first two values. If more number of assignments given in the program,then printf will take garbage values.

31) main()
{
char *p;
p="Hello";
printf("%c\n",*&*p);
}
Answer:
H
Explanation:
* is a dereference operator & is a reference operator. They can be applied any number of times provided it is meaningful. Here p points to the first character in the string "Hello". *p dereferences it and so its value is H. Again & references it to an address and * dereferences it to the value H.

32) main()
{
int i=1;
while (i<=5)
{
printf("%d",i);
if (i>2)
goto here;
i++;
}
}
fun()
{
here:
printf("PP");
}
Answer:
Compiler error: Undefined label 'here' in function main
Explanation:
Labels have functions scope, in other words The scope of the labels is limited to functions . The label 'here' is available in function fun() Hence it is not visible in function main.

33) main()
{
static char names[5][20]={"pascal","ada","cobol","fortran","perl"};
int i;
char *t;
t=names[3];
names[3]=names[4];
names[4]=t;
for (i=0;i<=4;i++)
printf("%s",names[i]);
}
Answer:
Compiler error: Lvalue required in function main
Explanation:
Array names are pointer constants. So it cannot be modified.

34) void main()
{
int i=5;
printf("%d",i++ + ++i);
}
Answer:
Output Cannot be predicted exactly.
Explanation:
Side effects are involved in the evaluation of i

35) void main()
{
int i=5;
printf("%d",i+++++i);
}
Answer:
Compiler Error
Explanation:
The expression i+++++i is parsed as i ++ ++ + i which is an illegal combination of operators.

36) #include
main()
{
int i=1,j=2;
switch(i)
{
case 1: printf("GOOD");
break;
case j: printf("BAD");
break;
}
}
Answer:
Compiler Error: Constant expression required in function main.
Explanation:
The case statement can have only constant expressions (this implies that we cannot use variable names directly so an error).
Note:
Enumerated types can be used in case statements.

37) main()
{
int i;
printf("%d",scanf("%d",&i)); // value 10 is given as input here
}
Answer:
1
Explanation:
Scanf returns number of items successfully read and not 1/0. Here 10 is given as input which should have been scanned successfully. So number of items read is 1.

38) #define f(g,g2) g##g2
main()
{
int var12=100;
printf("%d",f(var,12));
}
Answer:
100

39) main()
{
int i=0;

for(;i++;printf("%d",i)) ;
printf("%d",i);
}
Answer:
1
Explanation:
before entering into the for loop the checking condition is "evaluated". Here it evaluates to 0 (false) and comes out of the loop, and i is incremented (note the semicolon after the for loop).

40) #include
main()
{
char s[]={'a','b','c','\n','c','\0'};
char *p,*str,*str1;
p=&s[3];
str=p;
str1=s;
printf("%d",++*p + ++*str1-32);
}
Answer:
M
Explanation:
p is pointing to character '\n'.str1 is pointing to character 'a' ++*p meAnswer:"p is pointing to '\n' and that is incremented by one." the ASCII value of '\n' is 10. then it is incremented to 11. the value of ++*p is 11. ++*str1 meAnswer:"str1 is pointing to 'a' that is incremented by 1 and it becomes 'b'. ASCII value of 'b' is 98. both 11 and 98 is added and result is subtracted from 32.
i.e. (11+98-32)=77("M");

41) #include
main()
{
struct xx
{
int x=3;
char name[]="hello";
};
struct xx *s=malloc(sizeof(struct xx));
printf("%d",s->x);
printf("%s",s->name);
}
Answer:
Compiler Error
Explanation:
Initialization should not be done for structure members inside the structure declaration

42) #include
main()
{
struct xx
{
int x;
struct yy
{
char s;
struct xx *p;
};
struct yy *q;
};
}
Answer:
Compiler Error
Explanation:
in the end of nested structure yy a member have to be declared.

43) main()
{
extern int i;
i=20;
printf("%d",sizeof(i));
}
Answer:
Linker error: undefined symbol '_i'.
Explanation:
extern declaration specifies that the variable i is defined somewhere else. The compiler passes the external variable to be resolved by the linker. So compiler doesn't find an error. During linking the linker searches for the definition of i. Since it is not found the linker flags an error.

44) main()
{
printf("%d", out);
}
int out=100;
Answer:
Compiler error: undefined symbol out in function main.
Explanation:
The rule is that a variable is available for use from the point of declaration. Even though a is a global variable, it is not available for main. Hence an error.

45) main()
{
extern out;
printf("%d", out);
}
int out=100;
Answer:
100
Explanation:
This is the correct way of writing the previous program.

46) main()
{
show();
}
void show()
{
printf("I'm the greatest");
}
Answer:
Compier error: Type mismatch in redeclaration of show.
Explanation:
When the compiler sees the function show it doesn't know anything about it. So the default return type (ie, int) is assumed. But when compiler sees the actual definition of show mismatch occurs since it is declared as void. Hence the error.
The solutions are as follows:
1. declare void show() in main() .
2. define show() before main().
3. declare extern void show() before the use of show().

47) main( )
{
int a[2][3][2] = {{{2,4},{7,8},{3,4}},{{2,2},{2,3},{3,4}}};
printf(“%u %u %u %d \n”,a,*a,**a,***a);
printf(“%u %u %u %d \n”,a+1,*a+1,**a+1,***a+1);
}
Answer:
100, 100, 100, 2
114, 104, 102, 3
Explanation:
The given array is a 3-D one. It can also be viewed as a 1-D array.

2 4 7 8 3 4 2 2 2 3 3 4
100 102 104 106 108 110 112 114 116 118 120 122

thus, for the first printf statement a, *a, **a give address of first element . since the indirection ***a gives the value. Hence, the first line of the output.
for the second printf a+1 increases in the third dimension thus points to value at 114, *a+1 increments in second dimension thus points to 104, **a +1 increments the first dimension thus points to 102 and ***a+1 first gets the value at first location and then increments it by 1. Hence, the output.

48) main( )
{
int a[ ] = {10,20,30,40,50},j,*p;
for(j=0; j<5; j++)
{
printf(“%d” ,*a);
a++;
}
p = a;
for(j=0; j<5; j++)
{
printf(“%d ” ,*p);
p++;
}
}
Answer:
Compiler error: lvalue required.

Explanation:
Error is in line with statement a++. The operand must be an lvalue and may be of any of scalar type for the any operator, array name only when subscripted is an lvalue. Simply array name is a non-modifiable lvalue.

49) main( )
{
static int a[ ] = {0,1,2,3,4};
int *p[ ] = {a,a+1,a+2,a+3,a+4};
int **ptr = p;
ptr++;
printf(“\n %d %d %d”, ptr-p, *ptr-a, **ptr);
*ptr++;
printf(“\n %d %d %d”, ptr-p, *ptr-a, **ptr);
*++ptr;
printf(“\n %d %d %d”, ptr-p, *ptr-a, **ptr);
++*ptr;
printf(“\n %d %d %d”, ptr-p, *ptr-a, **ptr);
}
Answer:
111
222
333
344
Explanation:
Let us consider the array and the two pointers with some address
a
0 1 2 3 4
100 102 104 106 108
p
100 102 104 106 108
1000 1002 1004 1006 1008
ptr
1000
2000
After execution of the instruction ptr++ value in ptr becomes 1002, if scaling factor for integer is 2 bytes. Now ptr – p is value in ptr – starting location of array p, (1002 – 1000) / (scaling factor) = 1, *ptr – a = value at address pointed by ptr – starting value of array a, 1002 has a value 102 so the value is (102 – 100)/(scaling factor) = 1, **ptr is the value stored in the location pointed by the pointer of ptr = value pointed by value pointed by 1002 = value pointed by 102 = 1. Hence the output of the firs printf is 1, 1, 1.
After execution of *ptr++ increments value of the value in ptr by scaling factor, so it becomes1004. Hence, the outputs for the second printf are ptr – p = 2, *ptr – a = 2, **ptr = 2.
After execution of *++ptr increments value of the value in ptr by scaling factor, so it becomes1004. Hence, the outputs for the third printf are ptr – p = 3, *ptr – a = 3, **ptr = 3.
After execution of ++*ptr value in ptr remains the same, the value pointed by the value is incremented by the scaling factor. So the value in array p at location 1006 changes from 106 10 108,. Hence, the outputs for the fourth printf are ptr – p = 1006 – 1000 = 3, *ptr – a = 108 – 100 = 4, **ptr = 4.

50) main( )
{
char *q;
int j;
for (j=0; j<3; j++) scanf(“%s” ,(q+j));
for (j=0; j<3; j++) printf(“%c” ,*(q+j));
for (j=0; j<3; j++) printf(“%s” ,(q+j));
}
Explanation:
Here we have only one pointer to type char and since we take input in the same pointer thus we keep writing over in the same location, each time shifting the pointer value by 1. Suppose the inputs are MOUSE, TRACK and VIRTUAL. Then for the first input suppose the pointer starts at location 100 then the input one is stored as
M O U S E \0
When the second input is given the pointer is incremented as j value becomes 1, so the input is filled in memory starting from 101.
M T R A C K \0
The third input starts filling from the location 102
M T V I R T U A L \0
This is the final value stored .
The first printf prints the values at the position q, q+1 and q+2 = M T V
The second printf prints three strings starting from locations q, q+1, q+2
i.e MTVIRTUAL, TVIRTUAL and VIRTUAL.