Pages

Sunday, December 19, 2010

GBTU/UPTU/MTU COMPUTER GRAPHICS & ANIMATION EXAM PAPER



Friday, December 17, 2010

GBTU/UPTU/MTU .Net framwork & C# paper (MCA-512) - UNIFIED TYPE SYSTEMS in C#

 The Unified Type System

When we define an object, we must specify its type. The type determines the kind of values the object can hold and the permissible range of those values. For example, byte is an unsigned integral type with a size of 8 bits. The definition
byte b;
declares that b can hold integral
values, but that those values must be within the range of 0 to 255. If we attempt to assign b a floating-point value:
 b = 3.14159; // compile-time error
a string value:
b = "no way"; // compile-time error
or an integer value outside its range:
b = 1024;   // compile-time error
each of those assignments is flagged as a type error by the compiler. This is true of the C# array type as well. So why is an ArrayList container able to hold objects of any type?
The reason is the unified type system. C# predefines a reference type named object. Every reference and value type—both those predefined by the language and those introduced by programmers like us—is a kind of object. This means that any type we work with can be assigned to an instance of type object. For example, given
object o;
each of the following assignments is legal:
o = 10;
o = "hello, object";
o = 3.14159;
o = new int[ 24 ];
o = new WordCount();
o = false;
We can assign any type to an ArrayList container because its elements are declared to be of type object.
object provides a fistful of public member functions. The most frequently used method isToString(), which returns a string representation of the actual type—for example,
Console.WriteLine( o.ToString() )
C# provides a "unified type system". All types — including value types — derive from the type object
It is possible to call object methods on any value, even values of "primitive" types such as int
The example

using System;
class Test
{
   static void Main() {
      Console.WriteLine(3.ToString());
   }
}
calls the object-defined ToString method on an integer literal, resulting in the output "3". The example
class Test
{
   static void Main() {
      int i = 123;
      object o = i;      // boxing
      int j = (int) o;   // unboxing
   }
}
is more interesting. An int value can be converted to object and back again to int. This example shows both boxing and unboxing. When a variable of a value type needs to be converted to a reference type, an object box is allocated to hold the value, and the value is copied into the box. Unboxing is just the opposite. When an object box is cast back to its original value type, the value is  copied out of the box and into the appropriate storage location. This type system unification provides value types with the benefits of object-ness without introducing unnecessary overhead. For programs that don't need intvalues to act like objects,  int values are simply 32-bit values. For programs that need int values to behave like objects, this  capability is available on demand. This ability to treat value types as objects bridges the gap between  value types and reference types that exists in most languages. For example, a Stack class can provide  Push and Pop methods that take and return object values.
public class Stack
{
   public object Pop() {...}
   public void Push(object o) {...}
}
Because C# has a unified type system, the Stack class can be used with elements of any type,  including value types like int.

Wednesday, September 29, 2010

.NET INTERVIEW QUESTIONS

