Saturday 31 December 2011

What is an instruction set?


  • The complete collection of instructions that are understood by a CPU

  • Machine Code

  • Binary

  • Usually represented by assembly codes


Elements of an Instruction



  • Operation code (Op code)

  • Source Operand reference

  • Result Operand reference

  • Next Instruction Reference


Instruction Cycle State Diagram



Instruction Representation



  • In machine code each instruction has a unique bit pattern

Friday 30 December 2011

Polymorphism in Java

Polymorphism means "any forms." In object-oriented programming, it refers to the capability of objects to react differently to the same method. Polymorphism can be implemented in the Java language in the form of multiple methods having the same name. Java code uses a late-binding technique to support polymorphism; the method to be invoked is decided at runtime.

Overloaded methods are methods that have the same name, but different argument lists. Overriding, on the other hand, occurs when a subclass method has the same name, same return type, and same argument list as the superclass method.

Overloading


As we mentioned, it is mandatory for overloaded methods to have the same names but different argument lists. The arguments may differ

APPSC Group-2 Previous Questions - 2

21. The local name of Mohenjodaro is

1. Mound of the Great                2. Mound of the living


3. Mound of the Survivor          4. Mound of the Dead


22. Name the ruler of the Kushan dynasty.

1. Kadphises I                          2. Ugrasena


3. Vikramaditya                          4. Pushyamitra


23. The title 'Vikramaditya' was assumed by

1. Ashoka                                      2. Kanishka


3. Samudragupta                        4. Chandragupta II


24. The great granary of the Harappan civilisation has been found at

1. Ropar           2. Harappa           3. Kalibangan        4. Mohenjodaro


25. When did Alexander invade India ?

Why Yoga ?

Yoga is a way of life and enables us to have multidimensional approach to life. The human body is not the aim of yoga but is considered means of going beyond physical form of body. Unbalanced state of cause and effect result in ill health. Equilibrium of two is the basic aim of Yoga. A healthy body, therefore may be called as the foundation of Yoga.

Yoga is both an art and science. It can alone save the modern man from personal determination and circumstantial frustration. In other words the practice of 'Yoga' postulates keeping the body healthy and the mind calm and peaceful. Health is our birth-right, and to remain healthy, it is not necessary to depend upon any health centre, physician or medication. It is entirely in our hands to keep healthy. However, in the present-day conditions keeping good health is

Thursday 29 December 2011

Performance of Sorting or Searching

One of the chief concerns in searching and sorting is speed. Often, this concern is misguided, because the sort or search takes negligible time compared to the rest of the program. For most sorting and searching applications, you should use the easiest method available . If you later find that the program is too slow because of the searching or sorting algorithm used, you can substitute another method easily. By starting with a simple method, you haven’t invested much time and effort on code that has to be replaced.

One measure of the speed of a sorting or searching algorithm is the number of operations that must be performed in the best, average,

APPSC Group-1 Prelims Previous Questions

1. The hill ranges between Narmada and Tapti rivers are

1. Aravalli          2. Vindhya          3. Kalmur           4. Satpura


2. The Land of Thousand lakes is in

1. England          2. Finland        3. Canada           4. Korea


3. The violent and destructive tropical cyclones in China and Japan are known as

1. Hurricanes    2. Tornadoes        3. Typhoons    4. Willy-willies


4. 'Stalagmites and Stalactites' are the landforms formed due to

1. Wind              2. Glaciers              3. Rivers           4. Ground water


5. Jurala Project is situated in the district of

Wednesday 28 December 2011

Frequently Asked Questions in Technical Round at MNCs like TCS, WIPRO, INFOSYS,..etc

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


1)

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:

Tuesday 27 December 2011

DotNet Frequently Asked Questions on Threading

What does AddressOf operator do in background ?


The AddressOf operator creates a delegate object to the BackgroundProcess method. A delegate within VB.NET is a type-safe, object-oriented function pointer. After the thread has been instantiated, you begin the execution of the code by calling the Start() method of the thread.

How can you reference current thread of the method ?


"Thread.CurrentThread" refers to the current thread running in the method."CurrentThread" is a public static property.

