Friday 11 November 2011

SQL Basic Interview Questions


1)  What does SQL stand for?
       a) Strong Question Language
       b) Structured Question Language
       c)   Structured Query Language - correct answer



2) Which SQL statement is used to extract data from a database?
       a) GET
       b) OPEN
       c) EXTRACT
       d)   SELECT - correct answer
       e) QUERY



3) Which SQL statement is used to update data in a database?
       a)   UPDATE - correct answer
       b) SAVE AS
       c) MODIFY
       d) SAVE



4) Which SQL statement is used to delete data from a database?
       a) TRUNCATE
       b)   DELETE - correct answer
       c) REMOVE



5) Which SQL statement is used to insert new data in a database?
       a) ADD RECORD
       b) ADD INTO
       c)   INSERT - correct answer
       d) ADD NEW



6) With SQL, how do you select a column named "FirstName" from a table named "Persons"?
       a) EXTRACT FirstName FROM Persons
       b)   SELECT FirstName FROM Persons - correct answer
       c) SELECT Persons.FirstName



7) With SQL, how do you select all the columns from a table named "Persons"?
       a) SELECT [all] FROM Persons
       b) SELECT All Persons
       c) SELECT *.Persons
       d)   SELECT * FROM Persons - correct answer



8) With SQL, how do you select all the records from a table named "Persons" where the value of the column "FirstName" is "Peter"?
       a) SELECT [all] FROM Persons WHERE FirstName='Peter'
       b) SELECT * FROM Persons WHERE FirstName LIKE 'Peter'
       c) SELECT [all] FROM Persons WHERE FirstName LIKE 'Peter'
       d)   SELECT * FROM Persons WHERE FirstName='Peter' - correct answer



9) With SQL, how do you select all the records from a table named "Persons" where the value of the column "FirstName" starts with an "a"?
       a) SELECT * FROM Persons WHERE FirstName='%a%'
       b) SELECT * FROM Persons WHERE FirstName LIKE '%a'
       c) SELECT * FROM Persons WHERE FirstName='a'
       d)   SELECT * FROM Persons WHERE FirstName LIKE 'a%' - correct answer
       e) SELECT * FROM Persons WHERE FirstName='a'"



10) The OR operator displays a record if ANY conditions listed are true. The AND operator displays a record if ALL of the conditions listed are true
       a)   True - correct answer
       b) False



11) With SQL, how do you select all the records from a table named "Persons" where the "FirstName" is "Peter" and the "LastName" is "Jackson"?
       a) SELECT * FROM Persons WHERE FirstName LIKE 'Peter' AND LastName LIKE 'Jackson'
       b)   SELECT * FROM Persons WHERE FirstName='Peter' AND LastName='Jackson' - correct answer
       c) SELECT FirstName='Peter', LastName='Jackson' FROM Persons



12) With SQL, how do you select all the records from a table named "Persons" where the "LastName" is alphabetically between (and including) "Hansen" and "Pettersen"?
       a) SELECT LastName>'Hansen' AND LastName<'Pettersen' FROM Persons
       b)   SELECT * FROM Persons WHERE LastName BETWEEN 'Hansen' AND 'Pettersen' - correct answer
       c) SELECT * FROM Persons WHERE LastName>'Hansen' AND LastName<'Pettersen'



13) Which SQL statement is used to return only different values?
       a) SELECT UNIQUE
       b) SELECT INDENTITY
       c) SELECT DIFFERENT
       d)   SELECT DISTINCT - correct answer



14) Which SQL keyword is used to sort the result-set?
       a)   SORT BY
       b) ORDER
       c) ORDER BY - correct answer
       d) SORT



15) With SQL, how can you return all the records from a table named "Persons" sorted descending by "FirstName"?
       a) SELECT * FROM Persons SORT BY 'FirstName' DESC
       b)   SELECT * FROM Persons ORDER BY FirstName DESC - correct answer
       c) SELECT * FROM Persons ORDER FirstName DESC
       d) SELECT * FROM Persons SORT 'FirstName' DESC



