Interview questions for Web application developers

The following set was set in by a reader of the site:

Following are the questions from an interview I attended for in C#, ASP.NET, XML and Sql Server. I will try to add some more as soon as I recollect. Hope these questions will be useful for people attending interviews in this area.

  1. What is the maximum length of a varchar field in SQL Server?
  2. How do you define an integer in SQL Server?
  3. How do you separate business logic while creating an ASP.NET application?
  4. If there is a calendar control to be included in each page of your application, and we do not intend to use the Microsoft-provided calendar control, how do you develop it? Do you copy and paste the code into each and very page of your application?
  5. How do you debug an ASP.NET application?
  6. How do you deploy an ASP.NET application?
  7. Name a few differences between .NET application and a Java application?
  8. Specify the best ways to store variables so that we can access them in various pages of ASP.NET application?
  9. What are the XML files that are important in developing an ASP.NET application?
  10. What is XSLT and what is its use?
This entry was posted in .NET, Java. Bookmark the permalink. Post a comment or leave a trackback: Trackback URL.

15 Comments on Interview questions for Web application developers

  1. Observer
    Posted 3/17/2005 at 10:56 am | Permalink

    q1. 8000 (nvarchar = 4000)
    q2. int
    q3. use code behind (general answer)
    q4. write your own user control and either register the control page level, or load it at runtime
    q5. use vs.net to debug with breakpoints and localwatch; enable page tracing
    q6. use web setup project, or use vs.net to copy project, or just xcopy the files over
    q7. languages, .net platform specific
    q8. session, cache, application level, database, external files, viewstate, querystring
    q9. web.config is used to store info on the webapp
    q10.xslt lets you transform an xml document into a presentable format

    just a quick post

    observer*

  2. Posted 3/18/2005 at 10:41 am | Permalink

    1:
    It depends on what version of SQL Server. In 2K, it’s 8k. If you’re using nvarchars, it’s half that.

    2:
    Use the int keyword. I’m not sure what the question is asking: if you want to know what an int is defined as, it’s a 32-bit signed integer, from -(2^31 - 1) to (2^31 - 1). Adding the unsigned keyword buys you one more bit.

    3:
    Many ways. A few: 1) create tiers, but the business logic in a different tier; 2) put it in a different assembly; 3) put it in SPs. There are more, but the specific one you use should depend on your application. Each has pros and cons.

    4:
    Create a web control. If you’re using VS.NET, you’re only a few steps away from drag-and-drop into any ASP.NET page.

    5:
    VS.NET makes it easy, if you have it; just run in debug mode and you can step through your code. Otherwise, you’re doing a lot of Response.Write statements or logging to a disk, or something of that sort.

    6:
    Assuming: 1) you’ve compiled in release mode, 2) you’ve satisfied all your other procedural requirements (those depend on the group you’re working in) and, 3) there’s existing web space that’s set up correctly, copy the aspx files, then the dll files from the bin directory into a bin directory. Don’t forget any ancillary files like web.config or other configuration files you may have referred to in code. It’s really more complicated than that most of the time, but those are the general steps.

    8:
    It’s always best to assume that your target environment will one day be clustered. If it’s set up right, you should be able to use application variables. It may not be, so it’s often wise to store them externally and write access wrappers. “Externally” could mean in a DB or static files. If your application is big and hardcore, setting up a web service on a “cluster controller” to feed the cluster machines isn’t a terrible idea, either.

    9:
    Web.config is the most important. Specific configuration determines which others might be important.

    10:
    XSLT transforms XML into XML. If you have an XML data file and you need to change the variable names (e.g. — if some part of your data tier gives you XML, but in the wrong format), XSLT will give you the right XML listing. It can also be used to transform XML data into XHTML for display to the user. Some browsers will do the XML-XHTML conversion automatically, but that’s a dangerous assumption if you’re in a heterogenous environment.

    I’m not going to answer #7. There are lots of differences from the ground up. For one, you can’t compare Java to .NET. You can compare J2EE to .NET, or Java to C#. I don’t compare the languages; I just write in both. J2EE is a more defined environment, but Microsoft covers a lot of the gaps with application software. There are entire books about this, and most of them get into the religious questions.

  3. Baki
    Posted 4/17/2005 at 4:11 am | Permalink

    Ans - Q.5: To debug precompiled components such as business objects and code-behind modules, you need to generate debug symbols. To do this, compile the components with the debug flags by using either Visual Studio .NET or a command line compiler such as Csc.exe (for Microsoft Visual C# .NET) or Vbc.exe (for Microsoft Visual Visual Basic .NET).

    Using Visual Studio .NET1. Open the ASP.NET Web Application project in Visual Studio .NET.
    2. Right-click the project in the Solution Explorer and click Properties.
    3. In the Properties dialog box, click the Configuration Properties folder.
    4. In the left pane, select Build.
    5. Set Generate Debugging Information to true.
    6. Close the Properties dialog box.
    7. Right-click the project and click Build to compile the project and generate symbols (.pdb files).

  4. spandana kiran
    Posted 5/19/2005 at 5:27 am | Permalink

    1Q A. varchar maximum length=8000 (nvarchar=4000)

    2Q A. We can declare an integer as int in SQL Server

  5. vinodkumar
    Posted 7/1/2005 at 9:57 am | Permalink

    we can declare integer in sql

    Declare a as int

  6. Posted 7/22/2005 at 5:07 am | Permalink

    Marvelous job.I m really impressed.I m quite sure that u update these Q/A’s time to time as techies like me depend upon these & not only this, I cleared 5 interviews in various companies but they dont fix me up becoz i m fresher and they want experience.But i will fight if your feed me with this type of help.

  7. vipin
    Posted 7/25/2005 at 5:36 am | Permalink

    what is 5 th highest salary from employee table

  8. Karthik
    Posted 9/22/2005 at 12:44 am | Permalink

    what is 5th highest salary from employee table?

    ops$tkyte@8i> select empno, sal from emp;

    EMPNO SAL
    ———- ———-
    7369 800
    7499 1600
    7521 1250
    7566 2975
    7654 1250
    7698 2850
    7782 2450
    7788 3000
    7839 5000
    7844 1500
    7876 1100
    7900 950
    7902 3000
    7934 1300

    14 rows selected.

    ops$tkyte@8i>
    ops$tkyte@8i> select empno, sal
    2 from emp
    3 where sal = ( select min(sal)
    4 from ( select sal from emp order by sal desc )
    5 where rownum

  9. Karthik
    Posted 9/22/2005 at 12:48 am | Permalink

    oops, the last part of prev question again

    ops$tkyte@8i>
    ops$tkyte@8i> select empno, sal
    2 from emp
    3 where sal = ( select min(sal)
    4 from ( select sal from emp order by sal desc )
    5 where rownum

  10. Karthik
    Posted 9/22/2005 at 12:57 am | Permalink

    I’m getting a problem while posting the solution for the following question, so please access the url directly for the solution

    what is 5th highest salary from employee table?

    http://asktom.oracle.com/pls/ask/f?p=4950:8:::::F4950_P8_DISPLAYID:149212348066

  11. Preethi
    Posted 10/30/2005 at 12:07 am | Permalink

    You can use rank function to find highest position/salary. like rank() over order by salary. The best approach as far as i see . i learnt this in my DB class at the U
    Preethi
    MSU,Mankato.

  12. Ayman Dabees
    Posted 12/31/2005 at 4:57 pm | Permalink

    what is 5th highest salary from employee table?

    select min(salary)
    from (
    select top 5 salary
    from employees
    order by sal Desc
    )

    so simple!!! why make life complecated!!?
    cheers

    N.B using Transact-SQL

  13. satheesh
    Posted 2/22/2006 at 11:39 pm | Permalink

    General syntax for finding Nth maximum Salary…

    Select * From Employee E1 Where
    (N-1) = (Select Count(Distinct(E2.Salary)) From Employee E2 Where
    E2.Salary > E1.Salary)

    Here in this SQL N is the Nth position.

    For example if we need to fing 5th Maximum salary,The SQL will be,

    select * from Employee E1 where
    5-1=(select count(distinct(E2.Salary)) from Employee E2 where E2.salary>E1.Salary) ;

    Just try this SQL……

  14. majid
    Posted 4/7/2007 at 3:40 am | Permalink

    I think this would be the complete solution,

    Select top 1 from ( Select top 5 from employee group by salary order by salary)

    As if we have 10 employees of the same highest salary even then this query will exactly return the fifth highest salary, another thing here 5 could be replaced by n to find any nth highest salary. Here top 1 or top 5 is postfixex with salary

    Cheers

  15. Srinivas
    Posted 9/18/2008 at 8:46 am | Permalink

    All the given queries have syntactical mistakes. So, I am giving the complete query that is tried and tested using sql server.

    =========================================
    select min(salary) from employees
    where salary in
    (select top 5 salary from employees
    order by salary desc)
    =========================================

Post a Comment

Your email is never published nor shared. Required fields are marked *

*
*