1.        What’s the advantage of using System.Text.StringBuilder over System.String? StringBuilder is more efficient in the cases, where a lot of manipulation is done to the text. Strings are immutable, so each time it’s being operated on, a new instance is created.
2.       Can you store multiple data types in System.Array? No.
3.       What’s the difference between the System.Array.CopyTo() and System.Array.Clone()? The first one performs a deep copy of the array, the second one is shallow.
4.       How can you sort the elements of the array in descending order? By calling Sort() and then Reverse() methods.
5.        What’s the .NET datatype that allows the retrieval of data by a unique key? HashTable.
6.       What’s class SortedList underneath? A sorted HashTable.
7.        Will finally block get executed if the exception had not occurred? Yes.
8.       What’s the C# equivalent of C++ catch (…), which was a catch-all statement for any possible exception? A catch block that catches the exception of type System.Exception. You can also omit the parameter data type in this case and just write catch {}.
9.       Can multiple catch blocks be executed? No, once the proper catch code fires off, the control is transferred to the finally block (if there are any), and then whatever follows the finally block.
10.     Why is it a bad idea to throw your own exceptions? Well, if at that point you know that an error has occurred, then why not write the proper code to handle that error instead of passing a new Exception object to the catch block? Throwing your own exceptions signifies some design flaws in the project.
11.      What’s a delegate? A delegate object encapsulates a reference to a method. In C++ they were referred to as function pointers.
12.     What’s a multicast delegate? It’s a delegate that points to and eventually fires off several methods.
13.     How’s the DLL Hell problem solved in .NET? Assembly versioning allows the application to specify not only the library it needs to run (which was available under Win32), but also the version of the assembly.
14.     What are the ways to deploy an assembly? An MSI installer, a CAB archive, and XCOPY command.
15.     What’s a satellite assembly? When you write a multilingual or multi-cultural application in .NET, and want to distribute the core application separately from the localized modules, the localized assemblies that modify the core application are called satellite assemblies.
16.     What namespaces are necessary to create a localized application? System.Globalization, System.Resources.
17.     What’s the difference between // comments, /* */ comments and /// comments? Single-line, multi-line and XML documentation comments.
18.     How do you generate documentation from the C# file commented properly with a command-line compiler? Compile it with a /doc switch.
19.     What’s the difference between <c> and <code> XML documentation tag? Single line code example and multiple-line code example.
20.    Is XML case-sensitive? Yes, so <Student> and <student> are different elements.
21.     What debugging tools come with the .NET SDK? CorDBG – command-line debugger, and DbgCLR – graphic debugger. Visual Studio .NET uses the DbgCLR. To use CorDbg, you must compile the original C# file using the /debug switch.
22.    What does the This window show in the debugger? It points to the object that’s pointed to by this reference. Object’s instance data is shown.
23.    What does assert() do? In debug compilation, assert takes in a Boolean condition as a parameter, and shows the error dialog if the condition is false. The program proceeds without any interruption if the condition is true.
24.    What’s the difference between the Debug class and Trace class? Documentation looks the same. Use Debug class for debug builds, use Trace class for both debug and release builds.
25.    Why are there five tracing levels in System.Diagnostics.TraceSwitcher? The tracing dumps can be quite verbose and for some applications that are constantly running you run the risk of overloading the machine and the hard drive there. Five levels range from None to Verbose, allowing to fine-tune the tracing activities.
26.    Where is the output of TextWriterTraceListener redirected? To the Console or a text file depending on the parameter passed to the constructor.
27.    How do you debug an ASP.NET Web application? Attach the aspnet_wp.exe process to the DbgClr debugger.
28.    What are three test cases you should go through in unit testing? Positive test cases (correct data, correct output), negative test cases (broken or missing data, proper handling), exception test cases (exceptions are thrown and caught properly).
29.    Can you change the value of a variable while debugging a C# application? Yes, if you are debugging via Visual Studio.NET, just go to Immediate window.
30.    Explain the three services model (three-tier application). Presentation (UI), business (logic and underlying code) and data (from storage or other sources).
31.     What are advantages and disadvantages of Microsoft-provided data provider classes in ADO.NET? SQLServer.NET data provider is high-speed and robust, but requires SQL Server license purchased from Microsoft. OLE-DB.NET is universal for accessing other sources, like Oracle, DB2, Microsoft Access and Informix, but it’s a .NET layer on top of OLE layer, so not the fastest thing in the world. ODBC.NET is a deprecated layer provided for backward compatibility to ODBC engines.
32.    What’s the role of the DataReader class in ADO.NET connections? It returns a read-only dataset from the data source when the command is executed.
33.    What is the wildcard character in SQL? Let’s say you want to query database with LIKE for all employees whose name starts with La. The wildcard character is %, the proper query with LIKE would involve ‘La%’.
34.    Explain ACID rule of thumb for transactions. Transaction must be Atomic (it is one unit of work and does not dependent on previous and following transactions), Consistent (data is either committed or roll back, no “in-between” case where something has been updated and something hasn’t), Isolated (no transaction sees the intermediate results of the current transaction), Durable (the values persist if the data had been committed even if the system crashes right after).
35.    What connections does Microsoft SQL Server support? Windows Authentication (via Active Directory) and SQL Server authentication (via Microsoft SQL Server username and passwords).
36.    Which one is trusted and which one is untrusted? Windows Authentication is trusted because the username and password are checked with the Active Directory, the SQL Server authentication is untrusted, since SQL Server is the only verifier participating in the transaction.
37.    Why would you use untrusted verificaion? Web Services might use it, as well as non-Windows applications.
38.    What does the parameter Initial Catalog define inside Connection String? The database name to connect to.
39.    What’s the data provider name to connect to Access database? Microsoft.Access.
40.    What does Dispose method do with the connection object? Deletes it from the memory.
41.     What is a pre-requisite for connection pooling? Multiple processes must agree that they will share the same connection, where every parameter is the same, including the security settings

