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) ;
else
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 ;
else
{
for(i = 2 ; i <= n / 2 ; i++)
if(n % i == 0)
{
flag = 1 ;
break ;
}
}
if(flag == 1)
printf("\nThe number is not prime") ;
else
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 STRUCTURE AND JAVA PLATFORM

 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) {
    System.out.println(y[y.length-1]+"");
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
collector.

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


Arp
The arp command is used to display or change entries in the ARP cache.
Assoc
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.
Attrib
The attrib command is used to change the attributes of a single file or a directory.
Auditpol
The auditpol command is used to display or change audit policies.
Bcdedit
The bcdedit command is used to view or make changes to Boot Configuration Data.
Bitsadmin
The bitsadmin command is used to create, manage, and monitor download and upload jobs.
Bootcfg
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.
Break
The break command sets or clears extended CTRL+C checking on DOS systems
Cacls
The cacls command is used to display or change access control lists of files
Call
The call command is used to run a script or batch program from within another script or batch program.
Certreq
The certreq command is used to perform various certification authority (CA) certificate functions.
Certutil
The certutil command is used to dump and display certification authority (CA) configuration information in addition to other CA functions.
Change
The change command changes various terminal server settings like install modes, COM port mappings, and logons.
Chcp
The chcp command displays or configures the active code page number.
Chdir
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.
Chglogon
The chglogon command enables, disables, or drains terminal server session logins.
Chgport
The chgport command can be used to display or change COM port mappings for DOS compatibility.
Chgusr
The chgusr command is used to change the install mode for the terminal server.
Chkdsk
The chkdsk command, often referred to as check disk, is used to identify and correct certain hard drive errors.
Chkntfs
The chkntfs command is used to configure or display the checking of the disk drive during the Windows boot process.
Choice
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.
Cipher
The cipher command shows or changes the encryption status of files and folders on NTFS partitions.
Clip
The clip command is used to redirect the output from any command to the clipboard in Windows.
Cls
The cls command clears the screen of all previously entered commands and other text.
Cmd
The cmd command starts a new instance of the command interpreter.
Cmdkey
The cmdkey command is used to show, create, and remove stored user names and passwords.
Cmstp
The cmstp command installs or uninstalls a Connection Manager service profile.
Color
The color command is used to change the colors of the text and background within the Command Prompt window.

Comp
The comp command is used to compare the contents of two files or sets of files.
Compact
The compact command is used to show or change the compression state of files and directories on NTFS partitions.
Convert
The convert command is used to convert FAT or FAT32 formatted volumes to the NTFS format.
Copy
The copy command does simply that - it copies one or more files from one location to another.
Date
The date command is used to show or change the current date.
Debug
The debug command starts Debug, a command line application used to test and edit programs.
Defrag
The defrag command is used to defragment a drive you specify. The defrag command is the command line version of Microsoft's Disk Defragmenter.
Del
The del command is used to delete one or more files. The del command is the same as the erase command.
Dir
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.
Diskcomp
The diskcomp command is used to compare the contents of two floppy disks.
Diskcopy
The diskcopy command is used to copy the entire contents of one floppy disk to another.
Diskpart
The diskpart command is used to create, manage, and delete hard drive partitions.
Diskraid
The diskraid command starts the DiskRAID tool which is used to manage and configure RAID arrays.
Dism
The dism command starts the Deployment Image Servicing and Management tool (DISM). The DISM tool is used to manage features in Windows images.
Dispdiag
The dispdiag command is used to output a log of information about the display system.
Doskey
The doskey command is used to edit command lines, create macros, and recall previously entered commands.
Driverquery
The driverquery command is used to show a list of all installed drivers.
Echo
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.
Edit
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.
Edlin
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.