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

C# Chapter Wise Practice Test

C# Practice question for TYBSC IT SEM VI MUMBAI UNIVERSITY Posted by Prof. Ahtesham Shaikh, B. Sc. IT Coordinator, Akbar Peerbhoy College of Commerce and Economics.

Uploaded by

shaikh_aa53
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
436 views

C# Chapter Wise Practice Test

C# Practice question for TYBSC IT SEM VI MUMBAI UNIVERSITY Posted by Prof. Ahtesham Shaikh, B. Sc. IT Coordinator, Akbar Peerbhoy College of Commerce and Economics.

Uploaded by

shaikh_aa53
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
You are on page 1/ 10

T. Y. B. Sc.

IT

SEMESTER VI
Chap 12 Test
Marks Date____________
Students Name: ____________________________________________ Roll
No:
1

Write the proper


match
1. overload : ______
2. params : _______
3. add(10,20); :
____
4. abstract : _______

a) Must be
overridden
b) Runtime
c) Variable
argument
d) Compiler fix
e) One name many
form
2 Restrictions for params
1)
__________________________________________
___________________________________________
2)
__________________________________________
___________________________________________
List 8 modifiers used with method
declaration in class
___________________________________________
___________________________________________
Use of static void Main().
___________________________________________
___________________________________________
State whether the statements are true or
false
1) Static Method can be overloaded. ______
2) Method can define nested method.
______
3) Every method must have return type
_____
4) Method can declare a constant ______
Comment on out keyword in
_________________
____________________________________________
____________________________________________

10

What if Method is passed an argument of?


1)
smaller than its actual
argument :____________
________________________________________
2)
larger than its actual argument
: _____________
_____________________________________

11

Two differences between value and ref.


1) ____________________________________
____________________________________
2) ____________________________________
____________________________________

12

How overloaded methods are


bonded_____________
____________________________________________
____________________________________________
Two qualities of a Class variable.
1. _____________________________________
2. _____________________________________
List four types of Method parameter
1) ___________________
2) ___________________
3) ___________________
4) ___________________

15

_______ & __________ access specifier can be


joined.
________ is use to refer a method inside own
class.

General syntax for declaring a non static


member.

16

C# Method can be defined only in class. YES


/ NO
Define method
________________________________
____________________________________________
Complete the following code snippets: class
test{
public static _____ add(int a, int b, ______
float )
{ string s = +a+b+c+100; return 100;
return ;;;;;;;;; int x = a+b+c+ (++c - --a);

13

14

17

Time 30 Min Total 30

Write a method that contains three return


statements

18

return +x
}}

What do you mean by local variable of


method in
C#________________________________________
__________________________________________
__________________________________________
__________________________________________

19

20

If a method is void AnyM(int a, float b,


double c) then
1) AnyM(10, 20.30, 40) can match YES /
NO
2) AnyM((int)20.30, 40, 50) can match
YES / NO
Underline the error: class test { int
imprivate = 100;
public double public_int(int a, int a) {return
00; }
public static void main(int x, int y) {return
imprivate;}}

Marks Obtained __________ in Words ___________________________ Signature of the


Examiner________
Remarks by the examiner ___________________________________________________________________

Chapter 08
Write the proper
match
5. overload : ______
6. params : _______
7. add(10,20); :
____
8. abstract : _______

f) Must be
overridden
g) Runtime
h) Variable
argument
i) Compiler fix
j) One name many
form
2 Restrictions for params
1)
__________________________________________
___________________________________________
2)
__________________________________________
___________________________________________
List 8 modifiers used with method
declaration in class
___________________________________________
___________________________________________
Use of static constructor.
___________________________________________
___________________________________________

10

What if Method is passed an argument of?


3)
smaller than its actual
argument :____________
________________________________________
4)
larger than its actual argument
: _____________
_____________________________________

11

Two differences between value and ref.


2) ____________________________________
____________________________________
2) ____________________________________
____________________________________

12

What is the use of Class with parameter less


private constructor and only const members
______________
____________________________________________
Two qualities of a Class variable.
3. _____________________________________
4. _____________________________________

13

State whether the statements are true or


false
5) Method call must end with semicolon.
______
6) Class can be declared static. ______
7) Constructors cannot be overridden. _____
8) Destructor is called when object go out
of scope _
Comment on value keyword in
_________________
____________________________________________
____________________________________________

General syntax for declaring a variable.

Comment on the following code snippet :


Mobile E65 = new
Mobile();______________________
Mobile E71 = new Mobile(E65);
__________________
Mobile N90 =
E65______________________________
____________________________________________
____________________________________________
What do you mean by class member
initialization in
C#________________________________________
__________________________________________
__________________________________________
__________________________________________