Monday, August 9, 2010

MOBILE COMPUTING (MCAE34) UPTU

MCA E34 Mobile Computing


Unit – I
Introduction, issues in mobile computing, overview of wireless telephony: cellular concept,
GSM: air-interface, channel structure, location management: HLR-VLR, hierarchical, handoffs,
channel allocation in cellular systems, CDMA, GPRS.


Unit - II
Wireless Networking, Wireless LAN Overview: MAC issues, IEEE 802.11, Blue Tooth,
Wireless multiple access protocols, TCP over wireless, Wireless applications, data broadcasting,
Mobile IP, WAP: Architecture, protocol stack, application environment, applications.


Unit – III
Data management issues, data replication for mobile computers, adaptive clustering for mobile
wireless networks, File system, Disconnected operations.


Unit - IV
Mobile Agents computing, security and fault tolerance, transaction processing in mobile
computing environment.

Unit – V
Adhoc networks, localization, MAC issues, Routing protocols, global state routing (GSR),
Destination sequenced distance vector routing (DSDV), Dynamic source routing (DSR), Ad Hoc
on demand distance vector routing (AODV), Temporary ordered routing algorithm (TORA),
QoS in Ad Hoc Networks, applications.


References:
1. J. Schiller, Mobile Communications, Addison Wesley.
2. Charles Perkins, Mobile IP, Addison Wesley.
3. Charles Perkins, Ad hoc Networks, Addison Wesley.
4. Upadhyaya, “Mobile Computing”, Springer

Wednesday, May 19, 2010

Padam Shri Gopal das neeraj - CHHUP-2 ASHRU BAHANE WALO...

Ye kavita humein prerit karti hai gham ke andheron se bahar nikalne ki ....
Aur is kathor yathaarth ko samajhne kee, ki sangi-sathi, sapne sab choot bhi jayein to ye jeewan phir bhi chalta rehta hai bina ruke bina thame…
----------------------------------------
Chip Chip ashru bahaane waalon (ashru-tears)
Moti vyarth lutane waalon ! (vyarth –without any purpose)
Kuch sapnon ke mar jane se jeevan nahin mara karta hai

Sapnaa kya hai ? Nayan sez par,
Soya hua aankh ka paani
Aur tootna hai uska jyon
Jage kachchi neend jawani
Geelee umar banaane walon! Doobe bina nahaane waalon
Kuch pani ke bah jane se saawan nahin mara karta hai

Mala bikhar gayi to kya hai
Khud hi hal ho gayi samasyaa (samasya-problem)
Aansoo gar neelaam huye to
Samjho poori huyi tapasyaa
Roothe divas manaane walon! Phati kameez silaane waalon! (divas-day)
Kuch deepon ke bujh jaane se aangan nahin mara karta hai

Khota kuch bhi nahin yahan par
Kewal zild badaltee pothee (pothee –book)
Jaise raat utaar chandani
Pehne subah dhoop ki dhoti
Vastra badal kar aane waalon ! Chaal badalkar jaane waalon! (vastra –cloth)
Chand Khilounon ke khone se bachpan nahin maraa karta hai

Laakhon baar gagriyaan phooteen
Shikan na aayi panghat par
Lakhon baar kishtiyaan doobeen
Chahal-pehal wo hi hai tat par (tat-beach)
Tam ki umra badhaane waalon! Lau ki aayu ghatane waalon ! (tam-darkness)
Laakh kare patjhad koshish par upvan nahin maraa kartaa hai (upvan-garden)

Loot liya maali ne upvan
Luti na lekin gandh phool ki
Toofaanon tak ne cheda par
Khidki band na huyi dhool kee
Nafrat gale lagaane waalon! Sab par dhool udaane waalon
Kuch mukhdon ki naaraazee se darpan nahin maraa karta hai

Chip Chip ashru bahaane waalon (ashru-tears)
Moti vyarth lutane waalon ! (vyarth –without any purpose)
Kuch sapnon ke mar jane se jeevan nahin mara karta hai


-Padam Shri Gopal Das 'Neeraj'

Saturday, May 1, 2010

Object Oriented Systems Sample Paper B.Tech-CS, UPTU





Object Oriented Systems Important Questions, MCA-412, Part 1


