Sunday, February 17, 2008

Microsoft Intern question paper

Well I attended Microsoft Internship written test. The question paper was um..okay. They concentrated more on concepts. The "reading between lines" concept was requried to answer all the questions. We were asked to register first, then assemble for a presentation. The presentation was done by a microsoft personnel (dint tell us his name). There were around 400 students from all over tamilnadu. The written test was conducted for around 2500 students alround India. The presentation was about MS's 3 teams for which the internship program was conducted. They were

  • MS IT global team
  • MS consulting
  • MS IDC(Indian Develvopment Center)

The test started at 11.10 am exactly. The question paper was divided into sections. There were 5 sections. Each section was alloted timings based on I guess.. Importance. The 5 sections were(in order)

  • Analytical
  • Software Engineering
  • C and C++ programming
  • Operating System concepts
  • RDBMS

The question paper for next section is given only after collecting the previous section's paper. The questions were asked to test our understanding level and how well we learnt concepts rather than how we mugged up. Sample questions are:

Analytical:

  • Assign a 6 letter code for employees of a company. A-E(5) characters and 0 - 9(10) digits are to be used, whereas first 3 letters are characters and others are digits. Find the proability that all 3 characters are the same.
  • Given a pie chart find the corresponding number of people... etc.

Operating system:

  • In deadlock prevention, hold and wait can be avoided by which protocol. There are 2 protocols and both were given as options.

C and C++ programming:

  • Enumeration is an Userdefined datatype.
  • List is used instead of array and is preferred when
  1. For sequential access.
  2. For random access and some more options.
  • The default access specifier for inheritance in C++ is ......

Monday, February 11, 2008

Struct && Union

STRUCTURE:

A structure is a group of items in which each item can be refrenced with its own identifier and such item is called "member" of the structure. Aka record and field of the reord sometimes.