16) With SQL, how can you insert a new record into the "Persons" table?
       a)   INSERT INTO Persons VALUES ('Jimmy', 'Jackson') - correct answer
       b) INSERT ('Jimmy', 'Jackson') INTO Persons
       c) INSERT VALUES ('Jimmy', 'Jackson') INTO Persons



17) With SQL, how can you insert "Olsen" as the "LastName" in the "Persons" table?
       a)    INSERT INTO Persons (LastName) VALUES ('Olsen') - correct answer
       b) INSERT ('Olsen') INTO Persons (LastName)
       c) INSERT INTO Persons ('Olsen') INTO LastName



18) How can you change "Hansen" into "Nilsen" in the "LastName" column in the Persons table?
       a) UPDATE Persons SET LastName='Hansen' INTO LastName='Nilsen'
       b)   UPDATE Persons SET LastName='Nilsen' WHERE LastName='Hansen' - correct answer
       c) MODIFY Persons SET LastName='Hansen' INTO LastName='Nilsen
       d) MODIFY Persons SET LastName='Nilsen' WHERE LastName='Hansen'



19) With SQL, how can you delete the records where the "FirstName" is "Peter" in the Persons Table?
       a)   DELETE FROM Persons WHERE FirstName = 'Peter' - correct answer
       b) DELETE ROW FirstName='Peter' FROM Persons
       c) DELETE FirstName='Peter' FROM Persons



20) With SQL, how can you return the number of records in the "Persons" table?
       a) SELECT COLUMNS() FROM Persons
       b)   SELECT COUNT(*) FROM Persons - correct answer
       c) SELECT COLUMNS(*) FROM Persons
       d) SELECT COUNT() FROM Persons



21) Given an employees table as follows: empid name managerid a1 bob NULL b1 jim a1 B2 tom a1 What value will select count(*) from employees return?
       a) 1
       b) 2
       c)   3 - correct answer
       d) none of the above



22) The result of a SELECT statement can contain duplicate rows.
       a)   True - correct answer
       b) False



23) Sometimes the expression "select count(*)" will return fewer rows than the expression "select count(value)".
       a) True
       b)   False - correct answer



24) What type of lock will deny users any access to a table?
       a) EXPLICIT
       b) IMPLICIT
       c) EXCLUSIVE - correct answer
       d) SHARED
       e)   READ ONLY



25) Which of the following is the correct SQL statement to use to remove rows from a table?
       a)   DROP
       b) REMOVE ROW
       c) DELETE - correct answer
       d) DELETE ROW



26) The only way to join two tables is by using standard, ANSI syntax.
       a) True
       b)   False - correct answer



27) A NULL value is treated as a blank or 0.
       a) True
       b)   False - correct answer



28) The left outer join is one type of outer join. Another one is the.
       a) right
       b) full
       c) right outer
       d) full outer
       e)   all of the above - correct answer

ASP.NET Basic Interview Questions


1) Which of the following languages can be used to write server side scripting in ASP.NET?
       a) C-sharp
       b) VB
       c) C++
       d)   a and b - correct answer



2) When an .aspx page is requested from the web server, the out put will be rendered to browser in following format.
       a)   HTML - correct answer
       b) XML
       c) WML
       d) JSP



3) The Asp.net server control, which provides an alternative way of displaying text on web page, is
       a)   < asp:label > - correct answer
       b) < asp:listitem >
       c) < asp:button >



4) The first event to be triggered in an aspx page is.
       a) Page_Load()
       b)   Page_Init() - correct answer
       c) Page_click()



5) Postback occurs in which of the following forms.
       a) Winforms
       b) HTMLForms
       c)   Webforms - correct answer



6) What namespace does the Web page belong in the .NET Framework class hierarchy?
       a)   System.web.UI.Page - correct answer
       b) System.Windows.Page
       c) System.Web.page



7) Which method do you invoke on the Data Adapter control to load your generated dataset?
       a)   Fill( ) - correct answer
       b) ExecuteQuery( )
       c) Read( )



