Download as pdf or txt
Download as pdf or txt
You are on page 1of 24

Question 1

Predict the output of the following program.


using System;
class NamedParameterExample
{
static void Method(int num1,int num2)
{
Console.WriteLine("num1={0}num2={1}", num1,num2);
}
static void Main()
{
Method(num:10, num2:20);
}
}

Question 1 options:

num1=10,num2=20

num1=20,num2=10

num1=10,num2=10

Error: The best overload for 'Method' does not have a parameter named num.

Question 2 (1 point)

Predict the output of the following program


using System;
class OutClass
{
static void Out_Demo(out int num1, out int num2)
{
num1=5;
}
public static void Main()
{
int num1,num2;
Out_Demo(out num1, out num2);
Console.WriteLine("num1 = {0} num2 = {1}", num1, num2);
}
}

Question 2 options:
num1=10,num2=5

Error: The out parameter (num2) must be assigned to before control leaves the current method.

Error: Out of Range

num1=5,num2=5

Question 3 (1 point)

Predict the output of the following program.


using System;
public class MyClass
{
public static void UseParams( params int[] list, int num1, int num2)
{
for (int i = 0 ; i < list.Length; i++)
{
Console.WriteLine(list[i]);
}
Console.WriteLine("num1={0}, num2={1}",num1,num2);
}
public static void Main (string [] args)
{
int[] num = new int[] {71,89,90,100};
UseParams(num,5,10);
}
}

Question 3 options:

num1=10,num2=5

num1=5,num2=5

num1=5,num2=10

Error: A params parameter must be the last parameter in a formal parameter list.

Question 4 (1 point)

Predict the output of the following program


using System;
class RefClass
{
static void Ref_Demo(ref int num1, ref int num2)
{
num1=5;
}
public static void Main()
{
int num1 = 2;
int num2 = 3;
Ref_Demo(ref num1, ref num2);
Console.WriteLine("num1 = {0}, num2 = {1}", num1, num2);
}
}

Question 4 options:

num1 = 5, num2 = 3

Error: The out parameter (num2) must be assigned to before control leaves the current method.

num1 = 2, num2 = 3

num1 = 5, num2 =2

Question 5 (1 point)

Predict the Output?


using System;
namespace AbstractDemo
{
abstract class Employee
{
public void Display()
{
Console.WriteLine("Employee Class");
}
public abstract void CareerLevel();
}
class Participant:Employee
{
public void Display()
{
Console.WriteLine("Participant Class");
}
}
class Test
{
public static void Main()
{
Participant Part1 = new Participant();
Part1.CareerLevel();
}
}
}

Question 5 options:

'Participant doesn't implement Inherited abstract member 'Employee.CareerLevel()'.

Employee Class, Participant Class

Employee Class, Employee Class

lParticipant Class, Participant Class

Question 6 (1 point)

Find out the non-overloaded method/s in the given sample code:

Question 6 options:

public void Add (int a, int b)

public void Add(int a, int b, int c)

public int Add(int a, int b, int c)

private void Add(int a, double b)

private int Add(double a, int b)

Which of the following statements are True, with respect to exceptions?

Question 1 options:

An exception occurs during the compilation stage of a program

When an exception occurs, the line which causes the exception is skipped and program flow continues from the
next line
The System.Exceptions namespace contains the exception classes in .NET

None of the above

Question 2 (1 point)

Which of the following statements are True, with respect to exception handling?

Question 2 options:

A try block can be written without any catch or finally blocks following it

A try block has to be compulsorily followed by at least one catch block or a finally block

A try block has to be compulsorily followed by at least one catch block and a finally block

A try block may have multiple catch blocks

Finally block is executed only when there is an exception

