0% found this document useful (0 votes)
16 views8 pages

Hans Machine Test

The document is a question paper for a .NET module divided into three parts, covering various topics including .NET languages, C# programming, SQL queries, and JavaScript functions. It contains multiple-choice questions, true/false statements, and short answer questions related to programming concepts. The paper is designed for a two-hour completion time and all questions are compulsory.

Uploaded by

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

Hans Machine Test

The document is a question paper for a .NET module divided into three parts, covering various topics including .NET languages, C# programming, SQL queries, and JavaScript functions. It contains multiple-choice questions, true/false statements, and short answer questions related to programming concepts. The paper is designed for a two-hour completion time and all questions are compulsory.

Uploaded by

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

HANS INFOMATIC PVT. LTD.

Question Paper (.Net)

Note:

 There are three parts in this module.


 All questions are compulsory.
 Maximum time allotted for completing your response is 2 hours.
 Please do not put any mark on question paper.
Part ‘A’

1. Which of the following is not a .NET compatible language?


A. C#, J#
B. VB.NET
C. Managed C++
D. Java
E. COBOL.NET, Perl.NET

2. Common Type Structure (CTS)


A. Defines data types in order to be run by CLR.
B. Defines a set of rules for all compilers to generate managed code for .NET.
C. Describes a set of features that different languages have in common.
D. All of the above.
E. None of the above

3. Which of the following assemblies can be stored in Global Assembly Cache?


A. Private Assemblies
B. Friend Assemblies
C. Shared Assemblies
D. Public Assemblies

4. How many constructors a C# class can define?


A. Only One
B. Only Two
C. Any Number
D. None

5. The correct way of creating objects of a class Hello is: (Choose all that apply)
A. Hello obj1 = new Hello();
B. Hello obj2; obj = new Hello();
C. Hello obj3;
D. Hello obj4 = Hello();
E. obj5 = new Hello();
6. What will be the output of following program?

using System;
namespace HansConsoleApplication
{
class Hello
{
int a, b;
public void SetValue(int a, int b)
{
a = a;
b = b;
}
public void DisplayValue()
{
Console.WriteLine(a + " " + b);
}
}
class MyGreeting
{
static void Main(string[] args)
{
Hello obj = new Hello();
obj.SetValue(1, 2);
obj.DisplayValue();
}
}
}

A. 1 2
B. 12
C. 0 0
D. None of the above

7. What will be the output of following program?

class Calculation
{
static void Main(string[] args)
{
int a=5;
int b=2;
float c= a/b;
Console.WriteLine("The Result" + c);
}
}

A. 2.5
B. 2
C. 2.0
D. Error
8. Which is default value of Boolean type in C#?
A. True
B. 1
C. False
D. 0

9. What would be the output of the following program?


using System;
namespace Hans
{
class DataTypesScope1
{
static void Main(string[] args)
{
int i=10;
Console.WriteLine(i);
if (i==10)
{
int i=20;
Console.WriteLine(i);
}
Console.WriteLine(i);
}
}
}

A. 10 20 10
B. 10 20 20
C. 10 10 10
D. Compilation Error

10. What is the output of the following C# program?


using System;
namespace Hans
{
public class WhileLoop
{
public static void Main(string[] args)
{
int c = 1;
while (c < 100)
Console.Write(c +" ");
c++;
}
}
}

A. Prints the numbers from 1 to 99


B. Infinite Loop
C. Compilation Error
D. Prints the numbers from 1 to 100
11. What will be result of following javascipt function?

<script type="text/javascript">
var name = "Hans";
function DisplayName ()
{
var name = "Sagar";
document.write(name);
}
</script>

A.Hans
B.Sagar
C.Error
D.None of above

12. What will be result of following javascipt function?

<script type="text/javascript">
var name1 = "WCF quiz";
function DisplayName ()
{
var name2 = "ASP.NET MCQs";
if(name1 != "")
document.write(name1);
else
document.write(name2);

}
</script>

A. Javascript Error at else statement


B. ASP.NET MCQs
C. WCF quiz
D. Javascript Error in if condition

13. What will be result of following javascipt function?

<script type="text/javascript">
var name1 = "WPF Quiz";
function DisplayName ()
{
var name2 = "ASP.NET MCQs";
(name1.replace('P','C')=="WCF Quiz"?document.write(name1):document.write(name2));
}
</script>

