Wednesday, April 30, 2014

In Java, Jar file Creation manual


Jar file Definition:

The JAR file format is a compressed format used primarily to distribute Java applications and libraries. It is built on the ZIP file format, and functions in a similar way; many files are compressed and packaged together in a single file, making it easy to distribute the files over a network. If you need to package a Java application or library, you can create a JAR file using the Java Development Kit (JDK) and your computer's command prompt.

Friday, April 25, 2014

C Language Placement Papers

1. What will be the output?

#include<stdio.h>
#define SWAP(a, b, c)(c t; t=a, a=b, b=t)
int main()
{
    int x=10, y=20;
    SWAP(x, y, int);
    printf("%d %d\n", x, y);
    return 0;
}
 
A.    It compiles
B.    Compiles with an warning
C.    Not compile
D.    Compiles and print nothing
    (NB:The code won't compile since declaration of t cannot occur within parenthesis. )

WBUT C++ Model questions solutions


1. What is the difference between Sequential and Random Access?

 Comparing random versus sequential operations is one way of assessing application efficiency in terms of disk use. Accessing data sequentially is much faster than accessing it randomly because of the way in which the disk hardware works. The seek operation, which occurs when the disk head positions itself at the right disk cylinder to access data requested, takes more time than any other part of the I/O process. Because reading randomly involves a higher number of seek operations than does sequential reading, random reads deliver a lower rate of throughput. The same is true for random writing.






 


You might find it useful to examine your workload to determine whether it accesses data randomly or sequentially. If you find disk access is predominantly random, you might want to pay particular attention to the activities being done and monitor for the emergence of a bottleneck.

Thursday, April 17, 2014

Stream,The ios class,The istream Class and The ostream Class


Stream


A stream is a general name given to the flow of data. Different streams are used to represents different kinds of data flow. For example, the standard output stream flows to the screen display, the standard input stream flows from the keyboard. In C++ a stream is represented by an object of a particular class. For example, cin and cout that we have used so far are really objects of istream_withassign and ostream_withassign classes respectively. These classes have been derived from istream and ostream classes. Both these classes are including in “iostream.h” header file.

Monday, April 14, 2014

UGC NET DEC 2011 COMPUTER SCIENCE PAPER 2 SOLUTIONS



1. Which of the following data structure is Non-linear type ?
(A) Strings
(B) Lists
(C) Stacks
(D) None of the above

2. The total number of comparisons in a bubble sort is
(A) 0(log n)
(B) 0(n log n)
(C) 0(n)
(D) None of the above

Saturday, April 12, 2014

UGC NET JUNE 2012 COMPUTER SCIENCE PAPER 2 SOLUTIONS


 1.             The postfix expression AB + CD – * can be evaluated using a

(A)         stack

(B)         tree

(C)         queue

         (D) linked list

Monday, April 07, 2014

WBUT 5 years JAVA Solutions for BCA,BTech, MCA course


1.           What are the different identifier states of a Thread?

The different identifiers of a Thread are: R - Running or runnable thread, S - Suspended thread, CW - Thread waiting on a condition variable, MW - Thread waiting on a monitor lock, MS - Thread suspended waiting on a monitor lock

WBUT 5years Java solutions for BCA ,BTech,MCA Course


1.         Write an applet program to change the background color

import java.awt.*;



public class color5 extends java.applet.Applet {



    public void init() {

        Color lightOrange = new Color(230, 220, 0);

        setBackground(lightOrange);

    }


WBUT 5 years java solutions for BCA,BTech & MCA Course

1.         What do you mean by subclass constructor method? 
If your method overrides one of its superclass's methods, you can invoke the overridden method through the use of the keyword super. You can also use super to refer to a hidden field (although hiding fields is discouraged). Consider this class, Superclass:

Tuesday, April 01, 2014

WBUT 2012-2013 JAVA SOLUTIONS PART 2



1.          What is the role of garbage collection? What are packages? Explain the steps to create packages (WBUT 2013)

Sol:
Since objects are dynamically allocated by using the new operator, we find how such objects are destroyed and their memory released for later reallocation. In some languages, such as C++, dynamically allocated objects must be manually released by use of a delete operator. Java takes a different approach; it handles deallocation for you automatically. The technique that accomplishes this is called garbage collection. It works like this: when no references to an object exist, that object is assumed to be no longer needed, and the memory occupied by the object can be reclaimed. There is no explicit need to destroy objects as in C++. Garbage collection only occurs sporadically (if at all) during the execution of your program. It will not occur simply because one or more objects exist that are no longer used. Furthermore, different Java run-time implementations will take varying approaches to garbage collection, but for the most part, you should not have to think about it while writing your programs.

WBUT 2012-2013 EXAM JAVA SOLUTIONS PART1


1.         Indicate the difference between PATH and CLASSPATH.(WBUT 2013)
Sol:
PATH and CLASSPATH are two most important environment variable of Java environment which is used to find JDK binaries used to compile and run Java in windows and Linux and class files which are compile Java byte codes.  

Difference between PATH and CLASSPATH in Java

Here are some of the common difference between PATH vs CLASSPATH in Java :

WBUT 2012-2013 JAVA SOLUTIONS PART3


1.         Interface (WBUT 2013)

An interface is a collection of abstract methods. A class implements an interface, thereby inheriting the abstract methods of the interface.
An interface is not a class. Writing an interface is similar to writing a class, but they are two different concepts. A class describes the attributes and behaviors of an object. An interface contains behaviors that a class implements.
Unless the class that implements the interface is abstract, all the methods of the interface need to be defined in the class.
An interface is similar to a class in the following ways:

WBUT 2012 -2013 JAVA SOLUTIONS PART6


1.         Write an applet program to change the Text color and font.

import java.awt.*;
import java.applet.*;
public class font1 extends Applet
{
            public void paint(Graphics g)
            {
                        String s1=new String("Font & Color Changes");
                        g.setColor(Color.red);
                        Font f1=new Font("Arial",Font.PLAIN,16);
                        g.setFont(f1);
                        g.drawString(s1,50,50);