Saved
Choose four different components of LINQ
Question 1 options:
LINQ to Objects
LINQ to XML
LINQ to DataTable
LINQ to DataSet
LINQ to SQL
Question 2 (1 point)
Saved
Which of the following statements is/are True?
Statement 1: LINQ provides a unified programming model to different
data domains for data management.
Statement 2: Language integrated query is set of framework features
for structured type-safe queries.
Question 2 options:
Both statements 1 & 2.
Neither 1 nor 2.
Only statement 2 is true.
Only statement 1 is true.
Question 3 (1 point)
Saved
_____________ is used to create associations in sequences which are not
explicitly modeled in the data sources.
Choose most appropriate option.
Question 3 options:
SQL
xml
Join
Data
lambda
Question 4 (1 point)
Saved
In LINQ, All the essential types are defined in _________ and __________
Question 4 options:
System.Linq.XML and System.Linq.Expressions
System.Linq and System.Linq.XML
System.Linq and System.Linq.Expressions
System.XML.Linq and System.Linq.Expressions
Quiz
Question 1 (1 point)
Saved
Which statement is INCORRECT about PRIMARY KEY constraint in
SQL Server?
Question 1 options:
Primary key must always have only one column
Primary key can have more than one columns
Each record in a table is uniquely identified by Primary Key
Primary key column cannot have null value.
Question 2 (1 point)
Saved
The gender column of the Employee table must accept only one of
three values : 'M','F' or 'T'. Which constraint must be used to ensure
this?
Question 2 options:
Default
Check
NOT NULL
None
Question 3 (1 point)
Saved
Identify the correct SQL query to Alter a column from a table in SQL
Server database
Question 3 options:
ALTER TABLE tablename, MODIFY COLUMN columnName
DELETE columnName FROM tableName
DROP COLUMN columnName FROM table name
ALTER TABLE tablename, ALTER COLUMN columnName
Question 4 (1 point)
Saved
Which of the following options is the correct sequence of clauses
applied to retrieve data in SQL?
Question 4 options:
Select, from, where
From, select, where
From, where, select
Select, where, from
Question 5 (1 point)
Saved
A view is which of the following?
Question 5 options:
A virtual table that can be accessed using SQL commands
A virtual table that cannot be accessed via SQL commands
A base table that can be accessed via SQL commands
A base table that cannot be accessed via SQL commands
Question 6 (1 point)
Saved
Which of the following SQL keyword(s) are used with wildcards?
Question 6 options:
LIKE only
IN only
NOT IN only
IN and NOT IN
Question 7 (1 point)
Saved
The command to remove selective rows from a table is:
Question 7 options:
REMOVE
UPDATE
DROP
DELETE
Question 8 (1 point)
Saved
The SQL join which does Cartesian product is called?
Question 8 options:
Left Outer Join
Left Join
Right Outer Join
Cross Join
Question 9 (1 point)
Saved
Which type of join will NOT fetch unmatched rows from tables?
Question 9 options:
Inner join
Left outer join
Left inner join
Outer join
Question 10 (1 point)
Saved
Which of the following statements are advantages of using Views?
Question 10 options:
Query re-usability
Abstraction – hiding data
Security
All

Submit Quiz10 of 10 questions saved


Quiz
Question 1 (1 point)
Saved
Which of the following statements are FALSE, with respect to Entity
Framework Core? Choose 2 correct options
Question 1 options:
Entity Framework supports only Microsoft SQL server as a data source.
Entity Framework is based on Object Relational Mapping
Entity Framework provides support for database transactions.
Entity Framework does not support foreign key mappings in the object model
Question 2 (1 point)
Saved
A developer has been assigned a project for online shopping. The tables
identified are: Product and Category. The application must display a list
of categories to the user. When the category details are fetched from
the database, the related products which belong to the categories must
NOT be fetched. Which feature of entity framework will help you
achieve this?
Question 2 options:
Eager Loading
Raw SQL
Lazy Loading
Foreign keys
Question 3 (1 point)
Saved
Context classes must inherit from
Question 3 options:
EntityContext
DataContext
DbSet
DbContext
Question 4 (1 point)
Saved
Classes which map to the database tables are called
Question 4 options:
Entity classes
Dbsets
Navigation classes
context classes
Question 5 (1 point)
Saved
Which method of the context class can be used to save the changes
made by insert, update, and delete operations to the database?
Question 5 options:
CommitChanges
SaveUpdate
Save
SaveChanges
Question 6 (1 point)
Saved
A developer wants to invoke a stored procedure
called GetPendingInvoices using entity framework. The procedure
expects a datetime value as a parameter. Which of the following
options can be used?
Question 6 options:
DateTime day= DateTime.Now;

context.Invoices.FromSql("EXECUTE dbo.GetPendingInvoices {day}") .ToList();


DateTime day= DateTime.Now;

context.Invoices.ExecuteSql("EXECUTE dbo.GetPendingInvoices",day).ToList();
DateTime day= DateTime.Now;

context.Invoices.FromSqlRaw("EXECUTE dbo.GetPendingInvoices {0}", day) .ToList();


DateTime day= DateTime.Now;

context.FromSqlRaw("EXECUTE dbo.GetPendingInvoices {0}", day) .ToList();


Question 7 (1 point)
Saved
Which of the following code snippets demonstrates Explicit loading?
Question 7 options:
var category = context.Categories.Single(b => b.CategoryId == 101);