8) How do you register a user control?
       a) Add Tag prefix, Tag name
       b) Add Source, Tag prefix
       c)   Add Src, Tagprefix, Tagname - correct answer



9) Which of the following is true?
       a) User controls are displayed correctly in the Visual Studio .NET Designer
       b)   Custom controls are displayed correctly in VS.Net Designer - correct
       c) User and Custom controls are displayed correctly in the Visual Studio .NET Designer.



10) To add a custom control to a Web form we have to register with.
       a) TagPrefix
       b) Name space of the dll that is referenced
       c) Assemblyname
       d)    All of the above - correct answer



11) Custom Controls are derived from which of the classes
       a) System.Web.UI.Webcontrol
       b) System.Web.UI.Customcontrol
       c)   System.Web.UI.Customcontrols.Webcontrol - correct answer



12) How ASP.Net Different from classic ASP?
       a) Scripting is separated from the HTML, Code is interpreted seperately
       b)   Scripting is separated from the HTML, Code is compiled as a DLL, the DLLs can be executed on server - correct answer
       c) Code is separated from the HTML and interpreted Code is interpreted separately



13) What's the difference between Response.Write() andResponse.Output.Write()?
       a) Response.Output.Write() allows you to flush output
       b) Response.Output.Write() allows you to buffer output
       c)   Response.Output.Write() allows you to write formatted output - correct answer
       d) Response.Output.Write() allows you to stream output



14) Why is Global.asax is used?
       a) Implement application and session level events - correct answer
       b)   Declare Global variables
       c) No use



15) There can be more than 1 machine.config file in a system
       a) True - correct answer
       b)   False



16) What is the extension of a web user control file?
       a) .Asmx
       b)   .Ascx - correct answer
       c) .Aspx



17) Which of the following is true?
       a)   IsPostBack is a method of System.UI.Web.Page class
       b) IsPostBack is a method of System.Web.UI.Page class
       c) IsPostBack is a readonly property of System.Web.UI.Page class - correct answer



18) The number of forms that can be added to a aspx page is.
       a)   1 - correct answer
       b) 2
       c) 3
       d) More than 3



19) How do you manage states in asp.net application
       a) Session Objects
       b) Application Objects
       c) Viewstate
       d)   All of the above - correct answer



20) Which property of the session object is used to set the local identifier?
       a)   SessionId
       b) LCID - correct answer
       c) Item
       d) Key



21) Select the caching type supported by ASP.Net
       a) Output Caching
       b) DataCaching
       c)   a and b - correct answer
       d) none of the above



22) Where is the default Session data is stored in ASP.Net?
       a) InProcess - correct answer
       b) StateServer
       c) Session Object
       d)   al of the above



23) Select the type Processing model that asp.net simulate
       a)   Event-driven - correct answer
       b) Static
       c) Linear
       d) Topdown



24) Does the EnableViewState allows the page to save the users input on a form?
       a)   Yes - correct answer
       b) No



25) Which DLL translate XML to SQL in IIS?
       a)   SQLISAPI.dll - correct answer
       b) SQLXML.dll
       c) LISXML.dll
       d) SQLIIS.dll



26) What is the maximum number of cookies that can be allowed to a web site?
       a) 1
       b) 10
       c) 20 - correct answer
       d)   More than 30



27) Select the control which does not have any visible interface.
       a) Datalist
       b) DropdownList
       c)   Repeater - correct answer
       d) Datagrid



28) How do you explicitly kill a user session?
       a) Session.Close( )
       b) Session.Discard( )
       c)   Session.Abandon - correct answer
       d) Session.End
       e) Session.Exit



29) Which of the following is not a member of ADODBCommand object?
       a) ExecuteReader
       b) ExecuteScalar
       c) ExecuteStream
       d)   Open - correct answer
       e) CommandText



30) Which one of the following namespaces contains the definition for IdbConnection?
       a) System.Data.Interfaces
       b) System.Data.Common
       c) System.Data - correct answer
       d)   System.Data.Connection