Sunday, 1 April 2012

To find the given number is armstrong or not

/* To find the given number is armstrong or not */
# include <stdio.h>
# include <conio.h>
void main()
int n, r, s = 0, t ;
clrscr() ;
printf("Enter a number : ") ;
scanf("%d", &n) ;
t = n ;
while(n > 0)
r = n % 10 ;
s = s + (r * r * r) ;
n = n / 10 ;
if(s == t)
printf("\n%d is an armstrong number", t) ;
printf("\n%d is not an armstrong number", t) ;
getch() ;
RUN 1 :
Enter a number : 153
153 is an armstrong number
RUN 2 :
Enter a number : 123
123 is not an armstrong number

Program to check whether Prime or Not

/* To check whether the given no. is prime or not - CHKPRIME.C */
# include <stdio.h>
# include <conio.h>
void main()
int i, n, flag = 0 ;
clrscr() ;
printf("Enter the Number : ") ;
scanf("%d", &n) ;
if(n <= 3)
flag = 0 ;
for(i = 2 ; i <= n / 2 ; i++)
if(n % i == 0)
flag = 1 ;
break ;
if(flag == 1)
printf("\nThe number is not prime") ;
printf("\nThe number is prime") ;
getch() ;
RUN 1 :
Enter the Number : 6
The number is not prime
RUN 2 :
Enter the Number : 11
The number is prime


 JAVA Platform

Simple JAVA Structure

Important point of JAVA

1) overriden method doesn't throws IOException
2)If all variables =null , then its shows runtimeexception (NULLPOINTEREXCEPTION)

3) If catch(Exception e)
catch(ArithmeticException e)
 -> shows error bcos ArithmeticException that subclass of excetion.

4) catch(ArithmeticException e)
catch(Exception e)
  -> it allows

5)  ENUM related : Correct lines
class enum2
 public enum Direction {NORTH,WEST,EAST}
public class aa()
//enum2.Direction d=enum2 Dirction.NORTH;

   Direction d = Direction.NORTH;  It allows

6) Direction {NORTH,WEST,EAST}
   the expression (NORTH==NORTH) and NORTH.equals(NORTH) both are true

7)It is possible for more than two threads to deadlock at once.
If a piece of code is capable of deadlocking, you cannot eliminate the possibility of
deadlocking by inserting
invocations of Thread.yield().

9890040911 shridhar jahagirdar

8) sum ref. variables on stack and sum on heap.

9)  Treeset : provide array manipulation utilities
    Array :  provide collection manipulation utilities
    sorted set : defines base methods for all collection obj. , defines base methods for ordered set

    Iterator : linear access to collection and provide concrete implementation of order set
    Collection : base method for array obj. and random access.

10) list : by integer index
     map : objectKey
     queue : holding elements for prior processing
     set : contains no. of pair elements such as s1 and s2. e'g s1.equals(s2);

9)public void go(String y[], int i) {
It allows

11)  is a ->  object used. class A { List<B> b; } or class A {A a ; B b;}
      has a -> extends

12) protected long blipvert(int x) { return 0; }
error in stmt.. bcos not converting from long to int.

13) The hashCode method for a given class can be used to test for object inequality, but
NOT object equality, for that class.The hashCode method is used by the java.util.HashSet collection class to group the elements within that set into hash buckets for swift retrieval.

14) The finalize() method for a given object is called no more than once by the garbage

15) A. declare reset() using the synchronized keyword
    C. declare getCount() using the synchronized keyword
    E. declare increment() using the synchronized keyword

Command Prompt Coommands

The arp command is used to display or change entries in the ARP cache.
The assoc command is used to display or change the file type associated with a particular file extension.
The at command is used to schedule commands and other programs to run at a specific date and time.
The attrib command is used to change the attributes of a single file or a directory.
The auditpol command is used to display or change audit policies.
The bcdedit command is used to view or make changes to Boot Configuration Data.
The bitsadmin command is used to create, manage, and monitor download and upload jobs.
The bootcfg command is used to build, modify, or view the contents of the boot.ini file, a hidden file that is used to identify in what folder, on which partition, and on which hard drive Windows is located.
The break command sets or clears extended CTRL+C checking on DOS systems
The cacls command is used to display or change access control lists of files
The call command is used to run a script or batch program from within another script or batch program.
The certreq command is used to perform various certification authority (CA) certificate functions.
The certutil command is used to dump and display certification authority (CA) configuration information in addition to other CA functions.
The change command changes various terminal server settings like install modes, COM port mappings, and logons.
The chcp command displays or configures the active code page number.
The chdir command is used to display the drive letter and folder that you are currently in. Chdir can also be used to change the drive and/or directory that you want to work in.
The chglogon command enables, disables, or drains terminal server session logins.
The chgport command can be used to display or change COM port mappings for DOS compatibility.
The chgusr command is used to change the install mode for the terminal server.
The chkdsk command, often referred to as check disk, is used to identify and correct certain hard drive errors.
The chkntfs command is used to configure or display the checking of the disk drive during the Windows boot process.
The choice command is used within a script or batch program to provide a list of choices and return of the value of that choice to the program.
The cipher command shows or changes the encryption status of files and folders on NTFS partitions.
The clip command is used to redirect the output from any command to the clipboard in Windows.
The cls command clears the screen of all previously entered commands and other text.
The cmd command starts a new instance of the command interpreter.
The cmdkey command is used to show, create, and remove stored user names and passwords.
The cmstp command installs or uninstalls a Connection Manager service profile.
The color command is used to change the colors of the text and background within the Command Prompt window.

The comp command is used to compare the contents of two files or sets of files.
The compact command is used to show or change the compression state of files and directories on NTFS partitions.
The convert command is used to convert FAT or FAT32 formatted volumes to the NTFS format.
The copy command does simply that - it copies one or more files from one location to another.
The date command is used to show or change the current date.
The debug command starts Debug, a command line application used to test and edit programs.
The defrag command is used to defragment a drive you specify. The defrag command is the command line version of Microsoft's Disk Defragmenter.
The del command is used to delete one or more files. The del command is the same as the erase command.
The dir command is used to display a list of files and folders contained inside the folder that you are currently working in. The dir command also displays other important information like the hard drive's serial number, the total number of files listed, their combined size, the total amount of free space left on the drive, and more.
The diskcomp command is used to compare the contents of two floppy disks.
The diskcopy command is used to copy the entire contents of one floppy disk to another.
The diskpart command is used to create, manage, and delete hard drive partitions.
The diskraid command starts the DiskRAID tool which is used to manage and configure RAID arrays.
The dism command starts the Deployment Image Servicing and Management tool (DISM). The DISM tool is used to manage features in Windows images.
The dispdiag command is used to output a log of information about the display system.
The doskey command is used to edit command lines, create macros, and recall previously entered commands.
The driverquery command is used to show a list of all installed drivers.
The echo command is used to show messages, most commonly from within script or batch files. The echo command can also be used to turn the echoing feature on or off.
The edit command starts the MS-DOS Editor tool which is used to create and modify text files. Edit is not available in 64-bit versions of Windows 7.
The edlin command starts the Edlin tool which is used to create and modify text files from the command line. Edlin is not available in 64-bit versions of Windows 7.