context.Entry(category).Collection(b => b.Products).ToList();


var category = context.Categories.Single(b => b.CategoryId == 101);

context.Entry(category).Collection(b => b.Products).Include();


var category = context.Categories.Single(b => b.CategoryId == 101);

context.Entry(category).Include(b => b.Products).ToList();


var category = context.Categories.Single(b => b.CategoryId == 101);

context.Entry(category).Collection(b => b.Products).Load();


Question 8 (1 point)
Saved
A development team wants to use Entity Framework Core to perform
database operations. The domain classes have been identified and
created. The database tables do not exist. Which of the following
options is the best method to create the database tables from the
domain classes?
Question 8 options:
use the CREATE TABLE statement in SQL to create the tables and columns as per the domain classes
and their properties
use the create - migration command
use the add - migration command
creating the domain classes will automatically generate the database tables by using the Context class
Question 9 (1 point)
Saved
Which of the following options can be used to search for books from a
database using the book name? there may be multiple books with the
same name. Assume context is an instance of the context class, Books
is a DbSet property.
Question 9 options:
context.Books.Find(b=>b.Name.Equals("EF core"));
context.Books.Where(b.Name.Equals("EF core"));
context.Books.Where(b=>b.Name.Equals("EF core"));
context.Books.Find("EF core");
Question 10 (1 point)
Saved
Which of the following options is a class used in Entity Framework to
configure database connections in the data context?
Question 10 options:
DbContextOptionsBuilder
DbContext
ApplicationContext
DbSet

Submit Quiz10 of 10 questions saved


Quiz
Question 1 (1 point)
Saved
Consider the following Page class method used in a search form:

public void OnGet(string name);

which of the following options can be used to bind the user interface
input data to the above method as a query string?
Question 1 options:
<form method="get" action="name">

<input type="search"/>

</form>
<form method="get">
<input type="search" value="name"/>

</form>
<form method="get">

<input type="search" name="name"/>

</form>
<form method="get">

<input type="name" />

</form>
Question 2 (1 point)
Saved
Which of the following attributes can be used to specify page route
parameters?
Question 2 options:
asp-params
asp-route
asp-id
asp-page
Question 3 (1 point)
Saved
The IIS worker process is called --------
Question 3 options:
aspnetdll
w3wp
ngenx
mscorlib
Question 4 (1 point)
Saved
The run time environment is configured using which of the following
variables?
Question 4 options:
ASPNETCORE_ENVIRONMENT
None of the given options
ASPNET_ENVIRONMENT
ASPNETCOREHOSTINGMODEL
Question 5 (1 point)
Saved
The -------- lifetime option ensures that the same service object is used
for every request.
Question 5 options:
Scoped and Singleton
Scoped
Singleton
Transient
Question 6 (1 point)
Saved
Which of the following tags can be used to specify separate settings for
production and development scenarios?
Question 6 options:
assembly
environment
configuration
compilation
Question 7 (1 point)
Saved
A Page class has the following property:

[TempData]

public string Message {get; set;}

How can this property be displayed in a view file?


Question 7 options:
<div>@Model.Message</div>
<div>@TempData.Message</div>
<div>TempData["Message"]</div>
<div>@Message</div>
Question 8 (1 point)
Saved
What messages will be logged when the LogLevel is set to critical?
Question 8 options:
Trace, Debug, Information, Warning, Error, Critical
None
Critical,None
Critical

Submit Quiz8 of 8 questions saved


Quiz
Question 1 (1 point)
Saved
Which of the following components of MVC receives all user requests?
Question 1 options:
Model
View
Controller
Both View and Controller
Question 2 (1 point)
Saved
ASP.NET MVC supports client side validation using……..?
Question 2 options:
Bootstrap libraries
jQuery Unobtrusive Validation library
Angular Libraries
React Libraries
Question 3 (1 point)
Saved
Which attribute is applied to HTML tags like span, paragraph to ensure
that the tag is used to display the validation error message for a model
property?
Question 3 options:
asp-validation-message
asp-validation-for
asp-error-for
asp-validation-summary
Question 4 (1 point)
Saved
You have created an application using ASP.NET MVC Core. There are 3
views in the application which share common functionality. You want to
avoid creating the view for the common functionality 3 times and
decide to create a reusable component. What will you create?
Question 4 options:
Layout View
Partial view
Tag Helper
Master Page
Question 5 (1 point)
Saved
Which of the following options can be used to set Product as the
default controller and Show as the default action, with an optional
route parameter called id?
Question 5 options:
app.AddRoute(

name: "default",

pattern: "{controller=Product}/{action=Show}/{id}");
app.MapControllerRoute(

name: "default",

pattern: "{controller=Product}/{action=Show}/{id}");
app.MapControllerRoute(

name: "default",

pattern: "{controller=Product}/{action=Show}/{id?}");
app.AddRoute(

name: "default",

pattern: "{controller=Product}/{action=Show}/{id?}");
Question 6 (1 point)
Saved
The Login action method must match 2 routes: Login, and Login/Auth

