Google Search

Wednesday, March 2, 2016

What do you mean by self complementing code?

A self-complementing code is one in which the 9's complement is formed by taking the 1's complement. For instance, the 9's complement of 6 is 3 and the 9's complement of 1 is 8.
If we consider Excess 3:
0 0011 
1 0100
2 0101
3 0110
4 0111
5 1000
6 1001
7 1010
8 1011
9 1100
Then thinking about 6 and 3 we see the XS3 codes are: 1001 and 0110 which are the 1's complement of each other. Considering 1 and 8, the XS3 codes are 0100 and 1011 - again 1's complements. There are several self-complementing codes. There is one where instead of the usual binary weights of 8, 4, 2 and 1 you can use 2, 4, 2, and 1.

Why DDA algorithm ?

DDA Algorithm is used to plot line between two nodes i.e two end points in computer system.
While our computer understand pixels, if we want to plot a line, we should have maximum intermediate vertices of the line i.e intermediate points, so as to generate a straight line. Here DDA does the same.
c program for dda algorithm :
‪#‎include‬ <graphics.h>
#include <stdio.h>
#include <math.h>
int main( )
{
float x,y,x1,y1,x2,y2,dx,dy,pixel;
int i,gd,gm;
printf("Enter the value of x1 : ");
scanf("%f",&x1);
printf("Enter the value of y1 : ");
scanf("%f",&y1);
printf("Enter the value of x2 : ");
scanf("%f",&x2);
printf("Enter the value of y1 : ");
scanf("%f",&y2);
detectgraph(&gd,&gm);
initgraph(&gd,&gm,"");
dx=abs(x2-x1);
dy=abs(y2-y1);
if(dx>=dy)
pixel=dx;
else
pixel=dy;
dx=dx/pixel;
dy=dy/pixel;
x=x1;
y=y1;
i=1;
while(i<=pixel)
{
putpixel(x,y,1);
x=x+dx;
y=y+dy;
i=i+1;
delay(100);
}
getch();
closegraph();
}

RMI in JAVA

The server creates remotes objects and makes references to those objects accessible. Then it waits for clients to invoke methods on the objects. The client gets remote
references to remote objects in the server and invokes methods on those remote objects. Java RMI is a mechanism that allows one to invoke a method on an object that exists in another address space. The other address space could be on the same machine or a different one. Java Remote Method Invocation (Java RMI) enables the programmer to create distributed Java technology-based to Java technology-based 
applications in which the methods of remote Java objects can be invoked from other Java virtual machines possibly on different hosts

In mathematics and computer programming, which is the correct order of mathematical operators ?

A. Addition, Subtraction, Multiplication, Division
B. Division, Multiplication, Addition, Subtraction
C. Multiplication, Addition, Division, Subtraction
D. Addition, Division, Modulus, Subtraction
Answer: Option B
Explanation:
Simply called as BODMAS (Brackets, Order, Division, Multiplication, Addition and Subtraction).
Mnemonics are often used to help students remember the rules, but the rules taught by the use of acronyms can be misleading. In the United States the acronym PEMDAS is common. It stands for Parentheses, Exponents, Multiplication, Division, Addition, Subtraction. In other English speaking countries, Parentheses may be called Brackets, or symbols of inclusion and Exponentiation may be called either Indices, Powers or Orders, and since multiplication and division are of equal precedence, M and D are often interchanged, leading to such acronyms as BEDMAS, BIDMAS, BODMAS, BERDMAS, PERDMAS, and BPODMAS.

Java program to reverse a string

import java.util.*;
class ReverseString
{
public static void main(String args[])
{
String original, reverse = "";
Scanner in = new Scanner(System.in);
System.out.println("Enter a string to reverse");
original = in.nextLine();
int length = original.length();
for ( int i = length - 1 ; i >= 0 ; i-- )
reverse = reverse + original.charAt(i);
System.out.println("Reverse of entered string is: "+reverse);
}
}

What is a sub query and what are the different types of subqueries?

Sub Query is also called as Nested Query or Inner Query which is used to get data from multiple tables. A sub query is added in the where clause of the main query.
There are two different types of subqueries:
Correlated sub query
A Correlated sub query cannot be as independent query but can reference column in a table listed in the from list of the outer query.
Non-Correlated subquery
This can be evaluated as if it were an independent query. Results of the sub query are submitted to the main query or parent query

What are temporal data types in Oracle?

Oracle provides following temporal data types:
Date Data Type – Different formats of Dates
TimeStamp Data Type – Different formats of Time Stamp Interval Data Type – Interval between dates and time