A.WPF Quiz
B.WCF Quiz
C.ASP.NET MCQs

14. You can add a row using SQL in a database with which of the following?
A. ADD
B. CREATE
C. INSERT
D. MAKE

15. The command to remove rows from a table 'CUSTOMER' is:

A. REMOVE FROM CUSTOMER ...


B. DROP FROM CUSTOMER ...
C. DELETE FROM CUSTOMER WHERE ...
D. UPDATE FROM CUSTOMER ...

16. The SQL WHERE clause:

A. limits the column data that are returned.


B. limits the row data are returned.
C. Both A and B are correct.
D. Neither A nor B are correct.

17. A view is which of the following?

A. A virtual table that can be accessed via SQL commands


B. A virtual table that cannot be accessed via SQL commands
C. A base table that can be accessed via SQL commands
D. A base table that cannot be accessed via SQL commands

18. The SQL keyword(s) ________ is used with wildcards.

A. LIKE only
B. IN only
C. NOT IN only
D. IN and NOT IN

19. Find the SQL statement below that is equal to the following: SELECT NAME FROM CUSTOMER
WHERE STATE = 'VA';

A. SELECT NAME IN CUSTOMER WHERE STATE IN ('VA');


B. SELECT NAME IN CUSTOMER WHERE STATE = 'VA';
C. SELECT NAME IN CUSTOMER WHERE STATE = 'V';
D. SELECT NAME FROM CUSTOMER WHERE STATE IN ('VA');

20. SELECT DISTINCT is used if a user wishes to see duplicate columns in a query.

A. True
B. False
Part ‘B’

1. A single .NET dll can contain unlimited classes


A. True
B. False

2. C# supports multiple-inheritance
A. True
B. False

3. Static method cannot be overridden


A. True
B. False

4. Events in Web forms are processed before the “Page Load” event
A. True
B. False

5. The following is a valid statement in ASP.NET<%@Page Language="C"%>


A. True
B. False

6. A SELECT statement within another SELECT statement and enclosed in


square brackets ([...]) is called a subquery.
A. True
B. False

7. COUNT(field_name) tallies only those rows that contain a value; it


ignores all null values.
A. True
B. False

8. DISTINCT and its counterpart, ALL, can be used more than once in a
SELECT statement.
A. True
B. False

9. Is JavaScript case sensitive?


A. True
B. False

10. Is this the correct way in Java Script to create three dimensional
array

var myArray = [[[]]];

A. True
B. False
Part ‘C’

Q1. Explain polymorphism and how does it achieve in .net?

Answer: Polymorphism: It is a main part of object oriented programming which can define
as a it have ability to provide the code and data into more than one form. There are two
types like Compile time and Run Time we also know as static and Dynamic ,compile time
there are two types- operator overloading and method overloading and run time is a
operator loading these are two main method where I can achieve the polymorphism in C#.
along with Method Overloading when you need multiple methods with the same name but
different parameters and Use Method Overriding when you need to provide different
behavior for a method in derived classes while keeping the same method signature.

Q2. What do you mean by authentication and authorization?

Answer: Authentication we can define as a assume a user Logging into a website with
username & password and also used for Checking identity purpose .

Authorization we can define as a assume a user After logging in a regular user can only view
the profile but admin can manage all users and also used for Checking permissions.

Q3. Difference between Convert.ToString and .ToString ()?

Answer: Convert.ToString it is used for Converts a value to a string and also handle the null
condition in code apart from it is works for any types of data.

.ToString () it is used for Calls the ToString() method of an object and No throws Null
Reference Exception approach and Works only if the object is not null.

Q4. What is the difference between a primary key and unique key?

Answer:

Primary Key: It can define as a Uniquely identifies each row in a table and must be unique
for each row and not allow NULL Values and Only one primary key per table.

Unique Key: we can define as a ensures unique values in a column but allows multiple NULL
and it Must be unique but NULL are allowed and it can have multiple unique keys per table.

Q5. Write a query to delete the rows which are duplicate (don’t delete both duplicate
records.

Answer: WITH CTE AS ( SELECT empid, ROW_NUMBER() OVER (PARTITION BY empname,


empdepartment ORDER BY empid) AS row_num FROM Employee ) DELETE FROM Employee
WHERE empid IN ( SELECT empid FROM CTE WHERE row_num > 1 )

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy