Implement a C beautifier program. Following beautifications are needed.a. Tab is replaced by 4 spacesb. After every starting brace ie. {, the next statement will start 4 spaces away from the starting of the line that contains opening brace.Example 1:#include <stdio.h> main() /* Hello there */{ int x = 0;/* This is a comment */while (x< 10) { x ++; } if (x) { x++; } else { y = 0; } } Expected output:#include <stdio.h> main() /* Hello there */{ int x = 0; /* This is a comment */ while(x<10) { x ++; } if(x) { x++; } else { y=0; } }
Read Answers(2) | 2,806 Views |
Given an MxN filled up cross word, write a program to print all the words present in the cross word. Cross word table is given as input in a text file that contains ‘0′ for a shaded square and any other valid alphabet [A-Z] for any other position. Each row is a line of text input. A word has to be at least 2 letters long. The program has to read in the input file, and then print out all the words present. Your program has to print the output in the following format: >i is the row and j is the column from which the word begins.
The input file would contain:
12345678901234567890
100000CONGRESS0000000
2000I0000000U00000L00
3000M0000000PRESIDENT
4000P0000000R00I00G0H
5INDEPENDENCE00X00I0E
6000A0000000M00000S0R
70VICEPRESIDENT000L0E
8000H0000000C00TRIAL0
90E0M0S00000O00000T00
0NINETEEN0FOUR000FIVE
10G0N0N00000R000L0V00
20H0T0A00000TWO0AMEND
30T00STATE000000W0000
400000E000000000S0000
The output should contain:<1,6>:CONGRESS:Across
<1,12>:SUPREMECOURT:Down
<2,4>:IMPEACHMENT:Down
<2,18>:LEGISLATIVE:Down
<3,12>:PRESIDENT:Across
<3,15>:SIX:Down
<3,20>:THERE:Down
<5,1>:INDEPENDENCE:Across
<7,2>:VICEPRESIDENT:Across
<8,15>:TRIAL:Across
<9,2>:EIGHT:Down
<9,6>:SENATE:Down
<10,1>:NINETEEN:Across
<10,10>:FOUR:Across
<10,17>:FIVE:Across
<11,16>:LAWS:Down
<12,12>:TWO:Across
<12,16>:AMEND:Across
<13,5>:STATE:Across
Note: The greyed out numbers are row/column number for reference. They are not part of either input or output. The filename of the input text file should be given as the command line argument to your program. The output should appear on STDOUT. Take care to remove all the debug messages before you submit your program.
Read Answers(5) | 3,547 Views |
This was asked at Microsoft in January of 2008.
Write a function that takes three integers corresponding to the lengths of sides and returns what kind of triangle can be made out of those 3 sides. (Equilateral, etc)
You must also handle the case where no triangle may be formed from those 3 lengths.
Read Answers(14) | 14,136 Views |
What is the difference between java command line arguments and C command line arguments?
Read Answer(1) | 2,970 Views |
when we are taking the backup in the tape it will shows that the tape is 100% full but still the data writes to that tape. Can u please explan the difference between 100% and FULL.
Read Answer(1) | 5,607 Views |
Implement a C-formatter program that re-renders multi-line C-style comments as per the following cases.
/* This is a multi-line comment. This is line 1.
* This is line 2. This is line 3 */should be rendered as:
/* * This is a multi-line comment. This is line 1. * This is line 2. * This is line 3 */
The following code segment,
int magic_number = 0; /* This implements a magic numberfor the data structure */
should be rendered as
/*
* This implements a magic number * for the data structure. */int magic_number = 0;
Your code can assume that input will not have opening comment /* within string literals. For example ” this is a /* within a literal “. Your code can also assume that input will not have nested comments.
Post An Answer | 1,274 Views |
When i am working with Rmi “Hello world” program without Stub and skeleton the program has been working .
This is remote interface
import java.rmi.*;
public interface SmallInter extends Remote {
public String getMesg(String s) throws RemoteException;
}
This is my server side program
import java.rmi.*;
import java.rmi.server.*;
public class SmallServer extends UnicastRemoteObject implements SmallInter
//to convert local object into remote object
{
public SmallServer() throws RemoteException {
}
public String getMesg(String s) throws RemoteException {
String s1 = “This is a message from server after a message” + s;
return s1;
}
public static void main(String arg[]) {
try {
SmallServer ser = new SmallServer();
Naming.rebind(”small”, ser);
System.out.println(”server ready”);
} catch (Exception e) {
e.printStackTrace();
}
}
}
This is my Client side code:
import java.rmi.*;
public class SmallClient {
public static void main(String arg[]) {
try {
SmallInter remobj=(SmallInter)Naming.lookup(”rmi://”+arg[0] +”/small”);
System.out.println(remobj.getClass());
String res = remobj.getMesg(”from client”);
System.out.println(res);
}
catch (Exception e) {
e.printStackTrace();
}
}
}
but when printing the remobj.getClass() it will retuen some “class $proxy”
How this is possible?
please give me the answer………..
Post An Answer | 1,055 Views |
What does the term unnormalized relation refer to? How did the normal forms develop historically from first normal form up to Boyc-Codd normal form?
Read Answer(1) | 3,384 Views |
Four people need to cross a rickety rope bridge to get back to their camp at night. Unfortunately, they only have one flashlight and it only has enough light left for seventeen minutes. The bridge is too dangerous to cross without a flashlight, and it’s only strong enough to support two people at any given time. Each of the campers walks at a different speed. One can cross the bridge in 1 minute, another in 2 minutes, the third in 5 minutes, and the slow poke takes 10 minutes to cross. How do the campers make it across in 17 minutes?
Read Answers(11) | 16,802 Views |