Q1. What is the java Bean? What are their advantages? What are various introspection Mechanism to inter information of a Bean? Explain with a suitable example.

Q2. Explain the following with the help of suitable example:
  1. Dynamic BillBoard Applet
  2. Lavatron Applet
  3. JDBC
  4. Java Swing
  5. Scrabblets

Q3. What is difference between AWT and Swing?

Q4. Explain any two methods available in servlet package.

Q5.  What is a java Servlet? Explain briefly the life cycle of a servlet.What are the basic steps for creating a Servlet ?

Q6. Write a java Program to create a thread that displays odd numbers starting from 1 to 100.

Q7. Write a java program to sort an array of string entered through the keyboard.

Q8. What is java Bean? What are the various steps which are needed to create a new Bean?

Q9. What do you understand by inter Thread Communication? Explain it.

Q10. Write a program to print factorial numbers.

Q11. Describe JDBC Architecture.

Q12.  Discuss the various feature of the lavatron applet and srabblet.

Q13. Discuss any six methods available in Dynamic BillBoard applet.

Q14. Explain the procedure of JDBC connectivity in java with windows database. A data of 100 students having following fields in the records is to be imported in java.
Record Structure:
        
        Name : Character Array of 100
        Address: Character Array of 200
        Roll Number : integer
        Amount Due: Float
        Marks: Integer
        Grade: Single character having values a, b, c, d, or e.
        Write a java program to import these records from windows and send to output text file.



Monday, April 19, 2010

Fetch data from MS Access using java

Database

JDBCExample


import  java.sql.*;

public class JDBCExample
{

private String url,user,pwd;
private Connection conn;
private Statement stmt;
private PreparedStatement pstmt;
private ResultSet rs;

public JDBCExample()
{
}

public void testDatabase()
{
int i=0;
String sql;

try
{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
}
catch(Exception sqe)
{
System.out.println("Error loading driver");
}
url="jdbc:odbc:emp";



pwd ="";
user="";

try
{
conn=DriverManager.getConnection(url,user,pwd);
}
catch(SQLException sqe)
{
System.out.println("Error getting connection to database");
}

try
{
stmt=conn.createStatement();
}
catch(SQLException sqee)
{
System.out.println("Error creating statement");
}

try
{
rs=stmt.executeQuery("select * from emp");
}
catch(SQLException qexe)
{
System.out.println("Error executing query");
}





/*try
{
while(rs.next())
{
int code=rs.getInt(1);
System.out.println("code="+code);
}
}

catch(SQLException e)
{
System.out.println("error to trversing");
}*/

try
{
while(rs.next())
{
String name=rs.getString(1);
int rollno=rs.getInt(2);
String add=rs.getString(3);
int phoneno=rs.getInt(4);
System.out.println("name="+name);
System.out.println("rollno="+rollno);
System.out.println("add="+add);
System.out.println("phoneno="+phoneno);
System.out.println("      ");

}


}

catch(SQLException es)
{
System.out.println("error to traversing");
}


try
{
rs.close();
conn.close();
}
catch(SQLException sqxe)
{
System.out.println("Error closing result set or connection");
}
}

public static void main(String args[])
{
JDBCExample jdbcex=new JDBCExample();
jdbcex.testDatabase();

}
}

Friday, April 16, 2010

Insert Data into Access Database using JSP

Project Tree

Database


registration.jsp

<%--
    Document   : display
    Created on : 13 Apr, 2010, 9:54:48 AM
    Author     : Bhasker
--%>
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
   "http://www.w3.org/TR/html4/loose.dtd">

<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>registration</title>
    </head>
    <body>
        <h1>registration form</h1>

        <form name="registration1" action="display.jsp" method="POST">
        <table border="1">

            <thead>
                <tr>
                    <th>enter information</th>
                    <th></th>
                </tr>
            </thead>
            <tbody>
                <tr>
                    <td>name</td>
                    <td><input type="text" name="n1" value="" size="30" /></td>
                </tr>
                <tr>
                    <td>city</td>
                    <td><input type="text" name="c1" value="" size="30" /></td>
                </tr>
                <tr>
                    <td></td>
                    <td><input type="submit" value="submit" name="b1" /></td>
                </tr>
            </tbody>
        </table>

</form>


    </body>

</html>


display.jsp

<%-- 
    Document   : display
    Created on : 14 Apr, 2010, 2:38:06 PM
    Author     : Bhasker
