You are on page 1of 3

C# .

Net
1. Define a console-program to create an array of integers. Initialize the array and assign the values in array. Define a method to pass the array and modify array elements. Display array elements by using for-each loop. 2. Define a console application to display all the arguments passed to command line while running the application. The user can pass any number of arguments that should be displayed. Use length property of array and for-next loop. If there are no arguments in command line display message No Arguments. 3. Create a console application to display different messages depending on the command line argument value. Use Select-case statements.(similar to switch block) 4. Define a console application with a class Employee with variables as emp_id (int), name (String) and Grade (double).Define five different constructors for this class to initialize the variable values. Define Finalize method to display the Grade value. Define a for loop in Main for 4 iterations and inside for loop create Employee object. After the for loop call Garbage Collector. 5. Create a class library and define class User. In User class define the public, protected and Friend functions. Create a console application and add a reference to this library and call the user methods by creating the object. Which are the functions allowed to call here? 6. Create a console application to demonstrate the different styles of message boxes by calling MsgBox functions with different parameters and icons as well. Check and display the result of MsgBox on the screen for each MagBox (i.e. which MsgBox button user has clicked.yes|no|Cancel) 7. Define a console application project to display the different formatting styles used in display methods(i.e. Console.writeLine()) 8. Create a console application with a class Account having variables as id (int) and name (String).Add property account-no which can be set and get. Add a ReadOnly property IntRate and WriteOnly property Password for this class. Add a shared property Branch with set/get methods. In main method create objects of Account and test these properties and print the results on the screen. 9. Define a class library with three namespaces as admin, HR,Sales.Add three classes as User, Manager and Executive in these namespaces respectively. Define different

protected and Friend methods in these classes and test their access outside library in a console application. 10. Define a class library having class Mould with instance variables as protected color (string), and public price (int).Add a shared variable size (int) has private access. Add public methods to change the size, to get the price and read the color. In console application define a subclass Statue deriving from Mould and having overridden method for getting the price and color. Add a shadowing method for reading/setting the size of statue objects. Define a main method and test all these combinations. 11. Create a console application. Add class Account having variables as num (integer) name (String), bal (double), ac_code (byte).define four different constructors to initialize these variables. Define a class User deriving from account class. In user class add variables as group_no (int) and mail_id (string).Define three constructors for User class and within them call different parameterized constructors of Account. Can we call these base class constructors as second or last statement in User constructors? Define another class Admin. Can the User class derive from both account and Admin classes? How to make Class Admin such that No class can derive from it?.How to make Account class such that some methods will not be allowed to override ? 12. Define a interface Human with methods as walk and speak. Define a class User implementing Human. Define a work() method in User class. Add a class Person also implementing Human. Add a method Behave in Person class. In Main method create objects of Person and User and assign them to Human type and call Human methods. Can the work and Behave methods be called through Human types? Can we create the interface objects by calling interface Constructors ? Justify your answer. 13. Define an interface WorldBank having methods as setHousingLoans and GrantRuralAid(String countryName).Define interface RBI inheriting WorldBank.Define a class SBI implementing RBI.In main method crate SBI objects and assign them to WorldBank and RBI types and call their respective methods. 14. Define a interface User and Employee. Add methods work(int hours) and get Salary() in Employeee.Add methods checkMail and celebrateVacation in User. Define a class Person implementing both these interfaces and add a method MakeFood in Person .In main method create single object of Person and use it to represent User and Employee types at a time and call respective methods. Can User type call Employee methods and Employee type call User methods? Can User and Employee call the MakeFood method of Person ?

15. Define an abstract class Bank having abstract methods as CreateAccount depositAmount and withDrawAmount.Add method definitions for CalculateInterest and SetIntereset as Non-Overridable.Define two classes BharatiBank and RupeeBank to derive from bank class.In main ,method create objects of BharatiBank and RupeeBank to represent Bank type and call their respective methods. Can Bank type call the derived classes own methods that re not defined in bank ?

You might also like