0% found this document useful (0 votes)
17 views

2016 _Programming Ability -DOTNET (Event-III)

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
17 views

2016 _Programming Ability -DOTNET (Event-III)

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 6

Programming Ability (Event-III) -DOTNET

National Crime Records Bureau, East Block-7, R.K. Puram, Delhi 110066

Max Negative
SlNo Question Option A Option B Option C Option D Answer Marks Marks
You are required to print the negative number into brackets instead of <pre> if (a < 0){ <pre>if (a < 0){ <pre>if (a < 0){ All of the above D 2 0.5
minus sign (e.g., -3998 is (3998) ). Let a=-3998 Label1.Text = "(" + (a-(2*a)).ToString() + Label2.Text = "(" + Math.Abs(a).ToString() Label2.Text = a.ToString().Replace("-", "(")
")"; + ")"; + ")";
} }</pre> }</pre>
1 </pre>
Consider the following table created in MSSQL server 2008:<br/> SELECT * FROM [TblTrn_DMT] where SELECT * FROM [TblTrn_DMT] where SELECT * FROM [TblTrn_DMT] where SELECT * FROM [TblTrn_DMT] where D 4 1
TblTrn_DMT(Name, Desgnation, DateOfJoining, Remarks), all columns DateOfJoining<'04/12/2016' order by CONVERT((DateTime, DateOfJoining <='03/12/2016' order by CONVERT(DateTime, DateOfJoining,103)
having nvarchar(100) datatype. <br/>You are required to fetch records DateOfJoining DESC; DateOfJoining,108)<='03/12/2016' order CONVERT(Date, DateOfJoining,108) DESC; <= CONVERT (DateTime, '03/12/2016',103)
having DateOfJonining less than and equal to '03/12/2016'. <br/>Record by CONVERT(DateTime, ORDER BY CONVERT(DateTime,
Should be in descending order by DateOfJonining. DateOfJoining,108) DESC; DateOfJoining,103) DESC;
Which one is correct:
2
You are designing a distributed application.The application must store Session state Database storage Profile properties Application state B 2 0.5
secure information that is specific to an individual user. The data must be
automatically purged when the user logs off. You need to save transient
information in a secure data store. Which data store should you use?
3
You are developing an ASP.NET MVC application that supports multiple Gacutil.exe Al.exe Ildasm.exe nasm.exe B 2 0.5
cultures and multiple languages. The application will be sold to
international customers. The ASP.NET MVC application must store localized
content in satellite assemblies for multiple languages. You need to generate
the satellite assemblies during an automated build. <br/>Which tool should
4 you use?
ASP.NET, Consider a Table having two column namely "Name of Criminal" , <pre> <pre> <pre> <pre> C 4 1
"No of fir registered" as below <br/> Protected Sub OnRowDataBound(sender Protected Sub OnRowDataBound(sender Protected Sub OnRowDataBound(sender Protected Sub OnRowDataBound(sender
<a href="../images/TableCriminal.png" target="_blank"> As Object, e As GridViewRowEventArgs) As Object, e As GridViewRowEventArgs) As Object, e As GridViewRowEventArgs) As Object, e As GridViewRowEventArgs)
<img src="../images/TableCriminal.png" alt="TableCriminal" height="197" If e.Row.RowType = If e.Row.RowType = If e.Row.RowType =
width="337"></a><br/> Dim cell As TableCell = e.Row.Cells(1) DataControlRowType.DataRow Then DataControlRowType.DataRow Then DataControlRowType.DataRow Then
<br/> Dim quantity As Integer = Dim cell As TableCell = e.Row.Cells(1) Dim cell As TableCell = e.Row.Cells(1) Dim cell As TableCell = e.Row.Cells(1)
it is required that the this to be implementd in GridView and the column Integer.Parse(cell.Text) Dim quantity As Integer = cell.Text Dim quantity As Integer = Dim quantity As Integer = cell.Text
"No of fir registered" must have different backgroud color based on given Integer.Parse(cell.Text)
criteria. <br/> If NoOfFirReg>=0 AndAlso If NoOfFirReg>=0 AndAlso If NoOfFirReg>=0
if No of fir registred between 0-10 backgroud color of the cell must be NoOfFirReg<= 10 Then NoOfFirReg<= 10 Then If NoOfFirReg>=0 If NoOfFirReg<=10
Green <br/> cell.BackColor = Color.Green cell.BackColor = Color.Green If NoOfFirReg<=10 cell.BackColor = Color.Green
if No of fir registred between 11-15 backgroud color of the cell must be End If End If cell.BackColor = Color.Green Else
Yellow <br/> If NoOfFirReg>=11 AndAlso If NoOfFirReg>=11 AndAlso Else If NoOfFirReg<=15
if No of fir registred between 16-20 backgroud color of the cell must be Red NoOfFirReg<= 15 Then NoOfFirReg<= 15 Then If NoOfFirReg<16 cell.BackColor = Color.Yellow
<br/> cell.BackColor = Color.Yellow cell.BackColor = Color.Yellow cell.BackColor = Color.Yellow Else
<br/> End If End If Else If NoOfFirReg>=16 AndAlso
Choose the best option to do the same.<br/> If NoOfFirReg>= 16 AndAlso else If NoOfFirReg>15 AndAlso NoOfFirReg<20
NoOfFirReg<= 20 Then cell.BackColor = Color.Red NoOfFirReg<=20 cell.BackColor = Color.Red
cell.BackColor = Color.Red End If cell.BackColor = Color.Red End If
End If End Sub End If End If
</pre> End If End If
End Sub End If End If
</pre> End If End Sub
End Sub </pre>
</pre>

5
You have multiple resource files like (Resource.hi-IN.resx, Resource.en- <pre> "<%$Resources:Resource,name <pre> "<%$Resources:Resource,key <pre> "<%$Resources:Resource,<% <pre> A 4 1
GB.resx etc.). How you will access the resource to display in page column of resource file %>" </pre> column of resource file %>" </pre> Session["Culture"].key %>" </pre> "<%$Resources:Resource.Selected.key%>"
"ShowRes.aspx". <br/> Consider the following code:<br/> <a </pre>
href="../images/code.png" target="_blank">
<img src="../images/code.png" alt="database" height="500"
width="1000"></a><br/>
6
You are developing an ASP.NET MVC application. The application must Use the HttpRequest.Form property to Apply and set the Validatelnput attribute Use the HttpRequest.Unvalidated property Apply and set the CausesValidation C 2 0.5
allow users to enter HTML in a feedback text box only. You need to disable read the unvalidated form value on the controller action to FALSE to read the unvalidated form value attribute on the controller action to FALSE
7 request validation. What should you do?
Page 1 of 6 60th All India Police Durty Meet 2016, Mysuru, Karnataka
Programming Ability (Event-III) -DOTNET

National Crime Records Bureau, East Block-7, R.K. Puram, Delhi 110066

Max Negative
SlNo Question Option A Option B Option C Option D Answer Marks Marks
You are developing an ASP.NET MVC application. The application is ASP.NET session state A local database A state server Profile properties C 2 0.5
deployed in a web form and is accessed by many users. The application
must handle web server failures gracefully. The servers in the form must
share the short-term state information.You need to persist the application
state during the session. What should you implement?

8
9 Which state object accessible to any user in Web application. Session Application Response.Cookies Response.ViewState B 2 0.5
.MapPath will return Returns the Virtual Path of the web folder Maps the specified virtual path to Physical Returns the physical file path that All the above C 2 0.5
10 path corresponds to virtual specified path
<pre> sea occurs 2 times sea occurs 1 times It will not give error because rex variable None of the above A 4 1
Dim strOriginal = "She sells sea shells on the seashore" should be define as
Dim srchString As String = "sea" System.RegularExpression.Regex
Dim rex As System.Text.RegularExpressions.Regex = New
System.Text.RegularExpressions.Regex(srchString)
Dim count As Integer = rex.Matches(strOriginal).Count
Response.Write(srchString & " occurs " & count & " times")
</pre><br/>
11 What will be the output?
You have a large flat file having product name and price. which is updated you will open the file and store the you will open the file and convert into you will save the file as object in NoSql None of the above D 2 0.5
once in a day. you need to display the proudct name and price on your product list and price in static array array and assign to catelogue view database and access from there
webpage catalogue. you have two point of consideration Quick Access of
product list and second is consume least memory to implememnt it. what
method you will follow to achive this goal
12
What is the output of the short program below? <br/> <pre> <pre> <pre> <pre> A 2 0.5
<pre> Time is null Time is null null 0 Error
class Program { 1/1/0001 12:00:00 AM 1/1/0001 12:00:00 AM Error 0
static String Time; </pre> </pre> </pre> </pre>
static DateTime time;

static void Main() {


Console.WriteLine(Time == null ? "Time is null" : Time);
Console.WriteLine(time == null ? "time is null" : time.ToString());
}
}
</pre>

13
What will be the output of the code given below? <br/> 56 65 66 77 D 2 0.5
<pre>
int num = 1, z = 5;
if (!(num <= 0))
Console.WriteLine( ++num + z++ + " " + ++z ); else
Console.WriteLine( --num + z-- + " " + --z );
14 </pre>
What will be the output of the code given below? <br/> 8 4 16 12 20 4 8 12 16 20 4 8 16 32 64 2 4 6 8 10 B 2 0.5
<pre>int i, j = 1, k;
for (i = 0; i < 5; i++)
{
k = j++ + ++j;
Console.Write(k + " ");
}
15 </pre>

Page 2 of 6 60th All India Police Durty Meet 2016, Mysuru, Karnataka
Programming Ability (Event-III) -DOTNET

National Crime Records Bureau, East Block-7, R.K. Puram, Delhi 110066

Max Negative
SlNo Question Option A Option B Option C Option D Answer Marks Marks
What is the output of the following code ? <br/> HI HI HI HI Stack overflow exception Compile time error C 2 0.5
<pre> static void Main(string[] args)
{
m();
Console.ReadLine();
}
static void m()
{
Console.WriteLine("HI");
m();
}
16 </pre>
What is the recommended method for securing sensitive connection string Encrypting the data in the application Using a code obfuscator Using Integrated Security (Windows Querying the user for his or her C 2 0.5
17 information? configuration file Authentication) credentials at run time
18 How many types of authentication ASP.NET supports? Windows Authentication .NET Passport Authentication Forms Authentication All of the above D 2 0.5
What is the Correct ASP.NET page life cycle event? PreInit, Init, InitComplete, PreLoad, Load, PreInit, Init, InitComplete, PreLoad, Load, PreInit, Init, InitComplete, PreLoad, Load, PreInit, Init, InitComplete, PreLoad, Load, A 2 0.5
LoadComplete, PreRender, LoadComplete, PreRender, LoadComplete, PreRender, LoadComplete, PreRender,
PreRenderComplete, SaveStateComplete, PreRenderComplete, SaveStateComplete, PreRenderComplete, SaveState, PreRenderComplete, SaveState, Render,
Render, Unload RenderComplete, Unload RenderComplete, Unload UnloadComplete
19
You are developing a Web page that contains many validated controls. You <br/>1. Set the Text property of the <br/>1. Set the ErrorMessage property of <br/>1. Set the ToolTip property of the None of the above B 4 1
want to provide a detailed message for each validation error, but the page validator control to the detailed message. the validator control to the detailed validator control to the detailed message.
doesn’t have sufficient space to provide the detailed message next to each <br/>2. Set the ErrorMessage property to message. <br/> 2. Set the Text property to <br/> 2. Set the ErrorMessage property to
control. What can you do to indicate an error at the control and list the an asterisk (*). <br/> 3. Place a an asterisk (*). <br/> 3. Place a an asterisk (*). <br/> 3. Place a
detailed error messages at the top of the Web page? ValidationSummary control at the top of ValidationSummary control at the top of ValidationSummary control at the top of
the Web page. the Web page. the Web page.<br/>
20
21 How many types of caching ASP.NET supports? Page Output Caching Partial Page Caching DataSource Caching All of the above D 2 0.5
22 Application_Start event is available in which file? App_Code Global.asax Web.config ASP Configuration file B 2 0.5
Identify the type of sorting code below?<br/> Insertion Sort Merge Sort Radix Sort Bubble Sort D 2 0.5
<pre>func sort( var a as array )
for i from 1 to N
for j from 0 to N - 1
if a[j] > a[j + 1]
swap( a[j], a[j + 1] )
23 end func</pre>
24 Which property causes a control to fire an event server side? EnableViewState AutoPostBack RunAtServer All of the above B 2 0.5
25 Which of the following is the DML operation ExecuteReader() ExecuteScalar() ExecuteNonQuery() ExecuteQuery() C 2 0.5
Which of the following statements are correct about JIT? <br/> 1, 2, 3 1, 3, 4 1,2 5 A 2 0.5
1. JIT compiler compiles instructions into machine code at run time. <br/>
2. The code compiler by the JIT compiler runs under CLR. <br/>
3. The instructions compiled by JIT compilers are written in native code.
<br/>
4. The instructions compiled by JIT compilers are written in Intermediate
Language (IL) code. <br/>
5. The method is JIT compiled even if it is not called
26
What events are fired after a page has been posted back.? Page_Init, Page_Load Page_PreInit, Page_PreLoad, Page_Init, Page_PreInit, Page_PreLoad All of the above A 2 0.5
27 Page_Load
Correct way of display string below<br/> Response.Output.Write("Hello From {0} on Response.Write("Hello From {0} on {1:d}", Response.String.Write("Hello From {0} on Response.Stream.Write("Hello From {0} on A 2 0.5
Hello From NCRB on 12/21/2016 (assume it as current date<br/> {1:d}", "NCRB", DateTime.Now) "NCRB", DateTime.Now) {1:d}", "NCRB", DateTime.Now) {1:d}", "NCRB", DateTime.Now)
28

Page 3 of 6 60th All India Police Durty Meet 2016, Mysuru, Karnataka
Programming Ability (Event-III) -DOTNET

National Crime Records Bureau, East Block-7, R.K. Puram, Delhi 110066

Max Negative
SlNo Question Option A Option B Option C Option D Answer Marks Marks
C 4 1
Consider the following database for IO's to maintain a checklist against a
particular FIR.<br/>
The database maintains tasks which have been completed(checked) and
which are incomplete(unchecked).<br/> <pre> <pre>
It is having two masters and two transactional tables.<br/> select a.checkName, b.offence_id, <pre> select a.checkName, b.offence_id, <pre>
Find <q>checkName</q>, <q>offenc_id</q> and <q>firno_id</q> of b.firNo_id from m_offence a select a.checkName, b.offence_id, b.firNo_id from m_offence a select a.checkName, b.offence_id,
checked and unchecked <q>checkNames</q> of body right outer join b.firNo_id from m_offence a left outer join b.firNo_id from m_offence a
offence(<q>offenceType_id</q>=601) regarding fir#123/16 as shown in (select * from t_checkedOffence right outer join (select * from t_checkedOffence join
output table <br/><a href="../images/database.jpg" target="_blank"> where firNo_id= (select id from t_fir (select * from t_checkedOffence where firNo_id= (select id from t_fir (select * from t_checkedOffence
<img src="../images/database.jpg" alt="database" height="500" where firNo='123/16') where firNo_id= (select id from t_fir where firNo='123/16') where id= (select id from t_fir where
width="700"></a><br/> OR firNo_id IS NULL ) b where firNo='123/16')) b OR firNo_id IS NULL ) b firNo='123/16')) b
Which of following SQL Statement produces output as shown in Desired on a.id=b.offence_id on a.id=b.offence_id on a.id=b.offence_id on a.id=b.offence_id
output. where offenceType_id=601 where offenceType_id=601 where offenceType_id=601 where offenceType_id=601
29 </pre> </pre> </pre> </pre>
Consider the following database for IO's to maintain a checklist against a C 4 1
particular FIR.<br/>
The database maintains tasks which have been completed(checked) and
which are incomplete(unchecked).<br/> <pre>
It is having two masters and two transactional tables.<br/> <pre> select a.checkName, b.firNo select a.checkName, b.firNo
from m_offence a left outer join from m_offence a
<a href="../images/database1.png" target="_blank"> t_checkedOffence c on a.id=c.offence_id left outer join t_fir b on <pre>select a.checkName, b.firNo
<img src="../images/database1.png" alt="database1" height="317" inner join t_fir b on c.firNo_id=b.id a.id=b.offenceType_id from m_offence a,t_fir
width="742"></a><br/> inner join m_offencetype d on join t_checkedOffence c on c.firNo_id=b.id b,t_checkedOffence c
A officer wants to check whether <q>Spot verification</q> of Fir #123/16 d.id=c.offence_id where a.checkName='Spot verification' where a.checkName='Spot verification'
has been done or not. Find out which of the following SQL query correctly where a.checkName='Spot verification' and b.firNo='123/16'; and a.id=c.offence_id and c.firNo_id=b.id
30 evaluates this. and b.firNo='123/16'; </pre> </pre> and b.firNo='123/16'; </pre> None of the above
D 4 1
Consider the following database for IO's to maintain a checklist against a
particular FIR.<br/>
The database maintains tasks which have been completed(checked) and
which are incomplete(unchecked).<br/>
It is having two masters and two transactional tables.<br/> <pre>select count(a.offence_id), b.firNo <pre>select count(a.offence_id), b.firNo <pre>
<a href="../images/database1.png" target="_blank"> <pre>select count(a.offence_id), b.firNo from t_checkedOffence a right outer join from t_checkedOffence a,t_fir select count(a.offence_id), b.firNo
<img src="../images/database1.png" alt="database1" height="317" from t_checkedOffence a,t_fir t_fir b on a.firNo_id=b.id right outer join b,m_offenceType c where a.firNo_id=b.id from t_checkedOffence a,t_fir
width="742"></a> <br/> b,m_offenceType c where a.firNo_id=b.id m_offenceType c on and c.id=b.offenceType_id and b,m_offenceType c where a.firNo_id=b.id
<p>Find no. of checks that have been done in each fir with offence type is and c.id=b.offenceType_id c.id=b.offenceType_id c.name='Body Offence' group by and c.id=b.offenceType_id and
<q>Body Offence</q> in ascending order by <q>firNo</q>. Which of the group by b.firNo having c.id='Body group by b.firNo having c.id='Body b.firNo,a.offence_id order by b.firNo c.name='Body Offence'group by b.firNo
31 following query will produce the desired result. </p> Offence' order by b.firNo asc</pre> Offence' order by b.firNo asc </pre> asc</pre> order by b.firNo</pre>
Types of Garbage Collector in VB.NET are Generation 0 ,Generation 1 <pre>1. Generation 0 – This identifies a <pre>1. Generation 0 – This identifies an <pre>1. Generation 0 – This identifies an <pre>1. Generation 0 – This identifies a A 4 1
,Generation 2 newly created object that has been never object which has been marked as object that has survived more than one newly created object that has been never
Which option is correct marked for collection. collection but not removed. sweep of the Garbage collector. marked for collection.
2. Generation 1 – This identifies an object 2. Generation 1 – This identifies a newly 2. Generation 1 – This identifies an object 2. Generation 1 – This identifies an object
which has been marked as collection but created object that has been never which has been marked as collection but that has survived more than one sweep of
not removed. marked for collection. not removed. the Garbage collector.
3. Generation 2 – This identifies an object 3. Generation 2 – This identifies an object 3. Generation 2 – This identifies a newly 3. Generation 2 – This identifies an object
that has survived more than one sweep of that has survived more than one sweep of created object that has been never which has been marked as collection but
the Garbage collector.</pre> the Garbage collector.</pre> marked for collection.</pre> not removed.</pre>
32
Choose correct option<br/> 1&2 1&3 3&4 3&2 A 2 0.5
1) In VB.NET Optional Parameters are accepted but In C# Optional
Parameters are not accepted <br/>
2) VB.NET is Case Insensitive but C# is Case Sensitive <br/>
3) VB.NET and C# both Case Sensitive <br/>
4) In C# Optional Parameters are accepted but In VB.NET Optional
33 Parameters are not accepted
C 2 0.5
map the content of a file to the physical map the content of a file to both physical map the content of a file to the logical
34 Memory-mapped files (MMFs) in Microsoft .NET allows address of an application & logical address of an application address of an application None of the above

