Friday, November 07, 2014

UGC NET DEC 2004 COMPUTER SCIENCE PAPER 2 SOLUTIONS



1. AVA = A is called:

(A) Identity law                      (B) De Morgan’s law
(C) Idempotant law              (D) Complement law

Ans C

Friday, October 31, 2014

Database program (show,insert, delete, update records in a table) implemented by Java Language

import java.sql.*;
public class database4
{
Connection data;
Statement datarequest;
ResultSet result;
String c1,c2,p1;
boolean record;

database4()
{
String url="jdbc:odbc:student2014";

Database connection program implemented by Java Language

import java.sql.*;
public class database1
{
Connection data;
Statement datarequest;
ResultSet result;
String c1,c2,p1;
boolean record;

database1()
{
String url="jdbc:odbc:student2014";

Tuesday, October 21, 2014

JUNE 2009 PAPER 1 UGE NET



1.    Good evaluation of written material should not be based on :
(A)    Linguistic expression
(B)    Logical presentation
(C)    Ability to reproduce whatever is read
(D)    Comprehension of subject

The number of possible binary trees with 4 nodes is A) 10 B) 12 C) 14 D) 15



The number of possible binary trees with 4 nodes is

A) 10                           B) 12
C) 14                           D) 15

UGC NET COMPUTER SCIENCE MODEL QUESTION-ANSWERS




3. The number of point to point links required in a fully connected network for 50
entities is
(A) 1250                 (B) 1225
(C) 2500                  (D) 50
Ans: (C)

2012 paper 3 ugc net exam question with answer



1)  Granulairity refers to
(a) Size of a database   (b) Size of a data item
(c) Size of a record  (d) .........
Answer: (a) size of a data item

(2) R = (A, B, C, D). We decompose it into R1 = (A, B), R2 = (C, D). The set offunctional dependencies is:  A → B,  C → D, Then decomposition is a
(a) Dependency preserving but lossy
(b)Dependency preserving and lossless
(c) lossless (d) Neither lossy nor dependency preserving
Answer: (b) Dependency preserving but lossy

ax^2+bx+c=0

                             /* ax^2+bx+c=0*/