--%>
<%@page import ="java.sql.*"%>
<%@page import =" java.util.*"%>
<%@page import =" java. io.*"%>

<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
   "http://www.w3.org/TR/html4/loose.dtd">

<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>JSP Page</title>
    </head>
    <body>
        <h1>registration record!</h1>


        <%
              try {
            Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
           Connection con=DriverManager.getConnection("jdbc:odbc:reg");
           Statement st=con.createStatement();
           PreparedStatement pst=con.prepareStatement("insert into registration(name,city) values(?, ?)");
           pst.clearParameters();
           
           pst.setString(1,request.getParameter("n1"));
           pst.setString(2,request.getParameter("c1") );
         int i=  pst.executeUpdate();
         if(i>0)
             {
         out.println("Record Saved");

         ResultSet rs=st.executeQuery("Select * from registration");
         out.print("<br/>");

         out.print("<table border=4>");
           while(rs.next())
           {
               out.print("<tr bgcolor=pink>");
               out.print("<td>");
           out.print(rs.getString(1));
           out.print("</td>");
           out.print("<td>");
           out.print(rs.getString(2));
           out.print("</td>");
out.print("</tr>");

           }
         out.print("</table>");
         }
         else
             {out.println("Record Not Saved");}
           
      

        }
        catch(Exception e)
        {}
        finally {
            out.close();
        }

        %>

    </body>

</html>

Thursday, April 15, 2010

WAP to demonstrate database connectivity jsp with MS Access with the help of servlet.

Project Tree

index.jsp



<%-- 
    Document   : index
    Created on : Mar 23, 2010, 11:50:05 AM
    Author     : Administrator
--%>


<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
   "http://www.w3.org/TR/html4/loose.dtd">


<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>JSP Page</title>
    </head>
    <body>


        <form action="NewServlet">
            <input type="submit" value="Show Record" />
        </form>
    </body>
</html>

NewServlet.java

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */


import java.io.IOException;
import java.io.PrintWriter;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.sql.*;
/**
 *
 * @author Administrator
 */
public class NewServlet extends HttpServlet {
   
    /** 
     * Processes requests for both HTTP <code>GET</code> and <code>POST</code> methods.
     * @param request servlet request
     * @param response servlet response
     * @throws ServletException if a servlet-specific error occurs
     * @throws IOException if an I/O error occurs
     */
    protected void processRequest(HttpServletRequest request, HttpServletResponse response)
    throws ServletException, IOException {
        response.setContentType("text/html;charset=UTF-8");
        PrintWriter out = response.getWriter();
        try {
            Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
           Connection con=DriverManager.getConnection("jdbc:odbc:test");
           Statement st=con.createStatement();
           ResultSet rs=st.executeQuery("select * from employee");
           while(rs.next())
           {
           out.print(rs.getString(1));
           out.print(rs.getString(2)); 
           out.print(rs.getString(3));
         
           }

            /* TODO output your page here
            out.println("<html>");
            out.println("<head>");
            out.println("<title>Servlet NewServlet</title>");  
            out.println("</head>");
            out.println("<body>");
            out.println("<h1>Servlet NewServlet at " + request.getContextPath () + "</h1>");
            out.println("</body>");
            out.println("</html>");
            */
        }
        catch(Exception ee)
        {}
        finally {
            out.close();
        }
    } 

    // <editor-fold defaultstate="collapsed" desc="HttpServlet methods. Click on the + sign on the left to edit the code.">
    /** 
     * Handles the HTTP <code>GET</code> method.
     * @param request servlet request
     * @param response servlet response
     * @throws ServletException if a servlet-specific error occurs
     * @throws IOException if an I/O error occurs
     */
    @Override
    protected void doGet(HttpServletRequest request, HttpServletResponse response)
    throws ServletException, IOException {
        processRequest(request, response);
    } 

    /** 
     * Handles the HTTP <code>POST</code> method.
     * @param request servlet request
     * @param response servlet response
     * @throws ServletException if a servlet-specific error occurs
     * @throws IOException if an I/O error occurs
     */
    @Override
    protected void doPost(HttpServletRequest request, HttpServletResponse response)
    throws ServletException, IOException {
        processRequest(request, response);
    }

    /** 
     * Returns a short description of the servlet.
     * @return a String containing servlet description
     */
    @Override
    public String getServletInfo() {
        return "Short description";
    }// </editor-fold>

}

Followers