14

List four types of constructors


5) ___________________
6) ___________________
7) ___________________
8) ___________________

15

_______ & __________ access specifier can be


joined.
________ is use to refer a member inside
own class.
Space for extra work

T. Y. B. Sc. IT SEMESTER VI
Chap 13 Test
Time 20 Min Total 20 Marks
Students Name: ____________________________________________ Roll
No:
Match the
k) non virtual
11 Comment on enumeration base type
following
l) overriding
conversion.
1. Containment___ m)
has a g) many
___________________________________________
__
for one
___________________________________________
2. Hierarchical
n) is a
h) sealed
___________________________________________
_____
o) one for many
__________________________________________
3. virtual_________
_
4. new___________

1
0

List 2 specialties of virtual method.


_____________________________________________
_____________________________________________
_____________________________________________
_____________________________________________
Two differences between structure and class
_____________________________________________
_____________________________________________

12

___________ & ________ modifiers cannot be


joined for a struct. Derive class can allow
further overriding by ________ key word.
_________ is use for inheritance.
1. virtual method can be abstract.
YES /
NO
2. non sealed class cannot be inherited
directly. YES/ NO
3. protected constructer cant be use by
derive YES / NO
4. multiple classes can be inherited by one
class using multilevel inheritance. YES /
NO
Default visibility of class is ________________
and default visibility of class member is
n______________
a) public b) static c) protected d) new e)
internal f) void
How will you override a method for which
you dont have permission
______________________________
____________________________________________
Complete the following code snippet :
class Hiralal{
________Hiralal(int a, int b, int c){}
public static void i_m_private(){}
public _______ void i_m_private(int a, float b,
char c)
{System.Console.Write(I m Possible);}}
class pannalal:Hiralal{
public pannalal(int a, int b, int
c)_______________{}
public ___________ i_m_private();
}
Class Champalal:pannalal {
__________Champalal(int a,float dd, int b, int
c, char d) ___________________ {}
public static void main(){ new
Champalal(1,1,1,1 , a);}
}
class test{public static void Main()
{Champalal.______; }}

14

13

Two accessibility constraints


1) _________________________________________
___________________________________________
2) _________________________________________
___________________________________________
Role of abstract classes in inheritance.
___________
___________________________________________
___________________________________________
Under line the error in code give
reason below : class dukhi{ public void
add (){}
protected object add(int x, float d) {return
x+d;} }
public class dukhilal: dukhhi { public void
add(int a, int b){}
public new string add(int xx, double dd)
{return 9;}}
___________________________________________
___________________________________________

15

Name two forms of inheritance


1) _________________
2) __________________

16

What if the new does not get any match


for method
_____________ prevents inheritance.

17
18

19

Four terms used for Run time


polymorphism 1) _____
___________________2) ______________________
_____________3)____________________________
_
________4)_________________________________
_
1 Difference between compile time and
runtime poly
___________________________________________
___________________________________________

20

Assembly

AnyWher

Sub class

e
protected
internal

protecte
d
internal

Define
enumeration_________________________________________________________________________________
_________________________________________________________________________________________________

Marks Obtained __________ in Words ___________________________ Signature of the


Examiner________
T. Y. B. Sc. IT

SEMESTER VI

Test Chap 14
Time 20 Min
Date____________
Students Name: ____________________________________________ Roll
No:

Total 20 Marks

p) Constant_____________
q) Array_______________
r) abstract method_______
s) Copy Constructor_____
t) Property.____________
2 Differences between classes and Interface methods
1) __________________________________________
___________________________________________
2) __________________________________________
___________________________________________
List 4 modifiers that can used with interface methods
___________________________________________
___________________________________________

11

Use of as keyword
___________________________________________
___________________________________________
State whether the statements are true or false
9) interface cannot have non static member. _____
10)
interface is value type. ______
11)
Interface can have a property with get set ____
12)
Multilevel inheritance is not allowed in
Interface___
13)
Two interfaces cannot use same base interface
____
Use of : (colon) in class for interface

14

16

______________ & _________ modifiers cannot be


used with interface members.

General syntax for declaring a class that implements an


interface and a class

17

General syntax of using a property in interface

8
&
18

Comment on the following code snippet :


interface Mobile {void show();}__________________
class Nokia:Mobile{void show(){}}_______________
Mobile m[] = new Mobile[10] ___________________
For(i=0;i<10;i++) m[i] = (Mobile) new Nokia()______

9
&
19

correct & Rewrite the code


interface a{private void aa() }
struct b:a{public void aa(){}}
class test : b {
public static void Main(){
aa(); }}

Mark
V for valid
I for invalid
Member of interface

12

13

15