#include<stdio.h>
#include<math.h>
#include<conio.h>
void main()
{
     int a,b,c,d;
     float x1,x2;
     clrscr();
     printf("\n enter the value of a,b,c=");
     scanf("%d %d %d",&a,&b,&c);

consnent,vowel,special character

#include<stdio.h>
#include<string.h>
void main()
{
char str[100];
int i,v,c,sp,sc;
printf("enter the string");
i=0,v=0,c=0,sp=0,sc=0;
gets(str);

Rivised Simplex Method

#include<stdio.h>
#include<conio.h>
#include<math.h>
#include<stdlib.h>

int bMATRIX[10][10];
void DETINV(int mSIZE, double **MATB);
void arg(int *a,int *b,int *n,int x,int y);
int det(int *p,int *n);
double **MATa;
double **MATB;
double *MATb;

North West Corner Method


                              /*North West Corner Method*/

#include<stdio.h>
#include<conio.h>
#include<stdlib.h>
int cost,i,j,msizerow,msizecol,matrix[10][10];
int r=0,c=0,p;
int supply[10],demand[10];
int value[10][10],rpos,cpos,rpre,cpre;
void firstiteration();

Draw Triangle in C Language

#include<stdio.h>
#include<conio.h>
#include<graphics.h>
void main()
{
    int a[6][6],b[10];
    int i,j,r,c,k=1;
    int x1,x2,x3;
    int y1,y2,y3;
    int gdriver = DETECT, gmode;
    clrscr();
    initgraph(&gdriver,&gmode,"c:/tc/bgi");

Solves the LPP by "SIMPLEX" method i.e. by table

#include <stdio.h>
#include <conio.h>
#define INFINITY 999
#define N 3
#define M 6
/************************************************************/
/***** Solves the LPP by "SIMPLEX" method i.e. by table *****/
/************************************************************/
void minimum(float *arr,int *arrminpos,int n);
/* Calculates the minimum valued position among the array arr having n elements. */
void display (float c[],float b[],float a[][M],int basic[]);
/* Display the table */
void displayframe(float c[M]);

OOP with JAVA basic intervies questions and answer


1. What is the difference between a constructor and a method?
A constructor is a member function of a class that is used to create objects of that class. It has the same name as the class itself, has no return type, and is invoked using the new operator.
A method is an ordinary member function of a class. It has its own name, a return type (which may be void), and is invoked using the dot operator.

UGC NET Paper1 solutions June 2006 2nd part

16.    The function of mass communication of supplying information regarding the processes, issues, events and 
        societal developments is known as :
(A)    content supply                (B)     surveillance
(C)    gratification                      (D)    correlation

UGC NET JUNE 2005 COMPUTER SCIENCE PAPER 2 SOLUTIONS



1.       Which of the following is not true?
(A) Power of deterministic automata is equivalent to power of non-deterministic automata.
(B) Power of deterministic pushdown automata is equivalent to power of non-deterministic pushdown automata.
(C) Power of deterministic Turing machine is equivalent to power of non-deterministic
Turing machine.
(D) All the above

Some C Program

1. How would you round off a value 1.66 to 2.00 and truncate1.75 to 1.00 using C program?

#include<stdio.h>
#include<math.h>
void main()
{
    float x=1.66;
    float y=1.75;
    printf(" %f  %f",ceil(x),floor(y));
}

Dec 2006 ugc net computer science paper 2 solutions


1. Which of the regular expressions corresponds to this grammar ?
S →AB/AS, A→a/aA, B→b
(A) aa*b+ (B) aa*b (C) (ab)* (D) a(ab)*

2. The proposition ~ q ∨ p is equivalent to :
(A)     (B)   (C)    (D) ans : p->q

Animated Banner program with Java



Save this file as: bannar.java
……………………………………………………………………………………………
import java.awt.*;
import java.applet.*;
public class bannar extends Applet implements Runnable
{

        String msg="Hello World";
        Thread t;
        int state;
        boolean flag;
        public void init()
        {

        }

Do U know?


1. If a computer on the network shares resources for others to use, it is called ____
a. Server
b. Client
c. Mainframe
Answer : a

Implement following tables with c++

 
Person (name, address)-> base class 
Employee (name, address, salary)-> derived class
Student (name, address, course) -> derived class
[Note: - Employee and Student are derived classes that are derived features from the base class Person]

UGC NET DEC 2005 PAPER 2 SOLUTION





1.   T is a graph with n vertices. T is connected and has exactly n-1 edges, then :
     (A)    T is a tree
     (B)    T contains no cycles
     (C)    Every pairs of vertices in T is connected by exactly one path
     (D)    All of these

Program to print specific date





#include<stdio.h>
#include<conio.h>
void main()
{
 int dd,mm,yy,i,a,a1,a2,b,b1,b2,d=0,sm=0;
 clrscr();
 printf("enter date(DD/MM/YYYY):");
 scanf("%d%d%d",&dd,&mm,&yy);
 if(mm>12 || dd>31)

WBUT 2012-2013 JAVA SOLUTIONS PART4


1.         What is thread? What is multi-threading? How to create a thread in a program? (WBUT 2012)
Thread: A thread, in the context of Java, is the path followed when executing a program. All Java programs have at least one thread, known as the main thread, which is created by the JVM at the program’s start, when the main() method is invoked with the main thread. In Java, implementing an interface and extending a class accomplish creating a thread. Every Java thread is created and controlled by the java.lang.Thread class.
Multi-threading: Java provides built in support for multithreaded programming. A multithreaded program contains two or more parts that can run concurrently. Each part of such a program is called a thread, and each thread defines a separate path of execution. Thus, multithreading is a specialized form of multitasking.

Combined transformation & Homogeneous Coordinates



A)    Homogeneous Coordinates:

The homogeneous coordinates of a non – homogeneous position vector [x y] are   [x` y` h] where x=x`/h, y=y`/h and h is any real number.
(Note that h=0 has special meaning.)
One set homogeneous coordinates is always of the form [x y 1] and all other homogeneous coordinates are of the form [hx  hy  h] where h is any real number. The example of homogeneous coordinates are [3 2], [3 2 1] or [6 4 2].
…………………………………………………………………………………………………………..

TCS Interview Question Paper with Answer


1.The C language terminator is 
  a. semicolon  
  b. colon
  c. period
  d. exclamation mark

WBUT 5Years Java Solutions for BCA,BTech,MCA Course



1.           What is local applet? What is remote applet?


   A LOCAL applet is the one, which is stored on our computer system.when browser, try to access the applet, it is not necessary for our computer to be connected to The Internet.

A REMOTE applet is the one, which is not stored on our computer system, and we are required to be connected to the Internet. 

Using Template in C++,Implement Bubble Sort method

#include<iostream.h>
template <class T>
void sort(T a[],int n)
{
        T temp;
        int i,j;
        for(i=0;i<n;i++)
        {
            for(j=i+1;j<n;j++)

Some graphical mathematical problem - solutions


*  What pixels will be marked in drawing a circle center (100,90) and radius 10? using Bresenham's algorithm

Ans:

Take x=0,y=r=10,d=3-2r=3-2*10=-17

Decision variable (d)
x
y
Point with Center (0,0)
Point with Center (100,90)

0
10
(0,10)
(100,100)
-17
1
10
(1,10)
(101,100)
-11
2
10
(2,10)
(102,100)
-1
3
10
(3,10)
(103,100)
13
4
9
(4,9)
(104,99)
-5
5
9
(5,9)
(105,99)
17
6
8
(6,8)
(106,98)
11
7
7
(7,7)
(107,97)

UGC NET DEC 2012 PAPER 2 COMPUTER SCIENCE SOLUTIONS



1.             Consider the circuit shown below. In a certain steady state, Y is at logical ‘l’. What are possible values of A, B, C ?


 




(A)         A = 0, B = 0, C = 1

(B)         A = 0, B = C = 1

(C)         A = 1, B = C = 0

(D)         A = B = 1, C = 1

Overloading << and >> operator using friend function implemented in C++

#include<iostream.h>
class complex
{
    private: double real,imag;
    public: complex(){}
              complex(double r,double i)
              {
                    real=r;
                    imag=i;
              }

Opening a file using C++

// OPEN A FILE

#include<iostream.h>
#include<stdio.h>
//#include<conio.h>
#include<fstream.h>
void main()
{
              char c,fname[10];
              ofstream out;

Class within Class or Containership or Composition or Has a / Kind of relationship

If two classes are related with one another there can be two types of relationship between them : a kind of relationship and a has a relationship. The kind of relationship is supported by inheritance and a has a relationship is supported by composition or containership.

Implemented a program with C++ that read a text file and creates another file that is identical to it

#include<fstream.h>
 void main()
 {
    char source[67],target[67];//max allowable path length usually 66
    char ch;
    cout<<"\n Enter souce filename=";
    cin>>source;

Using C++ overloading +,+= and = operator for append, concatenation and marge String

#include<iostream.h>
#include<string.h>
class marge
{
    private: char name[20];
    public:
            marge()
            {
                strcpy(name,"");
            }

WBUT 5 YEARS JAVA MCQ SOLUTIONS FOR BCA,MCA & BTECH COURSE


2010

i) Which of these is known as short-circuit and operator?
     a) &&,  b) &,     c) ? &,   d) None of these.

ii) A constructor can be inherited using the keyword?
a) Final, b) Static,     c) Super,      d) None of these.