Which of the following options will help you configure the same?
Question 6 options:
[Route("Login")]

[Route("Auth")]

public IActionResult Login( string user, string password) { }


[Route("Login")]

[Route("Login/Auth")]

public IActionResult Login( string user, string password) { }


[Route("Login,Login/Auth")]

public IActionResult Login( string user, string password) { }


[Route("Login")]
[Route("*/Auth")]

public IActionResult Login( string user, string password) { }


Question 7 (1 point)
Saved
A developer wants to create a page for providing edit functionality for a
user's profile. The edit page is accessed by clicking a link, and the id of
the user is sent to the edit action to fetch the user details from the
database. Which of the following action methods is most appropriate
for displaying the current users details in the edit page view?
Question 7 options:
public ViewResult Edit()
[HttpPost]

public ViewResult Edit()


[HttpPost]

public ViewResult Edit(User userInfo)


public ViewResult Edit(int userId)
Question 8 (1 point)
Saved
Which of the following options can be used as a model in ASP.NET
MVC?
Question 8 options:
.cshtml files
.cs files
.html files
.css files
Question 9 (1 point)
Saved
The public methods in a controller are called
Question 9 options:
Views
Actions
ViewResult
ActionResult
Question 10 (1 point)
Saved
ASP.NET MVC automatically generates the baseline of your
application's CRUD operations using -------
Question 10 options:
Environment
Intellisense
Scaffolding
Visual Studio Code Generation

Submit Quiz10 of 10 questions saved


Quiz
Question 1 (1 point)
Saved
Which part of an Angular component includes binding, directives, and
layout?
Question 1 options:
metadata
class
service injection
template
Question 2 (1 point)
Saved
Which of the following options can be used to fetch a list of products
returned by an API ? Assume http is an instance of HttpClient service
Question 2 options:
getProductDetails: Observable<IProduct[]>

return this.http.get<IProduct[]>('api/products');

}
getProductDetails: Observable<IProduct[]>

return this.http('api/products');

}
getProductDetails: Observable<IProduct[]>

return this.http.subscribe<IProduct[]>('api/products');

}
getProductDetails: Observable<IProduct[]>

return this.http.fetch<IProduct[]>('api/products');

}
Question 3 (1 point)
Saved
------------ , when applied to an element , makes that element a link that
initiates navigation to a route.
Question 3 options:
RouterLink
Path
RouterOutlet
RouterURL
Question 4 (1 point)
Saved
Which of the following statements are true? Choose 2 correct options
Question 4 options:
A component should use services for tasks that do NOT involve
the view
component functions are reused in different services
Services are suited for tasks such as fetching data from the server,
or logging errors
services must NOT depend on other services
Question 5 (1 point)
Saved
Which of the following options is a valid routes array in Angular?
Question 5 options:
[

{ url: 'first-component', component: FirstComponent },

{ url: 'second-component', component: SecondComponent },

];
[

{ src: 'first-component', name: FirstComponent },

{ src: 'second-component', name: SecondComponent },

];
[

{ path: 'first-component', component: FirstComponent },

{ path: 'second-component', component: SecondComponent },

];
[

{ href: 'first-component', component: FirstComponent },

{ href: 'second-component', component: SecondComponent },


];
Question 6 (1 point)
Saved
Two-way binding in Angular is implemented using:
Question 6 options:
([ngModel])
[ngModel]
[(ngModel)]
{{ngModel}}
Question 7 (1 point)
Saved
Which directive is used to add and remove CSS classes from view
components in Angular?
Question 7 options:
NgFor
NgModel
NgClass
NgStyle
Question 8 (1 point)
Saved
Which of the following files will NOT be created because of using the
ng generate component command?
Question 8 options:
<component-name>.component.js
<component-name>.component.ts
<component-name>.component.html
<component-name>.component.css
Question 9 (1 point)
Saved
Angular UI is composed of small blocks called ------------
Question 9 options:
Pipes
Services
Modules
Components

Submit Quiz9 of 9 questions saved

You might also like