Matter-of-fact details:

  • For declaring structures, there are 3 methods
  1. struct { //members }struct_varname;
  2. struct struct_tag {//members} ; struct struct_tag struct_varname;
  3. typedef struct {//members} TYPENAME; TYPENAME varname;
  • the typedef declaration sometimes used to achieve the flavor of ADT specification within a C program.
  • A member of structure may be declared to another structure. Eg: struct var1{ struct var2; struct var3; };
  • ANSI standard C allows assignment of structures of the same type. But the original C developed by Kernighan and Ritchie doesnt allow this type of assignment but the field wise assignment.
  • Two structures cannot be compared for equality in a single operation in C.
  • Same identifier can be reused to name members of different structures. No ambiguity caused because while refrencing, the memeber name is followed by the structure name.
  • Amount of memory specified by the structure is the sum of the storage specified by the members of the structure.
  • There are boundary restrictions in some system. For eg: if there is a member of integer, it will start from memory location which is divisible by 4 (assuming integer occupies 4 bytes).

UNION:

C allows another type of structure, the union, which permits a variable to be interpreted in several different ways.

SPOJ Techniques

SPOJ online judge is one of the judges which is used by many of the college students. So far only few problems are solved, many techniques have been learned from mistakes. When the solution is submitted the judge gives the result in code. The code has to be interpreted as follows:

1. AC - accepted - your program ran successfully and gave a correct answer

2. WA - wrong answer - your program ran successfully, but gave an incorrect answer

3. TLE - time limit exceeded - your program was compiled successfully, but it didn't stop before time limit

4. CE - compilation error - your program couldn't be compiled; compiler's errors can be seen from www and are sent via mail if your preferences say so; note: only some languages can give CE, syntax errors in intrerpreted languages can lead to WA (Python - no pre-checking syntax or Perl - CE only afer a basic syntax check)

5. RE - runtime error - your program was compiled succesfully, but it exited with an error; possible codes are:
- SIGSEGV (signal 11) - most common, "segmentation fault"
- SIGXFSZ (signal 25) - "output limit exceeded"
- SIGFPE (signal 8) - "floating point error", like division by zero, etc.
- SIGABRT (signal 6) - raised by the program itself; C++ STL does it under some conditions
- NZEC (non-zero exit code) - helps telling crash from WA with interpreted languages
- other - there are other signals which can cause program to terminate, all remaining are shown as other

problems solved:

In the future, the techniques for string manipulation with code will be updated :)

DataStructures

DATA TYPE:
A method of interpreting a bit pattern.

ABSTRACT DATA TYPES:
Tool for specifying the logical properties of the datatype. Its java counterpart is interface. It declares the methods,but the implementation details are not mentioned and can be changed according to the context of the class that implements the interface. Hence here, it defines the logical properties abstractly.
Eg: For array,

ADT definitions:

abstract typedef <> array(ub,eltype);
condition type(ub) == int;

This specifies that array in C will have two arguments one is ub(upper bound) and the other is eltype(element type). Upper bound is specified to allocate that many number of contiguous memory locations. The element type specifies which type of element each mem. location is going to hold.
This can be extended to other language array representation with some details. For eg in Pascal, int arr[-3..10] specifies both upper bound and lower bound for the array along with eltype of int. Thus ADT would be sth like

abstract typedef <> array(lb,up,eletype);
condition type(ub) && type(lb) == int;

DATASTRUCTURES:

COMPOSITE OR STRUCTURED DATATYPES:
These are made up of simpler data structures. One such datatype is array.

ARRAY:
Array is a finite ordered set of homogeneous elements.

finite: Only finite no. of elements can be stored in an array.
ordered set: the elements are arranged.
homogeneous: may contain one datatype or the other but not the both.

we know in C, int a[10] declares a continuous memory locations starting from a till a+10*sizeof(int). The base (a) is a pointer to the starting location of the array. The disadvantage of the array is that it contains homogeneous elements. But it the simplest form of storing large value.
Another disadvantage interms of efficiency, while dealing with large number of inputs, the insertion and delete all are difficult or atleast will not be efficient.Mutlidimensional arrays are viewed as single dimensional arrays stacked together. The array can be represented as row-major representation where a[2][1] is represented as,

--------
|a[0][0] |
--------
|a[0][1] |
--------
|a[1][0] |
--------
|a[1][1] |
--------
|a[2][0] |
--------
|a[2][1] |
---------

I am BACK!!

Back after a long time. Got lot of things to pour in. Things swamped in
the first in, first out fashion.









Though we dint make it into the shortlisted teams, the experience was a piece of cake. Sitting around the table as in meetings(though haven't seen real meetings, I have picture of it from the films), discussing the pros and cons of every idea about the product gave us real insight into the product development details. Our product was Green Paper. Not to be confused with the Green paper- government's tentative report. Our aim was all about going paperless by providing secure storage and cataloging of receipts and documents online and sharing them with anyone who has internet connection. The motive behind the product is the complete digitization of paper receipts and documents which in turn reduces vast consumption of papers thereby contributing to a greener environment.


Link to our paper.

The project was not completed due to certain unforeseen situations. Similarly here, experience was a gain.

Link to our paper.

Friday, September 14, 2007

5th Sem Projects

The 5th sem is going to be hectic and fun( i guess). Because lots of projects and lots of work but no time. The projects signed in for this semester are
  • TGMC IBM 2007, The Great Mind Challenge, is all about database management and implementation of IBM tools.
  • Product Prodigy, Google. This is all about ideas and conceptualism. The inspiring quote given in the google poster was "Once upon a time, Google was just an idea. Tell us yours".

To find more about the projects:

TGMC IBM 07

ProductProdigy,Google

Monday, August 20, 2007

Networks Lab Excercises

FTP:

The FTP (File Transfer Protocol) utility program is commonly used for copying files to and from other computers. These computers may be at the same site or at different sites thousands of miles apart. FTP is a general protocol that works on UNIX systems as well as a variety of other (non-UNIX) systems.


For the purposes of this Web page, the local machine refers to the machine you are initially logged into, the one on which you type the ftp command. The remote machine is the other one, the one that is the argument of the ftp command.


A user interface for the standard File Transfer Protocol for ARPANET, FTP acts as an interpreter on the remote machine. The user may type a number of UNIX-like commands under this interpreter to perform desired actions on the remote machine.


Most operating systems and communication programs now include some form of an FTP utility program, but the commands differ slightly between them. The following explanations and alphabetical list of commands refers to the common FTP utility program as provided on a UNIX machine. Check the documentation for your own machine to determine the comparable commands.


Most computers today include a windows-based type FTP program that is more PC-oriented and does not require full knowledge of these commands.
You can also perform FTP through a browser. For example, bring up Internet Explorer and type in
ftp://yourLoginName@IPaddress

instead of a normal web page URL.

The FTP site of the Computer Science department at CSU requires the user to use sftp, the secure version of FTP. Just type sftp instead of ftp, when you are using FTP in a terminal window.





--------------------------------------------------------------------------------


Getting Started
To connect your local machine to the remote machine, type
ftp machinename

where machinename is the full machine name of the remote machine, e.g., purcell.cs.colostate.edu. If the name of the machine is unknown, you may type

ftp machinennumber

where machinennumber is the net address of the remote machine, e.g., 129.82.45.181. In either case, this command is similar to logging onto the remote machine. If the remote machine has been reached successfully, FTP responds by asking for a loginname and password.


When you enter your own loginname and password for the remote machine, it returns the prompt
ftp>

and permits you access to your own home directory on the remote machine. You should be able to move around in your own directory and to copy files to and from your local machine using the FTP interface commands given on the following page.



--------------------------------------------------------------------------------


Anonymous FTP
At times you may wish to copy files from a remote machine on which you do not have a loginname. This can be done using anonymous FTP.

When the remote machine asks for your loginname, you should type in the word anonymous. Instead of a password, you should enter your own electronic mail address. This allows the remote site to keep records of the anonymous FTP requests.

Once you have been logged in, you are in the anonymous directory for the remote machine. This usually contains a number of public files and directories. Again you should be able to move around in these directories. However, you are only able to copy the files from the remote machine to your own local machine; you are not able to write on the remote machine or to delete any files there.


--------------------------------------------------------------------------------


Common FTP Commands

? to request help or information about the FTP commands
ascii to set the mode of file transfer to ASCII
(this is the default and transmits seven bits per character)
binary to set the mode of file transfer to binary
(the binary mode transmits all eight bits per byte and thus provides less chance of a transmission error and must be used to transmit files other than ASCII files)
bye to exit the FTP environment (same as quit)
cd to change directory on the remote machine
close to terminate a connection with another computer
close brubeck closes the current FTP connection with brubeck,
but still leaves you within the FTP environment.
delete to delete (remove) a file in the current remote directory (same as rm in UNIX)
get to copy one file from the remote machine to the local machine
get ABC DEF copies file ABC in the current remote directory to (or on top of) a file named DEF in your current local directory.
get ABC copies file ABC in the current remote directory to (or on top of) a file with the same name, ABC, in your current local directory.
help to request a list of all available FTP commands
lcd to change directory on your local machine (same as UNIX cd)
ls to list the names of the files in the current remote directory
mkdir to make a new directory within the current remote directory
mget to copy multiple files from the remote machine to the local machine;
you are prompted for a y/n answer before transferring each file
mget * copies all the files in the current remote directory to your current local directory, using the same filenames. Notice the use of the wild card character, *.
mput to copy multiple files from the local machine to the remote machine;
you are prompted for a y/n answer before transferring each file
open to open a connection with another computer
open brubeck opens a new FTP connection with brubeck;
you must enter a username and password for a brubeck account
(unless it is to be an anonymous connection).
put to copy one file from the local machine to the remote machine
pwd to find out the pathname of the current directory on the remote machine
quit to exit the FTP environment (same as bye)
rmdir to to remove (delete) a directory in the current remote directory




--------------------------------------------------------------------------------


Further Information
Many other interface commands are available. Also FTP can be run with different options. Please refer to your manual or the UNIX man page on ftp for more information.
See also the SILS FTP Tutorial



--------------------------------------------------------------------------------


Example Sessions
Examples of two FTP sessions are given on the next two pages. These show the type of interaction you may expect when using the ftp utility.



--------------------------------------------------------------------------------


Example of Anonymous FTP Session
% ftp cs.colorado.edu
Connected to cs.colorado.edu.
220 bruno FTP server (SunOS 4.1) ready.
Name (cs.colorado.edu:yourlogin): anonymous
331 Guest login ok, send ident as password.
Password:
230-This server is courtesy of Sun Microsystems, Inc.
230-
230-The data on this FTP server can be searched and accessed via WAIS, using
230-our Essence semantic indexing system. Users can pick up a copy of the
230-WAIS ".src" file for accessing this service by anonymous FTP from
230-ftp.cs.colorado.edu, in pub/cs/distribs/essence/aftp-cs-colorado-edu.src
230-This file also describes where to get the prototype source code and a
230-paper about this system.
230-
230-
230 Guest login ok, access restrictions apply.
ftp> cd /pub/HPSC
250 CWD command successful.
ftp> ls
200 PORT command successful.
150 ASCII data connection for /bin/ls (128.138.242.10,3133) (0 bytes).
ElementsofAVS.ps.Z
. . .
execsumm_tr.ps.Z
viShortRef.ps.Z
226 ASCII Transfer complete.
418 bytes received in 0.043 seconds (9.5 Kbytes/s)
ftp> get README
200 PORT command successful.
150 ASCII data connection for README (128.138.242.10,3134) (2881 bytes).
226 ASCII Transfer complete.
local: README remote: README
2939 bytes received in 0.066 seconds (43 Kbytes/s)
ftp> bye
221 Goodbye.
% ls
. . .
README
. . .




An FTP session to obtain the HPSC README file from the cs.colorado.edu anonymous ftp directory using a loginname of anonymous and a password of one's own electronic mail address.


--------------------------------------------------------------------------------


Example of Regular FTP Session
% ftp nordsieck.cs.colorado.edu
Connected to nordsieck.cs.colorado.edu.
220 nordsieck FTP server (Version 5.53 Tue Aug 25 10:46:12 MDT 1992) ready.
Name (nordsieck.cs.colorado.edu:yourlogin): yourlogin
331 Password required for yourlogin.
Password:
230 User yourlogin logged in.
ftp> cd HPSC/exercises
250 CWD command successful.
ftp> ls
200 PORT command successful.
550 No files found.
ftp> put tmul.out
200 PORT command successful.
150 Opening ASCII mode data connection for tmul.out.
226 Transfer complete.
local: tmul.out remote: tmul.out
1882 bytes sent in 0.0095 seconds (1.9e+02 Kbytes/s)
ftp> ls
200 PORT command successful.
150 Opening ASCII mode data connection for file list.
tmul.out
226 Transfer complete.
9 bytes received in 0.0021 seconds (4.3 Kbytes/s)
ftp> mput *
mput Makefile? y
200 PORT command successful.
150 Opening ASCII mode data connection for Makefile.
226 Transfer complete.
local: Makefile remote: Makefile
1020 bytes sent in 0.0062 seconds (1.6e+02 Kbytes/s)
mput tmul.out? n
ftp> quit
221 Goodbye.
% ls
. . .
Makefile
tmul.out
. . .


SMTP:
This is a list of the SMTP client commands. Useful for manually debugging SMTP mail connections.
SMTP Commands HELO
MAIL FROM:
RCPT TO:
DATA
RSET
SEND FROM:
SOML FROM:
SAML FROM:
VRFY
EXPN
HELP [ ]
NOOP
QUIT
TURN
SMTP Replies 211 System status, or system help reply
214 Help message
220 Service ready
221 Service closing transmission channel
250 Requested mail action okay, completed
251 User not local; will forward to

354 Start mail input; end with .

421 Service not available, closing transmission channel
450 Requested mail action not taken: mailbox unavailable
451 Requested action aborted: local error in processing
452 Requested action not taken: insufficient system storage

500 Syntax error, command unrecognized
501 Syntax error in parameters or arguments
502 Command not implemented
503 Bad sequence of commands
504 Command parameter not implemented
550 Requested action not taken: mailbox unavailable
551 User not local; please try
552 Requested mail action aborted: exceeded storage allocation
553 Requested action not taken: mailbox name not allowed
554 Transaction failed

POP3 COMMANDS:
This is a list of the POP3 client commands. Useful for manually debugging POP3 mail connections.
Basic POP3 Commands (work in all implementations)
Commands in the AUTHORISATION state: USER name
PASS string
QUIT
Commands in the TRANSACTION state: STAT
LIST [msg]
RETR msg
DELE msg
NOOP
RSET
Commands in the UPDATE state: QUIT
Optional POP3 Commands (only work in some implementations)
Commands in the AUTHORISATION state: APOP name digest
Commands in the TRANSACTION state: TOP msg n
UIDL [msg]
POP3 Replies +OK
-ERR
Other than the STAT, LIST, and UIDL commands, only "+OK" and "-ERR" are significant in the reply. Any text supplied in addition to the standard reply may be ignored by the client. However, if supplied, it may be interpreted by teh client for extended functionality.