Overloading new & Delete operator using C++

#include <iostream.h>
class overload {
    public:

     // Overloaded new
     void* operator new (size_t sz)
     {
          cout <<"\nNew operator are used for allocated memory in Object Creation";
          // Invoke the default new operator
          return ::new overload();
     }

Wipro - Placement Papers

Memory management in C
The C programming language manages memory statically, automatically, or dynamically. 
Static-duration variables are allocated in main memory, usually along with the executable code of the program, and persist for the lifetime of the program
Automatic-duration variables are allocated on the stack and come and go as functions are called and return. 
For static-duration and automatic-duration variables, the size of the allocation is required to be compile-time constant.

Some Important Small Java Script Programs


1. Write a Java Script program that show message “My First JavaScript program”

<html>
<body>
<script>

    document.writeln ( "My First JavaScript program")

</script>
</body>
</html>

VAM (Vogal Appro. Method)

#include<stdio.h>
#include<conio.h>
#include<stdlib.h>
 int max(int a[]);
 int min(int a[10][10],char fx, int rc,int n);
int cal_diff(int a[10][10],int rc,char ch, int n);
void main()
{
int vam[10][10],v[10][10],avail[11][10],av[10],demand[11][10],dm[10];
int avdf[11][10],dmdf[11][10],rs[10][10];
int row,col,r,c,chk1=0,chk2=0;

Gauss-Seidel method

#include<iostream.h>
#include<math.h>
void main()
{
            float x[10],y[10],a[10][10];
            int i,j,n,k,iteration;
            cout<<"\nEnter the order of the matrix.......=";
            cin>>n;

LAGRANGES INTERPOLATION FORMULA

#include<iostream.h>
#include<conio.h>
main()
{
    double xx;
    double x[20],y[20];
    int n,i;
    cout<<"\nEnter the number of terms=";
    cin>>n;

Newton's Backward formula

#include<iostream.h>
#include<conio.h>
#include<math.h>
double a[20][20],v;
int n,i,j;
void table()
{
    cout<<"\nEnter the number of terms=";
    cin>>n;
    cout<<"\nEnter "<<n<<" no. x's value=\n";

Newton's raphson method

#include<iostream.h>
#include<math.h>
double f(double x)
{
    return(4*sin(x)-exp(x));
}
double f1(double x)
{
    return(4*cos(x)-exp(x));
}

Regula falsi method

#include<iostream.h>
#include<math.h>
float f(float x)
{
    return(2*x-log10(x)-7);
}
void main()
{
    float x1,x2,h,e;
    int k=0;
    cout<<"X1=";
    cin>>x1;

Simpson's 1/3 rule

#include<iostream.h>
float f(float x)
{
    return(x/(1+x));
}

Bezier curve with C Language

#include <stdio.h>
#include <stdlib.h>
#include <graphics.h>
#include <math.h>

void bezier (int x[4], int y[4])
{
    int gd = DETECT, gm;
    int i;
    double t;

    initgraph (&gd, &gm, "c:/tc/bgi");

Print Clock with C Language

#include<stdio.h>
#include<graphics.h>
#include<conio.h>
#include<stdlib.h>
#include<math.h>
#include<dos.h>
void main()
{
    int gdriver=DETECT,gmode;
    double midx=350,midy=300;

cohen sutherland line clipping algorithm with C Language

#include<stdio.h>
#include<graphics.h>
//#include<process.h>
void main()
 {

  int gd=DETECT, gm;

  float i,xmax,ymax,xmin,ymin,x11,y11,x22,y22,m;

Shearing in c Language

#include<stdio.h>
#include<graphics.h>
#include<conio.h>
#include<stdlib.h>
#include<math.h>
void main()
{
    int gdriver=DETECT,gmode;
    double midx=350,midy=300;
    double x1=300,y1=200,x2=400,y2=200,x3=400,y3=300,x4=300,y4=300;
    double x11,y11,x22,y22,x33,y33,x44,y44;

Printing Smiling Face with C Language

#include<graphics.h>
#include<conio.h>
#include<stdlib.h>

main()
{
   int gd = DETECT, gm, area, temp1, temp2, left = 25, top = 75;
   void *p;

   initgraph(&gd,&gm,"C:\\TC\\BGI");

Text Animation Program with C Language

#include<stdio.h>

#include<math.h>

#include<conio.h>

#include<graphics.h>

#define round(val) (int)(val+0.5)

void main()

{    int gd=DETECT,gm,sx,sy,tx,ty;

      char text[50];

      void move(int,int,int,int,char[]);

      printf("Enter the text:");

Subtraction of two numbers using recursion Implemented by C++

#include<iostream.h>
int sub(int a, int b)
{
    int count = 0;
    if (a == b)
        return 0;

Clear your doubt


1)         What will be output of the following program?
#include<stdio.h>
void main()
{
                        printf("india"-'A'+'B');
}

Output: ndia  

UGC NET JUNE 2007 COMPUTER SCIENCE PAPER 2 SOLUTIONS

1. The following determiniotic finite automata recognizes : 
  

(A)         Set of all strings containing ‘ab’

(B)         Set of all strings containing ‘aab’

(C)        Set of all strings ending in ‘abab’

          (D)     None of the above 

Draw a Line with pen (Consider mouse pointer is a pen) implement with java program






Save this file draw1.java
……………………………………………………………………………………
import java.awt.*;
import java.applet.*;
public class draw1 extends java.applet.Applet
{
            private int x=0,y=0;

A small animation program (moving car) implement with java program



Save this file ex.java
……………………………………………………………………………………
import java.awt.*;
import java.util.*;
import java.applet.*;
public class ex extends Applet implements Runnable

Jumping ball implement with java program




Code
Save this file BounceThread.java
……………………………………………………………………………………
import java.awt.Container;
import java.awt.Dimension;
import java.awt.Graphics;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;

Age calculation of a person implemented with c++


#include<iostream.h>
 class age
 {
            private: int y,m,d;
            public :

                                    age()
                                    {
           
                                    }
                                    age(int y1,int m1,int d1)
                                    {
                                                y=y1;m=m1;d=d1;
                                    }

Do U know?


1.What is the output of this C code?
    #include <stdio.h>
    void main()
    {
        int a = 3;
        int b = ++a + a++ + --a;
        printf("Value of b is %d", b);
    }

a) Value of x is 12, b) Value of x is 13, c) Value of x is 10,  d) Undefined behavior

Do U know?



1. The data dictionary is
a. a utility program                     b. a list of database personnel
c. different from an index procedure                d. an application generator

2. Users usually retrieve information from a database using
a. FORTRAN    b. COBOL    c. SQL       d. PL/1

Do U Know?



  1. Which of the following involves context switch,
    (a) system call                                          (b) privileged instruction
    (c) floating point exception                          (d) all the above

  2. In OST, terminal emulation is done in
    (a) sessions layer                                   (b) application layer
    (c) presentation layer                             (d) transport layer

UGC NET Computer Science and Applications Paper 2 dec 2007

 1.             A box contains six red balls and four green balls. Four balls are selected at random from the box. What is the probability that two of the selected balls are red and two are green ?  
(A)3/7
(B)4/7





(C)5/7
(D)6/7





Ans A


Computer Science and Applications June 2008 Paper -2 solutions




 
1.             Which of the following does not define a tree ?

(A)        A tree is a connected acyclic graph.

(B)        A tree is a connected graph with n-1 edges where ‘n’ is the number of vertices in the graph.

(C)        A tree is an acyclic graph with n-1 edges where ‘n’ is the number of vertices in the graph.

(D)        A tree is a graph with no cycles.

2.             The complexity of Kruskal’s minimum spanning tree algorithm on a graph with ‘n’ nodes and ‘e ’ edges is :

(A)    O (n)                    (B)   O (n log n)            (C)  O (e log n)           (D)  O (e)

Print A pattern with c language



Print the following pattern with c language
                                                                     


#include<stdio.h>
#include<conio.h>

void main()
{
                         int i,n,j;
                        printf("\t enter value of n=");
                        scanf("%d",&n);

Print B patterns with C language




                                                      

#include<stdio.h>
#include<conio.h>

void main()
{
                        int i,n,j;
                        printf("\t enter value of n=");

Print C patterns with C Language




                                           
#include<stdio.h>
#include<conio.h>

void main()
{
                        int i,n,j;
                        printf("\t enter value of n=");

Print D patterns with C Language




                                                              
                                         

#include<stdio.h>
#include<conio.h>

void main()
{
                        int i,n,j;
                        printf("\t enter value of n=");
                        scanf("%d",&n);

Print E patterns with C Language





                                                                      

#include<stdio.h>
#include<conio.h>

void main()
{
                        int i,n,j;
                        printf("\t enter value of n=");
                        scanf("%d",&n);

Print F patterns with C Language





                                                 

#include<stdio.h>
#include<conio.h>

void main()
{
                        int i,n,j;
                        printf("\t enter value of n=");
                        scanf("%d",&n);