1. How will you count the odd numbers from the array shown below using LINQ in .Net framework 4.0?
int[]numbers={5,4,1,3,9,8,6,7,2,0};
Answers:
Answers:
namespace ExtensionMethods
{
public static class NumericExtensionMethods
{
public static bool IsNumeric(this string s)
{
float output;
return float.TryParse(s, out output);
}
}
}
After adding the namespace, how will you call the ExtensionMethod on the string if your string variable is defined as:
string test=”4″;
Answers:
Answers:
int[] source = { 7, 4, 1, 3, 9, 8, 6, 7, 2, 1, 8, 15, 8, 23}
and sort the elements in descending order using LINQ in .Net framework 4.0. Which of the following statements can you use?
Answers:
Answers:
Answers:
Answers:
Answers:
var scoreRecords = new[] { new {Name = “Alice”, Score = 50},
new {Name = “Bob” , Score = 40},
new {Name = “Cathy”, Score = 45}
};
var scoreRecordsDict = scoreRecords.ToDictionary(sr =>sr.Name);
Response.Write(scoreRecordsDict[“Bob”]);
Answers:
Answers:
Suppose you have a GridView with paging enabled. You select the third row on page 1 and then move to page 2. Nothing is selected on page 2. When you move back to page 1, the third row should still be selected.
Answers:
Answers:
Answers:
Answers:
Answers:
http://examples.svc/Products?$skip=2&$top=2&$orderby=Rating
Answers:
object[] varnumbers = { null, 1.0, “two”, 3, “four”, 5, “six”, 7.0 };
var doubles = varnumbers.OfType<double>();
foreach (var d in doubles)
{
Response.Write(d);
}
Answers:
Answers:
Answers:
Answers:
Answers:
Answers:
Answers:
Answers:
Answers:
Answers:
Which of the following method will you add to the CodeBehind file of Index.aspx that will send requests (including search engine requests) to Default.aspx in .Net framework 4.0?
Answers:
Answers:
Answers:
List<string> alphabets = new List<string>() { “whats”, “new”, “in”, “aspnet” };
var alphabetsquery = from alphabet in alphabets select alphabet.Substring(0, 1);
foreach (var alpha in alphabetsquery)
{
Response.Write(alpha);
}
Answers:
Answers:
int[]numbers={5,4,1,3,9,8,6,7,2,0};
Answers:
- int findoddNumbers = numbers.Count(n => n % 2 == 1);
- int findoddNumbers = numbers.Count( n % 2 == 1);
- int findoddNumbers = (from number in numbers where numbers%2==1 select Count());
- int findoddNumbers = (from number in numbers where number%2==1 select numbers).Count();
Answers:
- HtmlMeta meta2 = new HtmlMeta(); meta2.Name = “description”; meta2.Content = “add meta description”; Page.Header.Controls.Add(HtmlMeta );
- Page.MetaDescription
- Both a and b are correct.
- None of the above.
namespace ExtensionMethods
{
public static class NumericExtensionMethods
{
public static bool IsNumeric(this string s)
{
float output;
return float.TryParse(s, out output);
}
}
}
After adding the namespace, how will you call the ExtensionMethod on the string if your string variable is defined as:
string test=”4″;
Answers:
- test.IsNumeric();
- ExtensionMethods.NumericExtensionMethods.IsNumeric();
- NumericExtensionMethods m = new NumericExtensionMethods(); m.IsNumeric(test);
- None of the above
Answers:
- Using System.Windows.Data namespace, you can integrate rich media, including drawings, text, and audio/video content in Windows Presentation Foundation applications.
- It contains classes used for binding properties to data sources, data source provider classes, and data-specific implementations of collections and views.
- It provides the types that support navigation, including navigating between windows and navigation journaling.
- It contains classes for creating windows-based applications that take full advantage of the rich user interface features available in the Microsoft Windows operating system.
int[] source = { 7, 4, 1, 3, 9, 8, 6, 7, 2, 1, 8, 15, 8, 23}
and sort the elements in descending order using LINQ in .Net framework 4.0. Which of the following statements can you use?
Answers:
- var result = (from s in source orderby s select distinct s).Descending();
- var result = (from s in source orderby s descending select s).Distinct();
- var result = select distinct s from s in source sortby s descending;
- var result = from s in source orderby s descending group p by s select s;
Answers:
- HitTestResult
- Visual
- Colors
- Brush
Answers:
- It is used to match the incoming requests and to map them to a controller action.
- It is used to construct the outgoing URLs which correspond to controller actions.
- Both a and b are correct.
Answers:
- LinqDataSource
- XmlDataSource
- AccessDataSource
- EntityDataSource
- All of the above are valid data sources
Answers:
- It is a secure and interoperable binding that is suitable for non-duplex service contracts.
- It is a secure and interoperable binding that is suitable for duplex service contracts or communication through SOAP intermediaries.
- It is a secure and optimized binding suitable for cross-machine communication between WCF applications.
- It is a queued binding that is suitable for cross-machine communication between WCF applications.
var scoreRecords = new[] { new {Name = “Alice”, Score = 50},
new {Name = “Bob” , Score = 40},
new {Name = “Cathy”, Score = 45}
};
var scoreRecordsDict = scoreRecords.ToDictionary(sr =>sr.Name);
Response.Write(scoreRecordsDict[“Bob”]);
Answers:
- { Name = Bob}
- { Name = Bob, Score = 40 }<
- Name = Bob
- None of the above
Answers:
- <httpModules maxRequestPathLength=”260″ maxQueryStringLength=”2048″ />
- <httpRuntime maxRequestPathLength=”260″ maxQueryStringLength=”2048″ />
- <httpHandlers maxRequestPathLength=”260″ maxQueryStringLength=”2048″ />
- None of the above
Suppose you have a GridView with paging enabled. You select the third row on page 1 and then move to page 2. Nothing is selected on page 2. When you move back to page 1, the third row should still be selected.
Answers:
- Set the GridView DataKeyNames property.
- Set the GridView EnablePersistedSelection property to true.
- Set the Gridview PagerSettings-Mode property.
- It is not possible to implement the given logic for the scenario described above.
Answers:
- This event is first raised on the root, then on each element down the tree until the source element is reached.
- This event is only raised on the source element. It will have the same behavior as a plain .NET event, except that such events can still participate in mechanisms specific to routed events such as event triggers.
- This event is first raised on the source element, then on each element up the tree until the root is reached.
- None of the above.
Answers:
- 5
- 12
- 20
- infinite
Answers:
- $top
- $filter
- $select
- $expand
Answers:
- Check IntPtr.Size property for a value of 8.
- Call the Environment.GetEnvironmentVariable method and pass in the string “Platform” as an argument. Check for a return value of “x64”.
- Call the WOW64 emulator method Isx64() and check the boolean return value.
http://examples.svc/Products?$skip=2&$top=2&$orderby=Rating
Answers:
- The response will be the first two product entries from the collection of all products after sorting the collection in descending order of Rating.
- The response will be the third and fourth product entries from the collection of all products after sorting the collection in ascending order of Rating.
- The response will be the second and third product entries from the collection of all products after sorting the collection in descending order of Rating.
object[] varnumbers = { null, 1.0, “two”, 3, “four”, 5, “six”, 7.0 };
var doubles = varnumbers.OfType<double>();
foreach (var d in doubles)
{
Response.Write(d);
}
Answers:
- 1, 7
- null
- two, four, six
- null, 1.0, “two”, 3, “four”, 5, “six”, 7.0
Answers:
- System.Web.Mvc
- System.Web.Mvc.Async
- System.Web.Mvc.Html
- System.Web.Mvc.Sync
Answers:
- It defines the common types that are supported by the languages which are compatible with the .Net framework.
- It represents the data types of different languages in a specific format specification.
- It is a programming language that manages the execution of programs written in any of several supported languages, allowing them to share common object-oriented classes written in any of the languages.
- It is a runtime environment that adds a set of services for dynamic languages to the common language runtime.
Answers:
- XAML
- SOAP
- Atom
- WSDL
Answers:
- Only a
- Only b
- Both a and b
Answers:
- It is an integer value that indicates the maximum number of times to retry delivery of a message from the application queue to the application.
- It is an integer value that indicates the maximum number of retry cycles.
- It is the time delay between retry cycles.
Answers:
- Readability
- Modifiability
- Category
- Both a and b
- All of the above are Localizability attributes
Answers:
- SearchExpression
- RangeExpression
- OrderByExpression
- All of the above are valid QueryExtender filter options
Answers:
- They define, for each parameter or return type, what data is serialized to be exchanged..
- They define which operations the client can perform on the service.
- They define which errors are raised by the service, and how the service handles and propagates errors to its clients.
Answers:
- The grouping of operations in a service.
- The location of the operations.
- The specific protocols and serialization formats that are used to support successful communication with the service.
- All of the above.
Which of the following method will you add to the CodeBehind file of Index.aspx that will send requests (including search engine requests) to Default.aspx in .Net framework 4.0?
Answers:
- Server.Transfer
- Response.Redirect
- Response.RedirectPermanent
- Server.Execute
Answers:
- <%: ViewData[“CurrentTime”] %>
- <%=ViewData[“CurrentTime”] %>
- %ViewData[“CurrentTime”] %
- <ViewData[“CurrentTime”] >
Answers:
- Using ViewData
- Using ViewState
- Using Sessions
- Using Cookies
List<string> alphabets = new List<string>() { “whats”, “new”, “in”, “aspnet” };
var alphabetsquery = from alphabet in alphabets select alphabet.Substring(0, 1);
foreach (var alpha in alphabetsquery)
{
Response.Write(alpha);
}
Answers:
- wnia
- whats
- whatsnewinaspnet
- aspnetinnewwhats
Answers:
- It is used to add functional handles to elements or provide state information about a control.
- It is the base class for elements that apply effects onto or around a single child element, such as Border or Viewbox.
- It provides a set of services that can be used to extend the functionality of a common language runtime property.
- It is a property with the exception that its value cannot be set outside the class that declared the read-only property.
No comments:
Post a Comment