Interface to class type conversion.


____________________________________________
___________________________________________
__ __________________________________________
___________________________________________
2 advantages of abstract class over interface
3) ____________________________________
____________________________________
2) ____________________________________
____________________________________
When will u apply multiple interface implementation.
___________________________________________
___________________________________________
When will u apply explicit interface implementation.
___________________________________________
___________________________________________
interface a{void show();}
interface b:a{void
show();}
interface C:b{void show();}
create a class that implements C

____________________________________________
____________________________________________
____________________________________________
____________________________________________
____________________________________________
19

____________________________________________
____________________________________________
____________________________________________
____________________________________________
____________________________________________

10

How an interface is use to call a its own method

20

Similarities in classes and interfaces


1)__________________________________________
2)___________________________________________

Marks Obtained __________ in Words ___________________________ Signature of the


Examiner______________
T. Y. B. Sc. IT
SEMESTER VI
Chap 15 Test
Time 20 Min Total
20 Marks
Students Name: ____________________________________________
Roll No:
Write the proper
u) can be
11 What operator overloading is necessary?
match
overloaded
5)
_______________________________
1. : operator : ______
v) must be in pair
________
2. Unary bitwise : ____
w)take no argument
________________________________________
3. Comparison Opr :___ x) Not allowed
6)
_______________________________
4. Operator
y) One name many
_________
overloading : __
form
________________________________________
2 Restrictions for comparison operator
12 Two rules for operating overloading
overloading
4)
____________________________________
1) __________________________________________
__________________________________________
___________________________________________ 2)
2) _______________________________________
__________________________________________
_________________________________________
___________________________________________
List 4 types of operator that cannot be
13 Comment on compound arithmetic opr
overloaded
overloading
___________________________________________
____________________________________________
___________________________________________
____________________________________________
Applications of operator
14 List four types of overloadble operators
overloading._______________
1>________________ 5> ___________________
______________________________________________
2>_________________ 4>____________________
______________________________________________
State whether the statements are true or
15 Define an overloaded * operator for
false
Complex product that returns an integer
1) Operator overloading allow to define new
value: class Complex{
operator__
2) Class can overload operator for other class.
______
3) Overloaded operator must be static. _____
4) Ternary operator can be overloaded ____
Comment on rules for binary operator
overloading _____
}
______________________________________________
______________________________________________
General syntax for declaring a operator
16 Define operator
method
overloading_____________________
____________________________________________

9
&
1
0

2
&
1
2

why the following declarations are


invalid: class MyInt{ bool isRect = true; int
n=10;
public static int operator *=(MyInt mi1)
{ return mi1.n++; }
__________________________________ public
static bool operator *(MyInt r1, bool r2)
{boolean b = r1.isRect && r2; return b; }
________________________________
______________________________________________
Write a prototype for real world method for
following: 1) an non comparison operator
taking two parameter and returning boolean
value.______________________
______________________________________________
2) a binary operator taking an object and
scalar value and returning
object______________________________
______________________________________________

17
&
18

Two differences between operator


overloading in C++ and operator
overloading in C#._________________
____________________________________________
____________________________________________
____________________________________________
____________________________________________
____________________________________________

19

Write an prototype of operator methods to


perform the following: Doremon d1 = new
Doremon(10); d1 *= (new Doremon()
<= 99); _______________________
____________________________________________
____________________________________________
____________________________________________
____________________________________________

20

Marks Obtained __________ in Words ___________________________ Signature of the


Examiner________
T. Y. B. Sc. IT
SEMESTER VI
Chap 16 & 17 Test
Time 20 Min Total
20 Marks
Students Name: ____________________________________________
Roll No:
Write the proper
a) All returns void
11 State whether the statements are true or
match
b) System.Console
false
1. Callable entity :
c) take no
1) Delegates can be used as base by derive
______
argument
class _____
2. callbacks : ____
d) Events
2) Delegates can be inherited by base class.
3. Multicast :___
e) Delegate
______
4. Err:________
methods
3) Standard error device is printer. _____
4) Non static methods can also be used in
delegate___
Complete & comment on the following
12 ___________________________________________
code snippet : Using System;
___________________________________________
class A{internal delegate void
___________________________________________
MyDel(string);}
____________________________________________
class B:A{internal _____delegate void
__________________________________________
MyDel(string);
___________________________________________
public B(){MyDel md = new
MyDel(Console.Write);} }
class test {public static void Main(){B obj =
new B(); obj.md(Hello);}}
List 4 types of operator that cannot be
13 Three places where delegates can be
overloaded
declared: 1) ____ _________________________
___________________________________________
2)_________________
___________________________________________
3)__________________________________________
_

Write the output of the following : using


