Posts

Showing posts with the label C

Java Swings

Java Swings      Java Interview Questions  site discussing core java IT technical interview questions in detail.  These are some of the java job interview questions me and my friends have faced regularly in  campus interviews and off campuses. I have consolidated all of them from different people and communities into a vast resource of core java interview questions all in one place. So I am giving  you a chance to prepare well by going through each of the java interview faqs organized by java  topics, before attending a technical interview on java.  Java Swing Interview Questions What is the difference between Swing and AWT components? AWT components are heavy-weight, whereas Swing components are lightweight. Hence Swing  works faster than AWT. Heavy weight components depend on the local windowing toolkit. For  example, java.awt.Button is a heavy weight component. Pluggable look and feel possible  using java Swing...

Decimal to Binary conversion using Stack in c

 Decimal to Binary conversion using Stack in c # include < stdio.h > # include < conio.h > # include < process.h > # define MAX 10 typedef struct stack { int data [ MAX ] ; int top ; } stack ; //--------------------- int empty ( stack * s ) { if ( s - > top = = - 1 ) return ( 1 ) ; return ( 0 ) ; } //---------------------- int full ( stack * s ) { if ( s - > top = = MAX - 1 ) return ( 1 ) ; return ( 0 ) ; } //----------------------- void push ( stack * s , int x ) { s - > top = s - > top + 1 ; s - > data [ s - > top ] = x ; } //----------------------- int pop ( stack * s ) { int x ; x = s - > data [ s - > top ] ; s - > top = s - > top - 1 ; return ( x ) ; } //------------------------ void main ( ) { stack s ; int num ; s . top = - 1 ; printf ( " \n Enter decimal number: " ) ; scanf ( " %d " , & num ) ; while (...

Drawing National flag using Java Applet

 Drawing National flag using Java Applet  import java.io.*; import java.applet.*; import java.awt.*; public class flag extends Applet {     public void paint(Graphics g)     {         g.fillOval(60,450,120,50);         g.fillRect(110,60,10,400);         g.setColor(Color.red);         g.fillRect(120,80,150,30);         g.setColor(Color.white);         g.fillRect(120,110,150,30);         g.setColor(Color.green);         g.fillRect(120,140,150,30);         g.setColor(Color.black);         g.drawRect(120,80,150,90);         g.setColor(Color.blue);         g.drawOval(180,110,30,30...

C Programming Tips

Memory Efficient Programming Tips Ø      Basic Memory efficiency programming 1.     Basic mistakes we all use to do that while writing program always forget to deallocate the memory allocated, it is very important to deallocate memory. 2.     Avoid memory allocation inside recursive function or loop. 3.     During program we request some resources like file descriptor interrupt etc after using these it's very important to free it or close it. 4.     Actually c program contain different type of library, while linking library to your program avoid using static library this will make your program size bigger go for other option like shared or dll libraries. Ø      Local vs. Global Variables Try to use local variables as much as possible, avoid using Global variables. If you need global variables, tried to group the relative global variable in a structure and use that structure. These ...