What's Thread.Sleep() in threading ?


Thread's execution can be paused by calling the Thread.Sleep

Civil Services Preliminary Previous Questions

1. In the 'Individual Satyagraha', Vinoba Bhave was chosen as the first Satyagrahi. Who was the second ?

1. Dr. Rajendra Prasad
2. Pandit Jawaharlal Nehru
3. C. Rajagopalachari
4. Sardar Vallabhai Patel


2. Consider the following statements:

The Cripps Proposals include the provision for
a. Full independence for India.
b. Creation of Constitution-making body.


Which of the statements given above is / are correct ?

1. a only        2. b only        3. Both a and b        4. Neither a nor b


3. During the freedom struggle, Aruna Asaf Ali was a major woman organizer of underground activity in

1. Civil Disobedience Movement
2. Non-Cooperation Movement
3. Quit India Movement
4. Swadeshi Movement


4. With whose permission did the English set up their first factory in Surat ?

1. Akbar        2. Jahangir         3. Shahjahan          4. Aurangzeb


5. In a dry cell (battery), which of the following are used as elecrolytes ?

Monday 26 December 2011

APPSC Group-2 Previous Questions

1. The first India-Russsia-China trilateral business conference was held in

1. New Delhi         2. Moscow        3. Beijing        4. Guwahati


2. Ban Ki-Moon took over as United Nations Secretary-General on

1. July 1 ,2006      2. January 1, 2007      3. July 1, 2008       4. January 1,2008


3. India's Communications satellite INSAT-4B was launched from

1. Thumba        2. Biakonur       3. Sriharikota       4. French Guiana


4.The Central Salt and Marine Chemicals Research Institute is situated in

1. West Bengal    2. Orissa          3. Gujarat         4. Andhra Pradesh


5. The institute produced by the Uruguay Round of talks is

Floating point representation

The floating point representation of a number has two parts. The first parts represent a signed, fixed- point number called the mantissa. The second part designates the position of the decimal point and is called the exponent. The fixed-point mantissa may be a fraction or an integer. For example, the decimal number +6132.789 is represented in floating-point with a fraction and an exponent as follows:

Fraction                 Exponent


+0.6132789          +04


This representation is equivalent to the scientific notation +0.6132789*10^+4.

Floating –point is always interpreted to represent a number in the following form:

M*r ^e


Only the mantissa m and the exponent e are physically represented in

Sunday 25 December 2011

Encapsulation in Java

Encapsulation is the concept of hiding the implementation details of a class and allowing access to the class through a public interface. For this, we need to declare the instance variables of the class as private or protected. The client code should access only the public methods rather than accessing the data directly. Also, the methods should follow the Java Bean's naming convention of set and get.

Encapsulation makes it easy to maintain and modify code. The client code is not affected when the internal implementation of the code

APPSC Group-1 General Studies Previous Questions

1. The Supreme Court of Bengal was constituted by the Crown in the year

1. 1776         2. 1777          3. 1774           4. 1775


2. In which year did Gandhiji come actively on the political scene ?

1. 1916         2. 1919          3. 1930          4. 1932


3. The 'Sri Bagh Pact' (Sri Bagh Agreement) concluded on 16th November 1937 was between

1. Andhra - Rayalaseema - Telangana


2. Andhra - Telangana


3. Andhra - Hyderabad


4. Andhra - Rayalaseema


4. The Rampa rebellion happened during

1. 1922 - 1924        2. 1919 - 1920        3. 1921 -1922        4. 1925 - 1926


5. The Provincial Governments were given more powers under the system of Dyarchy by

Saturday 24 December 2011

Searching - Brief Idea

Searching algorithms have been studied nearly as much as sorting algorithms. The two are related in that many searching algorithms rely on the ordering of the data being searched. There are four basic kinds of searching algorithms:

  • Sequential searching

  • Comparison searching

  • Radix searching

  • Hashing


Each of these methods can be described using the same deck of cards example that was used for sorting.

In sequential searching, you go through the deck from top to bottom, looking at each card until you find the card you are looking for.