System;
1) Console.WriteLine(A={2} B={0} C={1}
D={2},2,2,3,4)
__________________________________________
2) Console.WriteLine(Value={0:C5},12);
__________________________________________
Differentiate between ReadLine and Read
1)__________________________________________
____________________________________________
2)__________________________________________
____________________________________________

14

Use of following characters


E_________________________
G_________________________
X_________________________
C_________________________

15

What is the output of following


class Tension{ public static void Main(){
System.Console.Write(Music);
System.Console.WriteLine(DJ Party);
System.Console.Write(@Happy New
Year20\n12);
System.Console.Write(-----------\\n------------)}
Line 1 :
______________________________________ Line
2 : ______________________________________
Line 3 :
______________________________________
Define delegates_________
_____________________
____________________________________________
All delegates are of __________ type and
represents ____________________ class.

2 Advantages of using
delegates___________________
_____________________________________________
_____________________________________________

General syntax for declaring a delegate

List four steps of using delegates


17
1>__________________________________________
_
18 Ever C# program contains three ways of I/O
2>__________________________________________
_
namely
3>_________________________________________
1)____________2)____________3)_____________
__
4>__________________________________________
_
Write the output of following: Using
19 Two restrictions for using Multicast
System;
delegates. 1) ____
Console.WriteLine({0:c},
____________________________________________
-1234.9876);_____________
2)__________________________________________
Console.WriteLine({0:0000},
_
20 What are
123);________________
events_______________________________
Console.WriteLine({0:##,000%},0.12345)
____________________________________________
;_________
Console.WriteLine(0:D8,
90909);________________
Marks Obtained __________ in Words ___________________________ Signature of the
Examiner________
T. Y. B. Sc. IT
SEMESTER VI
Chap 18 & 01 Test Time 30 Min Total 30 Marks
Date____________
Students Name: ____________________________________________ Roll
No:

9
&
1
0

16

Write the proper


f) Must be
match
executed
1.
Bad class cast : g)
Runtime
___
h)
Variable
2.
DivideByZeroEx
argument
ception__
i) Before program
3.
byte
start
b=(int)3d :___
j) ArithmeticExcepti
4.
finally : _______
on
int wwf= 2147483333 for(int i=0;i<2;i--)
1) unchecked(wwf *=
123456);___________________
___________________________________________
2) checked(wwf *=
123456);_____________________
___________________________________________
Advantage of using general catch handler.
___________________________________________
___________________________________________
___________________________________________
When explicit conversion to base class or
interface fails _______________________
exception is raised.
ArgumentException occurs when
_______________
___________________________________________
Write the execution sequence of following;
Line 1. UP: try { double a = 20,
b=double.Parse(0d);
Line 2. Console.WriteLine(A = {0} B=
{1},a,b);}
Line 3. catch(FormatException fe)
Line 4: {Console.Write(fe) ; goto UP;}
Line 5. finally{Console.WriteLine(Long
wait to run); }
Answer :Line ____ Line _____ Line ____
Line _____ Then
______________________________________
Comment on finally
block_______________________
____________________________________________
____________________________________________
____________________________________________
List 2 compile time errors: 1)
_____________________
____________________________________________
2)
__________________________________________

1
1

What if the general catch handler is placed


before Exception block or Exception block
before IOException
___________________________________________
___________________________________________
___________________________________________

1
2

Complete the following


Exception

DivideByZeroException

1
3

How CLR reacts for unhandled run time


errors. ______
____________________________________________
____________________________________________
____________________________________________

1
4

State whether the following are run time or


compile time errors or no error or both:
1) int zero=1, one=zero; zero = one %
1.0;__________
2) if(a==(b=c) ) msg=heee
____________________
3) ArrayList c; c.Add();
_______________________
4) string @if= @if;
________________________

1
5

Four steps for handling run time exception


1. _________________ 2. _____________________
3. _________________ 4. _____________________

Answer the following question


1) Why C# is versonable and
interoperable? -- 3

1
0

Two Differences between run time and


compile time errors
1.____________________________________
___________________________________________
2) _________________________________________
___________________________________________
How to create custom exceptions
__________________________________________
__________________________________________
__________________________________________
__________________________________________
1)
Every catch must have error handling
code. Yes / No.
2)
All .Net exceptions are derive of
System.Exception Y / N

2) Compare C#, C++ and Java


w. r. t. following points -- 3
a) Releasing Memory
b) Accessibility of member.
c) Boolean data type.
3) List any six applications of
C#. ---- 3
4) Briefly explain origin of C#.
---- 3
5) Any six features of C# --- 3

Marks Obtained __________ in Words ___________________________ Signature of the


Examiner________

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