Page 4 of 6 60th All India Police Durty Meet 2016, Mysuru, Karnataka
Programming Ability (Event-III) -DOTNET

National Crime Records Bureau, East Block-7, R.K. Puram, Delhi 110066

Max Negative
SlNo Question Option A Option B Option C Option D Answer Marks Marks
Identify the flow chart <br/> <a href="../images/flowchar1.png" D 2 0.5
target="_blank"><img src="../images/flowchar1.png" alt="Flow Chart"
35 height="550" width="500"></a> Binomial Armstrong Palindrome Number Factorial
A 4 1

Choose Correct option <br/> <a href="../images/FourFlowChart.png"


target="_blank"><img src="../images/FourFlowChart.png" alt="Flow Chart"
height="600" width="800"></a><br/>
NOTE:<br/> 1. An Armstrong number of three digits is an integer such that
the sum of the cubes of its digits is equal to the number itself. For example,
371 is an Armstrong number since 3^3 + 7^3 + 1^3 = 371.<br/>
2. Fibonacci is a series of numbers in which each number ( Fibonacci
number ) is the sum of the two preceding numbers. The simplest is the
series 1, 1, 2, 3, 5, 8, etc <br/>
3. A palindromic number or numeral palindrome is a number that remains FC1=Armstrong, FC2=Binary Search, FC1=Palindrome, FC2=Binary Search, FC1=Armstrong, FC2=Binary Search, FC1=Fibonacci, FC2=Binary Search,
36 the same when its digits are reversed. Like 16461 FC3=Fibonacci, FC4=Palindrome FC3=Fibonacci, FC4=Armstrong FC3=Palindrome, FC4=Fibonacci FC3=Armstrong,FC4=Palindrome
Find the output of the following code if x=10. A 2 0.5
<pre>
int sum(int x)
{
if (x >= 1) return x+sum(x-1); else return 0;
}
37 </pre> 55 56 Compiler Error Stack over flow
Which control works as a navigator to display a large amount of D 2 0.5
38 information or for visual adjustment of numeric setting wheelman control Navigator control sliding control TrackBar control
What is the name of ASP.NET control in given picture <br/> <a C 2 0.5
href="../images/breadcrumb.png" target="_blank"><img
src="../images/breadcrumb.png" alt="Flow Chart" height="130"
39 width="600"></a> Breadcrumb Control Navigator Control SiteMapPath Control HorizontalTree Control
B 2 0.5
The copy() method copies only the The Clone() method copies only the
structure of a DataSet. The Clone() method structure of a DataSet. The copied Both Copy() and Clone() methods copies
copies structure includes all the relation, structure includes all the relation, structure includes all the relation,
What is the difference between the Clone() and Copy() methods of the constraint, and DataTable schemas used constraint, and DataTable schemas used constraint, and DataTable schemas used Both Copy() and Clone() methods copies
40 DataSet class? by the DataSet by the DataSet by the DataSet only structure of the DataSet

breadcrumb.png
FourFlowChart.png

database.jpg

Page 5 of 6 60th All India Police Durty Meet 2016, Mysuru, Karnataka
Programming Ability (Event-III) -DOTNET

National Crime Records Bureau, East Block-7, R.K. Puram, Delhi 110066

Max Negative
SlNo Question Option A Option B Option C Option D Answer Marks Marks

flowchart1.png

database1.png

Page 6 of 6 60th All India Police Durty Meet 2016, Mysuru, Karnataka

You might also like