In comparison searching (also called binary searching), you start with

Friday 23 December 2011

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

1)

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.

2)

main()

{

clrscr();


}

clrscr();

Answer:

No output/error


Explanation:

Thursday 22 December 2011

Threading in DotNet

What is Multi-tasking ?


It’s a feature of modern operating systems with which we can run multiple programs at same time example Word, Excel etc.

What is Multi-threading ?


Multi-threading forms subset of Multi-tasking. Instead of having to switch between programs this feature switches between different parts of the same program. Example you are writing in word and at the same time word is doing a spell check in background.

What is a Thread ?


A thread is the basic unit to which the operating system allocates processor time.

Did VB support multi-threading ?


While VB supports multiple single-threaded apartments, it does not support a freethreading model, which allows multiple threads to run against the same set of data.

Can we have multiple threads in one App domain ?


One or more threads run in an AppDomain. An AppDomain is a

Wednesday 21 December 2011

Arithmetic & Logic Unit


  • Does the calculations

  • Everything else in the computer is there to service this unit

  • Handles integers

  • May handle floating point (real) numbers

  • May be separate FPU (maths co-processor)

  • May be on chip separate FPU (486DX +)


ALU Inputs and Outputs



Integer Representation



  • Only have 0 & 1 to represent everything

  • Positive numbers stored in binary


—   e.g. 41=00101001




  • No minus sign

  • No period

  • Sign-Magnitude

  • Two’s compliment


Sign-Magnitude

Tuesday 20 December 2011

What will be the result of compiling and running the following code fragment?

Integer i= new Integer("10");

if (i.toString() == i.toString())

System.out.println("Equal");


else

System.out.println("Not Equal");


Choices:

A. Compiler error
B. Prints "Equal"
C. Prints "Not Equal"
D. None of the above


Correct choice:

  • C


Explanation:

Monday 19 December 2011

Brief idea about Sorting

Five basic kinds of sorting algorithms are available to the programmer:

  • Insertion sorts

  • Exchange sorts

  • Selection sorts

  • Merge sorts

  • Distribution sorts


An easy way to visualize how each sorting algorithm works is to think about how to sort a shuffled deck of cards lying on the table using each method. The cards are to be sorted by suit (clubs, diamonds, hearts, and spades) as well as by rank (2 through ace). You might have seen some of these algorithms in action at your last bridge game.

In an insertion sort, you pick up the cards one at a time, starting with the top card in the pile, and insert them into the correct position in

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

1)

#include <stdio.h>

#define a 10

main()

{

#define a 50


printf("%d",a);


}

Answer:

50


Explanation:

Saturday 17 December 2011

What are types of compatibility in VB?

There are three possible project compatibility settings:

  • No Compatibility

  • Project Compatibility

  • Binary Compatibility


No Compatibility


With this setting, new class ID’s, new interface ID’s and a new type library ID will be generated by VB each time the ActiveX component project is compiled. This will cause any compiled client components to fail (with error 429!) and report a missing reference to the 'VB ActiveX Test Component' when a client project is loaded in the VB IDE.

Note :- Use this setting to compile the initial release of a component to other developers.



Project Compatibility


With this setting, VB will generate new interface ID’s for classes

Friday 2 December 2011

Is it acceptable to declare/define a variable in a C header?

A global variable that must be accessed from more than one file can and should be declared in a header file. In addition, such a variable must be defined in one source file. Variables should not be defined in header files, because the header file can be included in multiple source files, which would cause multiple definitions of the variable. The ANSI C standard will allow multiple external definitions, provided that there is only one initialization. But because there’s really no advantage to using this feature, it’s probably best to avoid it and maintain a higher level of portability.

“Global” variables that do not have to be accessed from more than

Thursday 1 December 2011

The equals() method

We can use the == operator to compare the values of primitive variables and determine if they are equal. However, if object reference variables are compared using the == operator, it returns true only if the reference variables are referring to the same object. To check for the equality of two objects, the Object class provides the equals(Object obj) method, which can be overridden to return true for logically equal objects. The default implementation of the equals() method in the Object class returns true only if an object is