Questions
Questions
using System;
class Car
{
public string Color;
public void Honk()
{
Console.WriteLine("BEEP BEEP!" );
}
}
class Result
{
static void Main(string[] args)
{
Car Ford = new Car(); ;
Ford.Honk();
Console.ReadLine();
}
}
using System;
public class FunctionCount
{
public static int count = 0;
public static void CountFunction()
{
count++;
System.Console.WriteLine("Count function is Called by Main {0} times.",
count);
}
public static void Main(string[] args)
{
for (int var = 0; var < 10; var++)
{
FunctionCount.CountFunction();
}
Console.ReadLine();
}
}
How many times would the CountFunction method be called?
13 You are creating a calculator application by using the following code:
using System;
namespace Calculator
{
class Calculator
{
public int number1, number2;
public Calculator(int num1, int num2)
{
number1 = num1;
number2 = num2;
}
public static Calculator operator -(Calculator c1)
{
c1.number1 = -c1.number1;
c1.number2 = -c1.number2;
return c1;
}
public void Print()
{
Console.WriteLine(" number1=" + number1);
Console.WriteLine(" number2=" + number2);
Console.ReadLine();
}
}
class EntryPoint
{
static void Main()
{
Calculator calc = new Calculator(15, -25);
calc.Print();
14 Predict the output of the following code:
using System;
namespace ConsoleApplication1
{
struct NumberCount
{
public int i;
public NumberCount(int initval)
{
this.i = initval;
}
public static NumberCount operator ++(NumberCount arg)
{
arg.i++;
return arg;
}
}
class TestClass
{
static void Main(string[] args)
{
NumberCount Count1 = new NumberCount(1);
NumberCount Count2 = Count1++;
Console.WriteLine(Count1.i);
Console.WriteLine(Count2.i);
Count2 = ++Count1;
Console.WriteLine(Count1.i);
Console.WriteLine(Count2.i);
Console.ReadLine();
}
}
}
15 Consider the following code snippet:
class CalculateMax
{
public int Max(int number1, int number2)
{
if (number1 > number2)
{
return number1;
}
else
{
return number2;
}
}
public float Max(float number1, float number2)
{
if (number1 > number2)
{
return number1;
}
else
{
return number2;
}
}
}
Analyze the preceding code and identify the approach used to implement
polymorphism.
16 Jim has to develop an application for his college. While creating the application,
he decides to re-use some methods of an existing class B1 in a new
class, Derived. He writes the following code:
using System;
public class B1
{
public void Function1()
{
Console.WriteLine("Base class");
}
}
class Derived : B1
{
void Function1();
However, the preceding code gives a compile-time error. Analyze the preceding
code and identify the line of code causing the error.
17 Kim has created a C# application and used abstract classes in it. She
encounters errors, whenever she tries to compile the application. She has used
the following code snippet in her application:
using System;
abstract class Animal
{
public abstract void FoodHabits()
{
}
}
class Carnivorous: Animal
{
public override void FoodHabits( )
{
Console.WriteLine("The Carnivorous animals eat only meat");
}
}
class Herbivorous: Animal
{
public override void FoodHabits( )
{
Console.WriteLine("The Carnivorous animals eat only plants");
}
}
What is the source of error in the preceding code?
18 Tim is developing an application using C#. He has to create a class named Car
containing a method named Engine. The engine method has a statement that
displays a message to the user. Tim wants to override the Engine method in a
class named Truck that is derived from the Car class. Tim has written the
following code to perform the required task:
using System;
class Car
{
public void Engine()
{
Console.WriteLine("Car has a smaller engine than a truck.");
}
}
class Truck : Car
{
public override void Engine()
{
Console.WriteLine("Truck has a bigger engine than a car.");
}
static void Main()
{
Truck obj = new Truck();
obj.Engine();
Console.Read();
}
}
However, the preceding code gives an error when it is executed. Identify the
reason for the error.
19 Consider the following code:
using System;
namespace Test
{
sealed class myClass
{
void display()
{
Console.WriteLine("Hello");
}
}
class disp : myClass
{
void abcd()
{
Console.WriteLine("Wassup");
}
static void Main()
{
disp obj = new disp();
obj.abcd();
Console.Read();
}
}
}
The preceding code gives error when it is compiled. Analyze the code and
identify the line of code causing the error.
20 Lim is creating an application using C#. He has created an interface named
IOrderdetails that has two methods, UpdateCustStatus() and TakeOrder(). The
interface is implemented by a class named ItemsDetails. Lim has written the
following code snippet:
However, the code doesn't compile and gives a compile-time error. Identify the
reason for the error.
21 Predict the output of the following code:
using System;
class Calculator
{
static int number1, number2, total;
Calculator(int num1, int num2)
{
number1 = num1;
number2 = num2;
}
public void CalculateNumber()
{
total = number1 + number2;
}
public void DisplayNumber()
{
Console.WriteLine("The total is : {0}", total);
}
public static void Main(string[] args)
{
int var1, var2;
Console.WriteLine("Enter Value 1 :");
var1=Convert.ToInt16(Console.ReadLine());
Console.WriteLine("Enter Value 2 :");
var2 = Convert.ToInt16(Console.ReadLine());
Calculator C1 = new Calculator(var1,var2);
C1.CalculateNumber();
C1.DisplayNumber();
Console.ReadLine();
}
}
using System;
class Calculator
{
static int number1=20;
static int number2=30;
static int total=0;
public void CalculateNumber()
{
total = number1 + number2;
Console.WriteLine("The Total is :{0}", total);
}
public static void Main(string[] args)
{
Calculator C1 = new Calculator();
C1.CalculateNumber();
Console.ReadLine();
}
}
You need to add a destructor of the Calculator class so that it displays the
message "Program Terminating" whenever a user exits the program. Identify
the correct lines of code that you can add to the Calculator class to implement
the desired functionality in your application.
24 Jim is creating an application for his college project. The application has a class
named myConnection with a method named dbCon() that uses a database
connection. Jim wants to add another method to the class to release the
database connection as soon as the dbCon() method completes execution.
How will Jim perform the required task?
25 Predict the output of the following code:
using System;
namespace Objects
{
class TestCalculator
{
TestCalculator()
{
Console.WriteLine("Constructor Invoked");
}
~TestCalculator()
{
Console.WriteLine("Destructor Invoked");
Console.Read();
}
public static void Main(string[] args)
{
Console.WriteLine("Main() Begins");
TestCalculator calc1 = new TestCalculator();
{
Console.WriteLine("Inner Block Begins ");
TestCalculator calc2 = new TestCalculator();
Console.WriteLine("Inner Block Ends");
}
Console.WriteLine("Main() ends");
Console.Read();
}
}
}
26 Consider the following code snippet:
class FileHandling
{
void fileAccess()
{
FileStream File1= new FileStream("C:\\Myfile.txt", FileMode.Append,
FileAccess.Write);
}
}
Analyze the preceding code and identify the use of the FileMode.Append
enumerator in the fileAccess() method.
27 Tom has to create an application in C# that would be used to read data from a
string buffer. The application accepts data in the string buffer from the user and
displays it on screen. Which of the following code snippets can he use to
perform the required task?
28 Predict the output of the following code snippet:
using System;
using System.IO;
namespace File_Handling
{
class Tester
{
class division
{
void DivideNum()
{
int a;
int b;
int result;
Console.WriteLine("Enter first number");
a = Convert.ToInt32(Console.ReadLine());
Console.WriteLine("Enter second number");
b = Convert.ToInt32(Console.ReadLine());
try
{
result = a / b;
Console.WriteLine("The result after dividing the two numbers is: {0}", result);
}
catch (IndexOutOfRangeException e)
{
Console.WriteLine("e.message");
}
}
However, the preceding code does not handle the exception if the user gives
the value of b as zero. Identify the reason for this.
33 You have to develop an application using C#. The application should have a
feature that enables it to communicate with different processes. Which of the
following predefined classes do you need to use in your application to perform
the required task?
34 Jim is developing a C# application. He has used attributes in the application.
Now, he needs to specify essential information of an attribute, which he has
used in the application. Which of the following options would enable him to
perform the required task?
35 John is developing an application using C#. He wants to use one of the
predefined attributes of .NET that would enable him to call the member
functions of unmanaged code from his application. Which of the following
predefined attributes would allow him to perform the required task?
36 You are developing a C# application. You have defined a custom attribute for
your application. Now, you want to apply the custom attribute to every element
of your application, such as classes and events using a single member of the
AttributeTargets enumerator. Which of the following members of
AttributeTargets enumerator can you use to perform the preceding task?
37 Tim has developed an application that has some custom attributes defined in it.
Now, he wants to access the metadata of the preceding application while it is
running. Which of the following namespaces does Tim need to use to access
the metadata of the running application?
38 You have to create an application that accepts data from the user and saves
the same into a text file named Myfile.txt. Which of the following code snippets
would you use to perform the required task?
39 Consider the following code snippet:
void display()
{
try
{
FileStream fs = new FileStream("orders.txt", FileMode.Open,
FileAccess.Read);
StreamReader sr = new StreamReader(fs);
String str = sr.ReadLine();
Console.WriteLine(str);
Console.Read();
}
catch (IOException e)
{
Console.WriteLine(e.Message);
Console.Read();
}
catch (NullReferenceException e1)
{
Console.WriteLine(e1.Message);
}
catch (InvalidCastException e2)
{
Console.WriteLine(e2.Message);
}
catch (ArgumentNullException e3)
{
Console.WriteLine(e3.Message);
}
}
The preceding code gives an exception that displays the message 'Could not
40 John has to create an application using C# that stores data in a binary file.
There are two variables in the application, an integer variable i, and a double
variable d. The application has to store the values of the i and d in a binary file
named binfile.DAT. The application should always create a new file whenever it
writes data to the file. Identify the correct code snippet that John has to write to
perform the required task.
41 Jim is creating an application using C#. The application has to calculate the
sum of values in an integer array. Jim needs to ensure that the application
displays an exception message if the integer array is assigned any out of range
value. Identify the code snippet that would help Jim to handle the exception.
42 You have created an application for a fast food joint. The workers of the fast
food joint save the order data in a common file named orders.txt. You have
used the following code snippet to save the order data:
void Write()
{
Console.WriteLine("Enter order data");
String str=Console.ReadLine();
FileStream fs = new FileStream("orders.txt", FileMode.Append,
FileAccess.Write, FileShare.None);
StreamWriter sr = new StreamWriter(fs);
String str = "Hello";
sr.Write(str);
sr.Flush();
sr.Close();
fs.Close();
}
However, the preceding code gives a compile-time error. Identify the line(s) of
code causing the error.
43 Predict the output of the following code snippet:
Identify the line of code that a C# compiler first looks for in the preceding code
to compile it.
51 You have declared a variable named x and initialized it with the value 20. In
addition, you have declared a boolean variable named Result. Which of the
following code snippets would you use to store the value, true in the Result
variable when the value of x is not equal to 10?
52 Danny wants to use a looping construct in which the body of the loop is
executed at least once and the condition is evaluated for subsequent iterations.
Which of the following looping constructs will Danny use to achieve the required
task?
53 Determine the output of the following code snippet:
int var= 1;
for (; var <= 2; var++)
{
Console.WriteLine ("Value of variable is: {0}", var);
}
54 You have been asked to create a marks-list for the school students using
arrays in the C# language. However, you are not sure about the number of
students in the school. Identify which of the following concepts can be used to
handle an array list of unknown numbers?
55 Consider X=20 and Y=20. Determine the values of X and Y from the following
arithmetic expressions:
X+=Y;
X-=Y;
X*=Y;
X/=Y;
X%=Y;
56 From the following steps of instructions, identify the correct sequence of steps
for the execution of a for loop.
57 You have been asked to maintain bill details of an employee in a single
variable. Which of the following programs will you use for the same?
58 Predict the output of the following code:
using System;
namespace EnumDays
{
class EnumTest
{
enum Days { Sat, Sun, Mon, Tue, Wed, Thu, Fri};
static void Main (string[] args)
{
int First_Day = (int)Days.Sat;
int Last_Day = (int)Days.Fri;
Console.WriteLine("Sat = {0}", First_Day);
Console.WriteLine("Fri = {0}", Last_Day);
Console.ReadLine();
}
}
}
59 You want to create a multidimensional array that calculates the sum of the
array elements. For this, you have declared a multidimensional array by using
the following code snippet:
int sum=0;
int rowSum;
int[,] mArray = new int[2, 4]{
{2,2,2,2},
{3,3,3,3},
};
Identify the correct code snippet that will help you to calculate the sum of
elements of mArray array.
60 You have been asked to write a C# program to check whether the year entered
by the user is a Leap year. For this, you have written the following code:
using System;
class LeapYear
{
static void Main(string[] args)
{
int Year;
Console.WriteLine("Enter the year: ");
Year = Convert.ToInt32(Console.ReadLine());
The preceding code results in an error. Identify the statement(s) that can
generate an error.
61 You have written the following code by using the switchcase construct:
int var;
var = 500;
switch(&&var)
{
case 100:
Console.WriteLine("Century");
break;
case 200:
Console.WriteLine("Double Century");
break;
case 300:
Console.WriteLine("Triple Century");
break;
default:
Console.WriteLine("Invalid value");
break;
}
Analyze the preceding code and identify the statement(s) that can produce an
error on compilation.
62 You have written the following code to accept five numbers and print the sum of
all the positive numbers entered by the user:
using System;
class BreakContinue
{
static void Main(string[] args)
{
int incr, SumNum, number;
for (SumNum = number = incr = 0; incr < 5; incr += 1)
{
Console.WriteLine("Enter a positive number");
number = (Console.ReadLine());
if (number <= 0)
continue;
SumNum = SumNum + number;
}
Console.WriteLine("The sum of positive numbers entered is {0}",
SumNum);
Console.ReadLine();
}
}
Analyze the preceding code and identify the statement(s) that can produce an
error on compilation.
63 You have written the following program that checks a palindrome character
array:
using System;
namespace ManipulateArray
{
class Palindrome
{
static void Main(string[] args)
{
char[] Str = new char[10];
Console.WriteLine("Enter a Palindrome string (Max 10 Char):");
Str = Console.ReadLine().ToCharArray();
Console.WriteLine(CheckPalindrome(Str));
Console.ReadLine();
}
private static bool CheckPalindrome(char[] myString)
{
int startChar;
int lastChar;
startChar = 0;
lastChar = myString.Length - 1;
while (startChar < lastChar)
{
if (myString[startChar] = myString[lastChar])
{
startChar++;
lastChar--;
}
else
{
return false;
64 You have written the following C# code that generates the Fibonacci series
upto 200:
using System;
class Fibonacci
{
static void Main(string[] args)
{
int number1;
int number2;
number1=number2=1;
Console.WriteLine("{0}", number1);
while (number2 <= 200)
{
Console.WriteLine(number2);
number2 += number1;
num1 = number2-number1;
}
Console.ReadLine();
}
}
However, the preceding code when compiled generates an error. Identify the
incorrect statement that generates the error in the preceding code.
65 ______________ involves extracting only the relevant information.
66 Which of the following elements of the method declaration is used to pass and
receive data from a method?
67 The method name is followed by ____________ even if the method call has no
parameters.
68 ___________ allows one interface to be used for multiple functions and
reduces the complexity within the functions of a class of a C# program.
69 Which of the following keywords restricts the users from inheriting the class in
C#?
70 Which of the following access specifiers allows a class to expose its member
variables and member functions to other functions and objects of any class?
71 Which of the following types of operators cannot be overloaded?
72 Which of the following types of relationships exist between a handbag and a
zip?
73 Which of the following keywords can be used by derived classes to implement
a virtual method defined in the base class?
74 ___________ is used when you want a standard structure of methods to be
followed by the classes, where classes will implement the functionality.
75 You are working on a C# application. In the application , you want the base
class to hide its member variables and member functions from other class
objects and functions, except the child class. Which of the following access
specifiers will you use to achieve the same?
76 Consider the following code snippet that declares a method named AddNumber
in the calc class:
class calc
{
public int AddNumber(int num1, int num2)
{
int result;
result = num1 + num2;
return result;
}
}
Identify the correct code snippet for calling the AddNumber() method.
77 You want to declare a variable named Mark in the Student class to store some
value. In addition, you want that only one copy of the Mark variable should exist
for the Student class. Which of the following keywords can help you to declare
such a variable?
78 You want to overload the + operator in a C# program. Which of the following
options is the correct syntax to define the function for overloading the +
operator?
79 Sam wants to declare an interface named IOrderDetails, which contains two
methods, UpdateCustStatus() and TakeOrder(). Identify the correct code
snippet that can help Sam to achieve the required task.
80 Consider the following statement:
"You do not want to see the complex processes of a vacuum cleaner that are
needed to convert electricity into suction power".
Which of the following concepts provided by the C# programming language can
be used to implement the preceding statement?
81 Danny have been asked to calculate the area of the geometrical figures;
square, rectangle, and triangle. To achieve this, he created the CalcArea()
method that is defined in the program to find the area of all the three types of
geometrical figures. The CalcArea() method will find the area depending on the
number of inputs provided by the user. Which of the following C# mechanisms
has Sam followed to find the area of the geometrical figures?
82 Consider the following statements:
Further, you have created a class named Student that contains a method
named Wakeup(). You want that the WakeUp() method should be called at 6
am. Identify the correct code snippet that allows the Student class to subscribe
to the event named TimeToRise.
98 _____________ class is used to read characters from a byte stream.
99 A _____________ occurs when an application compiles and runs properly but
does not produce the expected results.
100 The ______________ contains constants for controlling the kind of access that
the FileStream constructors can have on a file.
101 Which of the following definitions correctly describes the peek method of the
StreamReader class?
102 Which of the following definitions correctly defines the Flush method of
StreamWriter class?
103 Predict the output of the following code:
using System;
namespace ThreadExample
{
class MainThreadExample
{
public static void Main(string[] args)
{
Thread Th = Thread.CurrentThread;
Th.Name = "MainThread";
Console.WriteLine("The current thread after name change: {0}",
Th.Name);
Console.ReadLine();
}
}
}
104 Consider the following code:
using System;
using System.Threading;
namespace ThreadSample
{
class BasicThreadApp
{
public static void ChildThreadCall()
{
Console.WriteLine("Child thread started");
int SleepTime = 5000;
Console.WriteLine("Sleeping for {0} seconds", SleepTime/1000);
ChildThread.Sleep(SleepTime);
Console.WriteLine("Waking Up");
}
public static void Main()
{
ThreadStart ChildRef = new ThreadStart(ChildThreadCall);
Console.WriteLine("Main - Creating Child thread");
Thread ChildThread = new Thread(ChildRef);
ChildThread.Start();
Console.WriteLine("Main - Have requested the start of child
thread");
Console.ReadLine();
}
}
}
The preceding code generates a compile-time error. Identify the line of code
that will generate the error.
105 Sam has created the following method in a C# application to accept and print
book details:
Further Sam wants to call this method by using thread in the application.
Identify the correct code snippet that Sam should implement to create a thread
and call the BookDetails() method by using the newly created thread.
106 Jonathan has developed a notepad application by using C#. In the application,
he has created three methods namely, Write(), Save(), and Print() to write data
in a text file, save the file, and print the file, respectively. He wants to call these
methods by using threads. Further, he wants that the Save() method should be
called after the execution of the Write() method and the Print() method should
be called after the file has been saved. Which of the following code snippets
can help Jonathan to accomplish the preceding tasks?
107 Stella wants to create a clock application in C#. After every five seconds, the
application displays a message to the user that 5 seconds are over. This
should continue till one minute is over. Which of the following codes can help
Stella to implement the required task?
108 Mr. Beth has been assigned a task to create a game application in C# that
gives a user 15 seconds to type the text printed on the screen. He writes the
following code for the game:
using System;
using System.IO;
using System.Threading;
namespace Game
{
public class Typometer
{
public void StartGame()
{
String str = "The Cheater Cheats the Cheating Code";
Console.WriteLine(str);
String userVal = Console.ReadLine();
if (userVal == str)
{
Console.WriteLine("\nYou WON! Game Over! \n");
}
else
{
Console.WriteLine("\nThe strings does not match..Game Over!
\n");
}
Thread.Sleep(15000);
}
}
class Game
{
static void Main(string[] args)
{
Console.WriteLine("You have to complete the game within 15
109 Predict the output of the following code:
using System;
using System.Threading;
class ThreadSchedule
{
public static void Doctor()
{
for (int Cnt = 0; Cnt < 2; Cnt++)
{
Console.Write("\nDoctor: Give medicine " + (Cnt + 1));
Console.WriteLine();
Thread.Sleep(1000);
}
Console.WriteLine("Doctor: Work finished");
}
public static void Nurse()
{
for (int Cnt = 0; Cnt < 2; Cnt++)
{
Console.Write("Nurse: Medicine " + (Cnt + 1) + " given\n");
Console.WriteLine();
Thread.Sleep(1000);
}
Console.WriteLine("Nurse: Work finished");
}
using System;
using System.Threading;
namespace ThreadExample
{
class FileAccess
{
public void WriteData(string Data)
{
Monitor.Enter(this);
Console.WriteLine("Writing data to file");
for (int Cnt = 0; Cnt < 5; Cnt++)
{
Console.WriteLine("Writing in Line {0}", Cnt );
}
Monitor.Exit();
}
}
class ThreadMonitorClass
{
public static FileAccess Fd = new FileAccess();
public static void ChildThread1()
{
Console.WriteLine("Thread 1 started");
Fd.WriteData("T1");
}
public static void ChildThread2()
{
Console.WriteLine("Thread 2 started");
Fd.WriteData("T2");
}
public static void Main()
111 Consider the following code that locks the code of the UpdateAC() method by
using the lock statement:
using System;
using System.Threading;
namespace ThreadExample
{
class FileAccess
{
public void UpdateAC(string Data)
{
lock()
{
Console.WriteLine("Updating Salary Accounts: {0}", Data);
for (int Cnt = 0; Cnt < 5; Cnt++)
{
Console.WriteLine("Updated {0} record", Cnt+1);
}
}
}
}
class ThreadMonitorClass
{
public static FileAccess Fd = new FileAccess();
public static void ChildThread1()
{
Console.WriteLine("Thread 1 started");
Fd.UpdateAC("T1");
}
public static void ChildThread2()
{
Console.WriteLine("Thread 2 started");
Fd.UpdateAC("T2");
}
112 Sim has been assigned the task of creating a C# application for a game. She
has to use the Thread class to perform different functions in the game.
Therefore, she created an instance of the Thread class in the application. Now,
she has to allocate system resources such as memory to the instance of the
Thread class. How will she perform the required task?
113 Jim has to create an application that accepts two numbers from the user and
displays the remainder after dividing the two numbers. He wants to implement
exception handling in his application. He wants to handle the exception in such
a way that application displays the message Calculation completeirrespective
of any exception. Which of the following code snippets will help Jim to perform
the required task?
1 Which of the following options provides a step-by-step evaluation of values in
the variables of the program?
2 Which of the following options means a sequence of instructions that are
repeated more than once?
3 Which of the following statements enables the control of an application to pass
back from a module to the main program?
4 Which of the following operators can be used to ensure that all specified
conditions are met to execute an operation?
5 You have created a program to calculate the sum of a set of values. Now, you
want to evaluate the output of the program with a set of sample values. Which
of the following options enables you to accomplish the required task?
6 Consider the following statements:
Statement A: Loops are of two types, fixed loops and variable loops.
Statement B: The number of repetitions for a fixed loop is not known.
Which of the following options is correct about the preceding statements?
7 You have to create a complex program that is divided into individual modules.
Which of the following options enables you to accomplish the required task?
Logic building
8 Tim has to create a project on the solar system for his school. He decides to
use the Internet to search for the information on Mars, Saturn, and Jupiter. He
wants to search for the websites or Web pages that contain the information
about all the planets specified in the search query. How should Tim phrase the
search query to get the desired result?
9 Set of instructions given to a computer to perform a particular job is called a
____________.
10 Which of the following keywords in pseudocode is an iterative construct with a
testing statement at the bottom of the iterative set of statements?
11 Identify the constants from the following list:
"Bat"
Payment
10
"Peter"
Marks
12 Consider the following statements:
Statement A: The % operator returns the remainder value when one number is
divided by another number.
Statement B: Logical operators are used to combine expressions containing
arithmetic operators.
4. Select the
appropriate option
from the Windows
and buttons drop-
down list box.
5. Click the OK
button to apply the
changes.
2, 1. Click the right
mouse button on the
blank area of the
Desktop screen.
2. Select the
Appearance tab in the
Display Properties
dialog box.
3. Select the
Properties option from
the menu.
4. Select the
appropriate option
from the Windows
and buttons drop-
down list box.
5. Click the OK button
to apply the changes.
3, 1. Select the
Appearance tab in the
Display Properties
dialog box.
2. Click the right
mouse button on the
blank area of the
Desktop screen.
3. Select the
Properties option from
the menu.
4. Select the
appropriate option
from the Windows
and buttons drop-
down list box.
5. Click the OK button
to apply the changes.
4, 1. Click the right
mouse button on the
blank area of the
Desktop screen.
2. Select the
Properties option
from the menu.
3. Select the
Appearance tab in
the Display
Properties dialog box.
4. Click the OK
button to apply the
changes.
5. Select the
appropriate option
from the Windows
and buttons drop-
down list box.
1
1, 1. Select the Find
option
2. Click the Edit
menu
3. Enter the required
word in the Find what
text box in the Find
dialog box.
4. Click the Find Next
button to find the
required word.
2, 1. Click the Edit
menu
2. Select the Find
option
3. Enter the required
word in the Find what
text box in the Find
dialog box.
4. Click the Find Next
button to find the
required word.
3, 1. Select the Find
option
2. Enter the required
word in the Find what
text box in the Find
dialog box.
3. Click the Edit
menu
4. Click the Find Next
button to find the
required word.
4, 1. Click the Edit
menu.
2. Enter the required
word in the Find what
text box in the Find
dialog box.
3. Select the Find
option
4. Click the Find Next
button to find the
required word.
2
WBT /CBT Questions
1, Language bar 2, Smart tags 3, Task pane 4, Ask a question box 3
1, Task panes 2, Smart tags 3, Language bar 4, Ask a question box 2
1, Task panes 2, Smart tags 3, Language bar 4, Ask a question box 3
1, Menu bar 2, Title bar 3, Status bar 4, Scroll bar 1
1, Reveal Formatting 2, Clear Formatting 3, Styles and
Formatting
4, Table AutoFormat 4
1, Merge multiple
copies of a document
2, Display the format
of the document
3, Translate
document text to
another language
4, E-mail a document
to a group of people
4
1, Trace Precedents 2, Trace Dependents 3, Trace Errors 4, Evaluate Formula 2
1, Slide Layout 2, Design Templates 3, Color Schemes 4, Slide Transition 2
1, Web Page Preview 2, Print Preview 3, Send To 4, Page Setup 2
1, Mail Merge 2, AutoCorrect 3, AutoContent 4, Shared Documents 1
1, Task panes 2, Smart Tags 3, Language Bar 4, Ask a Question
Box
2
1, Drawing Canvas 2, Show\Hide
Whitespace
3, Watermarks 4, Shared Documents 3
1, Clear Formatting 2, Styles and
Formatting
3, Reveal Formatting 4, List Styles 3
1, Auto Format 2, Border Style 3, Background 4, Tab Color 4
1, Rotate images 2, Create photo album 3, Compress pictures 4, Create handouts 3
1, 1. Place the
insertion point on the
changed text.
2. Point to the blue
colored button
underneath the text
for displaying the
AutoCorrect options
smart tag.
3. Click the
AutoCorrect options
button.
4. Select Change
back to "acme"
command from the
AutoCorrect Options
Actions menu.
2, 1. Place the
insertion point on the
changed text.
2. Click the
AutoCorrect options
button.
3. Point to the blue
colored button
underneath the text
for displaying the
AutoCorrect options
smart tag.
4. Select Change
back to "acme"
command from the
AutoCorrect Options
Actions menu.
3, 1. Point to the blue
colored button
underneath the text
for displaying the
AutoCorrect options
smart tag.
2. Place the insertion
point on the changed
text.
3. Click the
AutoCorrect options
button.
4. Select Change
back to "acme"
command from the
AutoCorrect Options
Actions menu.
4, 1. Place the
insertion point on the
changed text.
2. Point to the blue
colored button
underneath the text
for displaying the
AutoCorrect options
smart tag.
3. Select Change
back to "acme"
command from the
AutoCorrect Options
Actions menu.
4. Click the
AutoCorrect options
button.
1
1, 1. Click the Table
AutoFormat icon on
the Tables and
Borders toolbar.
2. Place the mouse
pointer inside the
table.
3. Select a table style
from the Table styles
list box in the Table
AutoFormat dialog
box.
4. Click the Apply
button.
2, 1. Place the mouse
pointer inside the
table.
2. Click the Table
AutoFormat icon on
the Tables and
Borders toolbar.
3. Select a table style
from the Table styles
list box in the Table
AutoFormat dialog
box.
4. Click the Apply
button.
3, 1. Place the mouse
pointer inside the
table.
2. Select a table style
from the Table styles
list box in the Table
AutoFormat dialog
box.
3. Click the Table
AutoFormat icon on
the Tables and
Borders toolbar.
4. Click the Apply
button.
4, 1. Place the mouse
pointer inside the
table.
2. Select a table style
from the Table styles
list box in the Table
AutoFormat dialog
box.
3. Click the Apply
button.
4. Click the Table
AutoFormat icon on
the Tables and
Borders toolbar.
2
1, 1. Select the
Picture watermark
option in the Printed
Watermark dialog
box.
2. Select the Printed
Watermark command
from the Format
menu.
3. Click the Select
Picture button.
4. Select the required
image in the Insert
Picture dialog box
and click the Insert
button.
2, 1. Select the
Picture watermark
option in the Printed
Watermark dialog
box.
2. Click the Select
Picture button.
3. Select the Printed
Watermark command
from the Format
menu.
4. Select the required
image in the Insert
Picture dialog box and
click the Insert button.
3, 1. Select the
Printed Watermark
command from the
Format menu.
2. Select the Picture
watermark option in
the Printed
Watermark dialog
box.
3. Click the Select
Picture button.
4. Select the required
image in the Insert
Picture dialog box
and click the Insert
button.
4, 1. Select the
Printed Watermark
command from the
Format menu.
2. Select the Picture
watermark option in
the Printed
Watermark dialog
box.
3. Select the required
image in the Insert
Picture dialog box
and click the Insert
button.
4. Click the Select
Picture button.
3
1, 1. Select the New
Photo Album
command from the
Insert menu.
2. Click the
Scanner/Camera
button.
3. Select the pictures
that need to be
inserted and click the
Insert button.
4. Click the Create
button.
2, 1. Click the Create
button.
2. Select the New
Photo Album
command from the
Insert menu.
3. Click the
Scanner/Camera
button.
4. Select the pictures
that need to be
inserted and click the
Insert button.
3,1. Select the New
Photo Album
command from the
Insert menu.
2. Click the File/Disk
button.
3. Select the pictures
that need to be
inserted and click the
Insert button.
4. Click the Create
button.
4, 1. Select the New
Photo Album
command from the
Insert menu.
2. Click the Create
button.
3. Click the File/Disk
button.
4. Select the pictures
that need to be
inserted and click the
Insert button.
3
1, 1. Select the Sum
command.
2. Click in a cell, and
then click the down
arrow of the AutoSum
button in the standard
toolbar.
3. Select the range of
cells that need to be
added.
4. Press the Enter
button.
2, 1. Click in a cell,
and then click the
down arrow of the
AutoSum button in the
standard toolbar.
2. Select the Sum
command.
3. Select the range of
cells that need to be
added.
4. Press the Enter
button.
3, 1. Click in a cell,
and then click the
down arrow of the
AutoSum button in
the standard
toolbar.
2. Select the Sum
command.
3. Press the Enter
button.
4. Select the range of
cells that need to be
added.
4, 1. Select the Sum
command.
2. Select the range of
cells that need to be
added.
3. Click in a cell, and
then click the down
arrow of the AutoSum
button in the standard
toolbar.
4. Press the Enter
button.
2
1, Method 2, Object 3, Class 4, Data 2
1, Common
Language Runtime
2, Base Class
Libraries
3, Web Form and
Web Services
4, Console
Applications
1
1, Windows Control
Library
2, Device Application 3, Console
Application
4, Class Library 4
1, Realistic Modeling 2, Reusability 3, Resilience to
Change
4, Existence as
Different Forms
2
1, Design 2, Blueprint 3, Analysis 4, Implementation 3
1, Statement A is true
and statement B is
false.
2, Statement A is
false and statement B
is true.
3, Both statement A
and statement B are
true.
4, Both statement A
and statement B are
false.
1
1, Output 2, Class view 3, Solution Explorer 4, Code Editor 3
C#
1, Finalize 2, Dispose 3, Constructor 4, Destructor 3
1, System.Console 2, System.Delegate 3,
System.MulticastDele
gate
4, System.Attribute 2
1, The code would
give a runtime error
2, Beep Beep! 3, The code would not
compile
4, BEEP BEEP! 4
1, public class
CountIsZeroExceptio
n:Exceptions
{
Console.WriteLine("E
rror");
}
2, public class
CountIsZeroException
:Exceptions
{
public
CountIsZeroException
(string message):
base(message)
{
}
}
3, public class
CountIsZeroExceptio
n :
ApplicationException
{
public
CountIsZeroExceptio
n(string message):
base(message)
{
}
}
4, public class
CountIsZeroExceptio
n:InvalidProgramExc
eption
{
Console.WriteLine("E
rror");
}
3
1, 0 2, 10 3, 8 4, 9 2
1, calc = -calc; 2, calc(-c) 3, Calculator(-c); 4, calc = calc; 1
1, 2
1
3
3
2, 1
2
3
3
3, 2
1
2
2
4, 2
2
3
3
1
1, Operator
overloading
2, Virtual functions 3, Function
overloading
4, Abstract classes 3
1, Derived obj = new
Derived();
2, class Derived : B1 3, obj.Function1(); 4, void Function1(); 4
1, The access
specifier of the
FoodHabits() method
is not declared as
protected in the
Carnivorous class.
2, The FoodHabits
method has not been
overridden in the
derived classes by
using the overrides
keyword.
3, The FoodHabits()
method is
implemented in the
Carnivorous class.
4, The FoodHabits()
method has been
implemented in the
Animal class.
4
1, The Engine()
method is not
declared virtual in the
Truck class.
2, The Engine()
method is not
declared virtual in the
Car class.
3, The access
specifier of the
Engine() method is
not declared as
protected in the Car
class.
4, The access
specifier of the
Engine() method is
not declared as
protected in the Truck
class.
2
1, disp obj=new
disp();
2, obj.abcd(); 3, class disp :
myClass
4, Console.Read(); 3
1, The
UpdateCustStatus()
and TakeOrder()
methods are
implemented in the
interface.
2, The
UpdateCustStatus()
and TakeOrder()
methods are
implemented in the
ItemDetails class.
3, The access
specifier of the
interface is not
declared as
protected.
4, The class
ItemsDetails is calling
the interface methods
without passing any
parameters to the
methods.
1
1, Value of number1
is 10, Value of
number2 is 3.
2, Value of number1
is 3, Value of number
2 is 10.
3, No output, there
would be a compile-
time error.
4, Value of number 1
is 0, Value of number
2 is 0.
3
1, Compile-time error 2, The total is : 50 3, The total is: 120 4, The total is: 20 3
1, Calculator()
{
Console.WriteLine("P
rogram
Terminating");
Console.Read();
}
2, ~Calculator()
{
Console.WriteLine("Pr
ogram
Terminating");
Console.Read();
}
3, !Calculator()
{
Console.WriteLine("P
rogram
Terminating");
Console.Read();
}
4, ~Calculator()
{
System.WriteLine("Pr
ogram
Terminating");
Console.Read();
}
2
1, By using a
constructor
2, By using a
destructor
3, By using the
Finalize() method
4, By using the
Dispose() method
4
1, Main() Begins
Constructor
Invoked
Inner Block Begins
Constructor
Invoked
Inner Block Ends
Main() ends
Destructor Invoked
Destructor Invoked
2, Constructor
Invoked
Main() Begins
Inner Block Begins
Constructor Invoked
Inner Block Ends
Main() ends
Destructor Invoked
Destructor Invoked
3, Main() Begins
Constructor Invoked
Constructor Invoked
Inner Block Begins
Inner Block Ends
Main() ends
Destructor Invoked
Destructor Invoked
4, Main() Begins
Constructor
Invoked
Constructor
Invoked
Inner Block Begins
Inner Block Ends
Destructor Invoked
Destructor Invoked
Main() ends
1
1, Opens the file
Myfile.txt and the
places the cursor at
the beginning of the
file.
2, Opens the file
Myfile.txt and
truncates the file, so
that its size is zero
bytes.
3, Opens the file
MyFile.txt and places
the cursor at the end
of the file.
4, Deletes the
existing file Myfile.txt
and creates a new
file with the same
name.
3
1,string
str=Console.ReadLin
e();
StringWriter
sr = new
StringWriter(str);
Console.WriteLine(sr.
ReadLine());
Console.Read();
2, string
str=Console.ReadLine
();
FileStream sr
= new
FileStream(str);
Console.WriteLine(sr.
ReadLine());
Console.Read();
3, string
str=Console.ReadLin
e();
StreamReader
sr = new
StringReader(str);
Console.WriteLine(sr.
ReadLine());
Console.Read();
4, string
str=Console.ReadLin
e();
StringReader
sr = new
StringReader(str);
Console.WriteLine(sr.
ReadLine());
Console.Read();
4
1, 1. Opens the file
Myfile.txt, and
prepares the stream
for a read
operation.
2. Positions the file
pointer at the
beginning of the
stream.
3. Reads a line of
characters from the
current stream and
returns data as a
string.
2, 1. Opens the file
Myfile.txt, and
prepares the stream
for a read operation.
2. Positions the file
pointer at the end of
the stream.
3. Reads a line of
characters from the
current stream and
returns data as a
string.
3, 1. Opens the file
Myfile.txt, and
prepares the stream
for a read operation.
2. Positions the file
pointer at the current
position within the
stream.
3. Reads data types
from a binary stream.
4, 1. Opens the file
Myfile.txt, and
prepares the stream
for a read
operation.
2. Positions the file
pointer at the
beginning of the
stream.
3. Converts
characters into binary
data types and reads
the data types from
the binary stream.
1
1, The code would list
the name and size of
all the sub folders
under the c:\Windows
folder.
2, The code would
result in an error.
3, The code would list
the name and size of
all the files under the
c:\Windows folder.
4, The code would list
the name and the
total size of the
c:\Windows folder.
3
1, StreamReader sr =
new
StreamReader(fs);
2,
sr.BaseStream.Seek(
0, SeekOrigin.End);
3, FileStream fs =
new
FileStream("Myfile.txt"
,
FileMode.Open,FileA
ccess.Read);
4, sr.Close(); 2
1, String filePath;
Console.WriteLine("E
nter Folder Path");
filePath=Console.Rea
dLine();
DirectoryInfo
MydirInfo = new
DirectoryInfo(@filePa
th);
Console.WriteLine("F
ull Name of the
directory is : {0}",
MydirInfo.FullName);
Console.WriteLine("T
he directory was last
accessed on : {0}",
MydirInfo.LastAccess
Time.ToString());
Console.Read();
2, String filePath;
Console.WriteLine("E
nter Folder Path");
filePath=Console.Rea
dLine();
DirectoryInfo
MydirInfo = new
FileInfo(@filePath);
Console.WriteLine("F
ull Name of the
directory is : {0}",
MydirInfo.FullName);
Console.WriteLine("T
he directory was last
accessed on : {0}",
MydirInfo.LastAccess
Time.ToString());
Console.Read();
3, String filePath;
Console.WriteLine("E
nter Folder Path");
filePath=Console.Rea
dLine();
DirectoryInfo
MydirInfo = new
DirectoryInfo(@filePat
h);
Console.WriteLine("F
ull Name of the
directory is : {0}",
MydirInfo.Name);
Console.WriteLine("T
he directory was last
accessed on : {0}",
MydirInfo.LastAccess
Time.ToString());
Console.Read();
4, String filePath;
Console.WriteLine("E
nter Folder Path");
filePath=Console.Rea
dLine();
FileInfo[]
MydirInfo = new
DirectoryInfo[](@fileP
ath);
Console.WriteLine("F
ull Name of the
directory is : {0}",
MydirInfo.Name);
Console.WriteLine("T
he directory was last
accessed on : {0}",
MydirInfo.LastAccess
Time.ToString());
Console.Read();
1
1, The finally block is
not implemented after
the catch block.
2, The class is not
derived from the
ApplicationException
class.
3, The type of
exception that is
handled in the catch
block is not correct.
4, The catch block is
not nested within the
try block.
3
1,
System.AsyncCallbac
k
2,
System.AppDomain
3, System.Attribute 4,
System.AttributeTarg
ets
2
1, delegates 2, threading 3, positional
parameters
4, named parameters 3
1, Conditional 2, WebMethod 3, DllImport 4, Obsolete 3
1, Field 2, Interface 3, Module 4, All 4
1, System.Data 2, System.Collections 3, System.Runtime 4, System.Reflection 4
1, public void
WriteData()
{
FileStream fs
= new
FileStream("Myfile.txt
",FileMode.Open,
FileAccess.Read);
StreamWriter
w = new
StreamWriter(fs);
Console.WriteLine("E
nter a string");
string str =
Console.ReadLine();
w.Write();
w.Flush();
w.Close();
fs.Close();
}
2, public void
WriteData()
{
FileStream fs
= new
FileStream("Myfile.txt"
,FileMode.Append,
FileAccess.Write);
StreamWriter
w = new
StreamWriter();
Console.WriteLine("E
nter a string");
string str =
Console.ReadLine();
w.Write(str);
w.Close();
fs.Close();
}
3, public void
WriteData()
{
FileStream fs
= new
FileStream("Myfile.txt"
,FileMode.Append,
FileAccess.Write);
StreamWriter
w = new
StreamWriter(fs);
Console.WriteLine("E
nter a string");
string str =
Console.ReadLine();
w.Write(str);
w.Flush();
w.Close();
fs.Close();
}
4, public void
WriteData()
{
FileStream fs
= new
FileStream("Myfile.txt
",FileMode.Append,
FileAccess.Write);
StreamWriter
w = new
StreamWriter(fs);
Console.WriteLine("E
nter a string");
string str =
Console.ReadLine();
w.Write();
w.Close();
fs.Close();
}
3
1, catch
(NullReferenceExcep
tion e1)
{
Console.WriteLine(e1
.Message);
}
2, catch
(InvalidCastException
e2)
{
Console.WriteLine(e2.
Message);
}
3, catch (IOException
e)
{
Console.WriteLine(e.
Message);
Console.Read();
}
4, catch
(ArgumentNullExcepti
on e3)
{
Console.WriteLine(e3
.Message);
}
3
1, void binWriter()
{
FileStream fs
= new
FileStream("binfile.D
AT",
FileMode.CreateNew)
;
int i = 10;
double d =
1023.56;
BinaryWriter
dataout;
dataout =
BinaryWriter(fs);
dataout.Write(i);
dataout.Write(d);
dataout.Close();
}
2, void binWriter()
{
FileStream fs
= new
FileStream("binfile.DA
T", FileMode.Open);
int i = 10;
double d =
1023.56;
BinaryWriter =
new BinaryWriter(fs);
dataout.Write(i);
dataout.Write(d);
dataout.Close();
}
3, void binWriter()
{
FileStream fs
= new
FileStream("binfile.DA
T",
FileMode.CreateNew)
;
int i = 10;
double d =
1023.56;
BinaryWriter
dataout;
dataout = new
BinaryWriter(fs);
dataout.Write(i);
dataout.Write(d);
dataout.Close();
}
4, void binWriter()
{
FileStream fs
= new
FileStream("binfile.D
AT",
FileMode.Open);
int i = 10;
double d =
1023.56;
BinaryWriter
dataout;
dataout = new
BinaryWriter(fs);
dataout.Write(i);
dataout.Write(d);
dataout.Close();
}
3
1, void myMethod()
{
try
{
................
}
catch
{
Console.WriteLine(E
xception.message);
}
}
2, void myMethod()
{
try
{
................
}
catch(IndexOutOfRan
geException e)
{
Console.WriteLine(e.
message);
}
}
3, void myMethod()
{
try
{
................
}
catch(e)
{
Console.WriteLine(e.
message);
}
}
4, void myMethod()
{
try
{
................
catch(IndexOutOfRan
geException e)
{
Console.WriteLine(e.
message);
}
}
}
2
1, String str = "Hello"; 2, StreamWriter sr =
new StreamWriter(fs);
3, String
str=Console.ReadLin
e();
4, FileStream fs =
new
FileStream("orders.tx
t", FileMode.Append,
FileAccess.Write,
FileShare.None);
1
1, Writing 1023.56
Writing True
Writing 90.28
Reading 1023.56
Reading True
Reading 90.28
2, Writing True
Writing 1023.56
Writing 90.28
Reading True
Reading 1023.56
Reading 90.28
3, Writing 1023.56
Writing 90.28
Reading 1023.56
Reading 90.28
4, Writing 1023.56
Writing True
Writing 12.2 * 7.4
Reading 1023.56
Reading True
Reading 12.2 * 7.4
1
1, int 2, class 3, arrays 4, collections 1
1, double 2, bool 3, float 4, char 4
1, Structure 2, Arrays 3, Double 4, Boolean 2
1, int 2, char 3, float 4, string 4
1, if(var>0)
then:
Console.WriteLine( T
his is a positive
number);
2, if (var>0)
Console.WriteLine(Th
is is a positive
number);
3, if (var>0)
console.WriteLine(Thi
s is a positive
number);
4, if var>0
Console.WriteLine( T
his is a positive
number);
2
1, using System; 2, public void
AcceptDetails()
3, class ExecuteClass 4, public static void
Main (string [] args)
4
1, Result = (!( x ==
10));
2, Result = (x^10); 3, Result =
x.equals(10);
4, Result = ( x == 10); 1
1, The while loop 2, The for loop 3, The dowhile loop 4, The foreach loop 3
1, Value of variable
is: 0
Value of variable is: 1
2, Value of variable is:
1
Value of variable is: 2
3, The compiler will
generate a syntax
error.
4, Value of variable
is: 0
Value of variable is:
1
Value of variable is: 2
2
1, By using param
arrays
2, By using foreach
statement
3, By using IndexOf
method
4, By using Rank
property
1
1, X=0 and Y=20 2, X=20 and Y=20 3, X=0 and Y=0 4, X=20 and Y=0 1
1, 1. Initialization of a
variable.
2. Evaluate
condition.
3. If true then execute
the body of the for
loop.
4.
Increment/Decrement
the counter.
5. If false then exit
the for loop.
2, 1. Initialization of a
variable.
2. Evaluate
condition.
3.
Increment/Decrement
the counter.
4. If true then execute
the body of the for
loop.
5. If false then exit the
for loop.
3, 1. Initialization of a
variable.
2.
Increment/Decrement
the counter.
3. Evaluate
condition.
4. If true then execute
the body of the for
loop.
5. If false then exit the
for loop.
4, 1. Evaluate
condition.
2. Initialization of a
variable.
3.
Increment/Decrement
the counter.
4. If true then execute
the body of the for
loop.
5. If false then exit
the for loop.
1
1, struct Bill_Details
{
public string
inv_No;
public string
ord_Dt;
public string
custName;
public string
product;
public double
cost;
public double
advance_Amt;
public double
due_Amt;
}
2, public enum
Bill_Details()
{
string inv_No;
string ord_Dt;
string custName;
string product;
double cost;
double
advance_Amt;
double due_Amt;
}
3, enum Bill_Details
{
public string inv_No;
public string ord_Dt;
public string
custName;
public string
product;
public double cost;
public double
advance_Amt;
public double
due_Amt;
};
4, public structure
Bill_Details
{
public string
inv_No;
public string
ord_Dt;
public string
custName;
public string
product;
public double
cost;
public double
advance_Amt;
public double
due_Amt;
};
1
1, Sat = 0
Fri = 6
2, Sat = Sat
Fri = Fri
3, Sat = 1
Fri = 7
4, The program will
generate a compile-
time error.
1
1, for (int row=0; row
< 2; row++)
{
rowSum =
0;
for (int
col=0; col < 4;
col++)
{
Console.Write("{0}\t",
mArray[row,col]);
rowSum=rowSum+m
Array[row, col];
}
sum = sum
+ rowSum;
Console.Write(" =
{0}", rowSum);
Console.WriteLine();
}
Console.WriteLine("T
he sum of the array
is:{0}", sum);
2, for (int row=0; row
<col; row++)
{
rowSum =
0;
for (int
col=0; col < 4;
col++)
{
Console.Write("{0}\t",
mArray[row,col]);
rowSum=rowSum+m
Array[row, col];
}
sum = sum
+ rowSum;
Console.Write(" =
{0}", rowSum);
Console.WriteLine();
}
Console.WriteLine("T
he sum of the array
is:{0}", sum);
3, for (int row=0; row
< 2; row++)
{
rowSum =
0;
for (int
col=0; col < 3;
col++)
{
Console.Write("{0}\t",
mArray[row,col]);
rowSum=rowSum+m
Array[row, col];
}
sum = sum
+ rowSum;
Console.Write(" =
{0}", rowSum);
Console.WriteLine();
}
Console.WriteLine("T
he sum of the array
is:{0}", sum);
4, for (int row=0; row
< 2; row++)
{
rowSum =
0;
for (int
col=0; col < row;
col++)
{
Console.Write("{0}\t",
mArray[row,col]);
rowSum=rowSum+m
Array[row, col];
}
sum = sum
+ rowSum;
Console.Write(" =
{0}", rowSum);
Console.WriteLine();
}
Console.WriteLine("T
he sum of the array
is:{0}", sum);
1
1, if ((Year % 4 == 0)
; (Year / 100 != 0 ||
Year % 400 == 0))
2, Year =
Convert.ToInt32(Cons
ole.ReadLine());
3,
Console.WriteLine("E
nter the year: ");
4, static void
Main(string[] args)
1
1, int var;
var = 500;
2, case 100:
Console.WriteLine("C
entury");
break;
3, default:
Console.WriteLine("In
valid value");
break;
4, switch(&&var) 4
1, number =
(Console.ReadLine())
;
2, for (SumNum =
number = incr = 0;
incr < 5; incr += 1)
3,
Console.WriteLine("T
he sum of positive
numbers entered is
{0}", SumNum);
4, if (number <= 0)
continue;
SumNum =
SumNum + number;
1
1, Str =
Console.ReadLine().
ToCharArray();
2, private static bool
CheckPalindrome(cha
r[] myString)
3, if
(myString[startChar] =
myString[lastChar])
4, lastChar =
myString.Length - 1;
3
1, number2 +=
number1;
2, num1 = number2-
number1;
3,
Console.WriteLine("{0
}", number1);
4,
number1=number2=1
;
2
1, Abstraction 2, Encapsulation 3, Inheritance 4, Polymorphism 1
1, Access specifier 2, Return type 3, Method name 4, Parameter list 4
1, Parentheses (()) 2, Comma (,) 3, Semi-colon (;) 4, Reference variable
(&)
1
1, Polymorphism 2, Events 3, Constructors and
destructors
4, Delegates 1
1, sealed 2, virtual 3, namespace 4, abstract 1
1, The public access
specifier
2, The private access
specifier
3, The protected
access specifier
4, The internal
access specifier
1
1, +=, -=, *= 2, *, /, % 3, +, - 4, ! , ~, ++ 1
1, Instantiation
relationship
2, Utilization
relationship
3, Inheritance
relationship
4, Composition
relationship
4
1, virtual 2, override 3, void 4, abstract 2
1, Interface 2, Static function 3, Function
overloading
4, Polymorphism 1
1, The public access
specifier
2, The private access
specifier
3, The protected
access specifier
4, The internal
access specifier
3
1, calc c = new calc();
calc.AddNumber(10,
20);
2, calc c = new calc();
int
Result=c.AddNumber(
10, 20);
3, calc c = new
calc(AddNumber(10,2
0));
4, int Result =
AddNumber(10,20);
2
1, Const 2, out 3, static 4, in 3
1, <access specifier>
className operator
+(parameters)
{
// Code
}
2, className
<access specifier>
operator
+parameters
{
// Code
}
3, <access specifier>
className
+(parameters)
operator
{
// Code
}
4, <access specifier>
className +
operator
parameters
{
// Code
}
1
1, public interface
IOrderDetails
{
void
UpdateCustStatus();
void
TakeOrder();
}
2, public void interface
IOrderDetails
{
UpdateCustStatus();
TakeOrder();
}
3, public interface
IOrderDetails
{
UpdateCustStatus();
TakeOrder();
}
4, public static
interface
IOrderDetails
{
void
UpdateCustStatus();
void
TakeOrder();
}
1
1, Inheritance 2, Abstraction 3, Polymorphism 4, Encapsulation 4
1, Encapsulation 2, Function
overloading
3, Inheritance 4, Virtual functions 2
1, Statement A is
true, and Statement
B is false.
2, Statement A is
false, and Statement
B is true.
3, Both, Statement A
and Statement B are
true.
4, Both, Statement A
and Statement B are
false.
2
1, Constructor of
Base
Constructor of
Derived
Destructor of
Derived
Destructor of Base
2, Constructor of
Base
Constructor of
Derived
Destructor of Base
Destructor of Derived
3, Constructor of
Base
Destructor of Base
Constructor of
Derived
Destructor of Derived
4, Constructor of
Derived
Destructor of
Derived
Constructor of Base
Destructor of Base
1
1, Use multithreading 2, Use virtual
functions
3, Use static
polymorphism
4, Use abstract
methods
4
1, Constructor 2, Static function 3, Virtual function 4, Delegate 4
1, Single-cast
delegates
2, Static functions 3, Events 4, Multicast delegates 4
1, Publisher 2, Subscriber 3, Monitor 4, Sender 1
1, Constructors do
not return values.
2, Static constructors
are used to initialize
the non-static
variables of a class.
3, If there are no
constructors defined
for a class, the
compiler creates a
default constructor.
4, An instance
constructor is called
whenever an instance
of a class is created.
2
1, Implementation of
the static constructor
2, Implementation of
the instance
constructor
3, Implementation of
the static function
4, Implementation of
the virtual function
1
1, Abstract classes 2, Operator
overloading
3, Function
overloading
4, Constructor with
parameters
4
1, Statement A is true
and Statement B is
false.
2, Statement A is
false and Statement B
is true.
3, Both, Statement A
and Statement B are
true.
4, Both, Statement A
and Statement B are
false.
4
1, Attributes 2, Reflection 3, Delegates 4, Events 3
1, Declare an event 2, Declare a delegate 3, Declare an event
based on the
delegate
4, Fire the event 1
1, public delegate
void MyDelegate
(string s);
2, public delegate void
MyDelegate (int i);
3, public delegate int
MyDelegate (int i);
4, public delegate int
MyDelegate ();
2
1, A multicast
delegate contains an
invocation list of
multiple methods.
2, A multicast
delegate derives from
the
System.MulticastDele
gate class.
3, A single-cast
delegate contains
reference to only one
method at a time.
4, A single-cast
delegate derives from
the
System.SinglecastDel
egate class.
4
1, Publisher 2, Subscriber 3, Monitor 4, Sender 1
1, Student PD = new
Student();
RingALarm = new
TimeToRise(PD.Wak
eUp);
2, Student PD =
Student();
RingALarm =
TimeToRise(PD.Wak
eUp);
3, Student PD = new
Student();
RingALarm = new
TimeToRise(WakeUp
);
4, Student = new
Student();
RingALarm = new
TimeToRise(WakeUp
);
1
1, StreamReader 2, FileStream 3, StringReader 4, BinaryReader 1
1, logical error 2, syntax error 3, compile-time error 4, run-time error 1
1, FileShare
Enumerator
2, FileAcess
Enumerator
3, FileInfo class 4, StreamWriter class 1
1, It returns the next
available character
but does not
consume it.
2, It allows the
read/write position to
be moved to any
position within the file.
3, It reads a line of
characters from the
current stream and
returns data as a
string.
4, It releases any
system resources
associated with the
reader.
1
1, It closes the
underlying stream.
2, It clears all buffers
for the current writer
and causes any
buffered data to be
written to the
underlying stream.
3, It writes data
specified by the
overload parameters,
followed by end of
line.
4, It writes to the
stream.
2
1, It will generate the
following output:
The current thread
after name change:
MainThread
2, It will generate the
following output:
The current thread
after name change:
Th.Name
3, It will generate the
following compile time
error:
The name 'Thread'
does not exist in the
current context.
4, It will generate the
following output:
The current thread
after name change:
{0}, MainThread
3
1, Thread
ChildThread = new
Thread(ChildRef);
2, ThreadStart
ChildRef = new
ThreadStart(ChildThr
eadCall);
3,
ChildThread.Start();
4,
ChildThread.Sleep(Sl
eepTime);
4
1, public static void
Main(string[] args)
{
ThreadStart
ChildRef = new
ThreadStart(BookDet
ails);
Thread
ChildThread = new
Thread(ChildRef);
ChildThread.Start();
}
2, public static void
Main(string[] args)
{
ThreadStart
ChildRef = new
ThreadStart(BookDet
ails());
Thread
ChildThread = new
Thread(ChildRef);
ChildThread.Start();
}
3, public static void
Main(string[] args)
{
ThreadStart
ChildRef = new
ThreadStart();
Thread
ChildThread = new
Thread(ChildRef);
ChildThread.Start();
ChildThread.CallMeth
od(BookDetails);
}
4, public static void
Main(string[] args)
{
ThreadStart
ChildRef = new
ThreadStart();
Thread
ChildThread = new
Thread(ChildRef);
ChildThread.Start();
ChildThread.BookDet
ails();
}
1
1, public static void
Main()
{
ThreadStart
ChildW = new
ThreadStart(Write);
ThreadStart
ChildS = new
ThreadStart(Save);
ThreadStart
ChildP = new
ThreadStart(Print);
Console.WriteLine("
Main - Creating Child
threads");
Thread Thread1
= new
Thread(ChildW);
Thread Thread2
= new
Thread(ChildS);
Thread Thread3
= new
Thread(ChildP);
Thread3.Start();
Thread1.Start();
2, public static void
Main()
{
ThreadStart
ChildW = new
ThreadStart(Write);
ThreadStart
ChildS = new
ThreadStart(Save);
ThreadStart
ChildP = new
ThreadStart(Print);
Console.WriteLine("M
ain - Creating Child
threads");
Thread Thread1
= new
Thread(ChildW);
Thread Thread2
= new
Thread(ChildS);
Thread Thread3
= new
Thread(ChildP);
Thread1.Priority
=
ThreadPriority.Highest
;
Thread2.Priority
=
3, public static void
Main()
{
ThreadStart
ChildW = new
ThreadStart(Write);
ThreadStart
ChildS = new
ThreadStart(Save);
ThreadStart
ChildP = new
ThreadStart(Print);
Console.WriteLine("M
ain - Creating Child
threads");
Thread Thread1
= new
Thread(ChildW);
Thread Thread2
= new
Thread(ChildS);
Thread Thread3
= new
Thread(ChildP);
Thread1.Priority
=
ThreadPriority.Highes
t;
Thread2.Priority
=
4, public static void
Main()
{
ThreadStart
ChildW = new
ThreadStart(Write);
ThreadStart
ChildS = new
ThreadStart(Save);
ThreadStart
ChildP = new
ThreadStart(Print);
Console.WriteLine("
Main - Creating Child
threads");
Thread Thread1
= new
Thread(ChildW);
Thread Thread2
= new
Thread(ChildS);
Thread Thread3
= new
Thread(ChildP);
Thread1.Priority(High
est);
Thread2.Priority(Nor
mal);
2
1, using System;
using
System.Threading;
namespace
ThreadSample
{
class
BasicThreadApp
{
public static void
ChildThreadCall()
{
for (int i=0; i
<= 12; i++)
{
Console.WriteLine("C
lock Started");
Thread.Sleep(5000);
Console.WriteLine("5
seconds over");
}
Console.WriteLine("1
minute over");
}
namespace
ThreadSample
{
class
BasicThreadApp
{
public static void
ChildThreadCall()
{
Console.WriteLine("Cl
ock Started");
for (int i=0; i <
12; i++)
{
Thread.Sleep(5000);
}
Console.WriteLine("5
seconds over");
Console.WriteLine("1
minute over");
}
namespace
ThreadSample
{
class
BasicThreadApp
{
public static void
ChildThreadCall()
{
Console.WriteLine("Cl
ock Started");
for (int i=0; i >
12; i++)
{
Thread.Sleep(5000);
Console.WriteLine("5
seconds over");
}
Console.WriteLine("1
minute over");
}
namespace
ThreadSample
{
class
BasicThreadApp
{
public static void
ChildThreadCall()
{
Console.WriteLine("C
lock Started");
for (int i=0; i <
12; i++)
{
Thread.Sleep(5000);
Console.WriteLine("5
seconds over");
}
Console.WriteLine("1
minute over");
}
Nurse: Medicine 1
given
Nurse: Medicine 2
given
Doctor: Work
finished
Nurse: Work finished
2, Doctor: Give
medicine 1
Doctor: Give medicine
2
Doctor: Work
finished
Nurse: Medicine 1
given
Nurse: Medicine 2
given
Nurse: Work finished
3, Doctor: Give
medicine 1
Nurse: Medicine 1
given
Nurse: Medicine 2
given
Nurse: Work finished
4, Doctor: Give
medicine 1
Nurse: Medicine 1
given
Doctor: Give
medicine 2
Nurse: Medicine 2
given
Nurse: Work
finished
Doctor: Work finished
4
1,
Fd.WriteData("T1");
2, Monitor.Enter(this); 3, Monitor.Exit(); 4, public static
FileAccess Fd = new
FileAccess();
3
1,
Console.WriteLine("U
pdated {0} record",
Cnt+1);
2, lock() 3,
Fd.UpdateAC("T2");
4, public static
FileAccess Fd = new
FileAccess();
2
1, By calling the
Run() method.
2, By calling the
Start() method.
3, By calling the
Sleep() method.
4, By calling the
Resume() method.
2
1, void Calculate()
{
try
{
int a;
int b;
int c;
Console.WriteLine("E
nter num 1");
a =
Convert.ToInt32(Con
sole.ReadLine());
Console.WriteLine("E
nter num 2");
b =
Convert.ToInt32(Con
sole.ReadLine());
c = a % b;
Console.WriteLine("R
esult is {0}", c);
}
catch
{
Console.WriteLine("E
rror");
}
finally
2, void Calculate()
{
try
{
int a;
int b;
int c;
Console.WriteLine("E
nter num 1");
a =
Convert.ToInt32(Cons
ole.ReadLine());
Console.WriteLine("E
nter num 2");
b =
Convert.ToInt32(Cons
ole.ReadLine());
c = a % b;
Console.WriteLine("R
esult is {0}", c);
}
catch
{
Console.WriteLine("Er
ror");
Console.WriteLine("C
3, void Calculate()
{
try
{
int a;
int b;
int c;
Console.WriteLine("E
nter num 1");
a =
Convert.ToInt32(Cons
ole.ReadLine());
Console.WriteLine("E
nter num 2");
b =
Convert.ToInt32(Cons
ole.ReadLine());
c = a % b;
Console.WriteLine("R
esult is {0}", c);
}
catch
{
Console.WriteLine("C
alculation
complete");
}
4, void Calculate()
{
try
{
int a;
int b;
int c;
Console.WriteLine("E
nter num 1");
a =
Convert.ToInt32(Con
sole.ReadLine());
Console.WriteLine("E
nter num 2");
b =
Convert.ToInt32(Con
sole.ReadLine());
c = a % b;
}
catch
{
Console.WriteLine("R
esult is {0}", c);
Console.WriteLine("C
alculation
complete");
}
1
1, Flowchart 2, Programming logic 3, Dry run table 4, Decisional
construct
3
1, Dry run 2, Loop 3, Decisional
construct
4, Flowchart 2
1, start 2, return 3, if 4, switch 2
1, AND 2, OR 3, NOT 4, XOR 1
1, Logical operator 2, Dry run 3, Flowchart 4, Decisional
Construct
2
1, Statement A is true
and statement B is
false.
2, Statement A is
false and statement B
is true.
3, Both statement A
and statement B are
true.
4, Both statement A
and statement B are
false.
1
1, Use structured
programming
techniques
2, Use conditional
constructs
3, Use loop
constructs
4, Use Decision
Constructs
1
Logic building
1, By using the OR
operator between the
search terms
2, By using the AND
operator between the
search terms
3, By using the NOT
operator between the
search terms
4, By using
parentheses between
the search terms
2
1, Flowchart 2, Algorithm 3, Pseudocode 4, Program 4
1, begin --- end 2, If --- else---
endif
3, While---do 4, do---while 4
1, "Bat", 10, and
"Peter"
2, "Bat", Payment,
"Peter", and Marks
3, "Bat" and "Peter" 4, Payment, 10, and
Marks
1
1, Only Statement A
is true.
2, Only Statement B is
true.
3, Both, Statement A
and Statement B are
true.
4, Both, Statement A
and Statement B are
false.
1
1, != 2, < 3, = 4, > 1
1, OR 2, AND 3, NOT 4, NOR 1
1, Input 2, Output 3, Process 4, Storage 1
1, Annotation 2, On-page connector 3, Flow lines 4, Sub routines 1
1, The instruction,
"Get a number"
should be in the Input
box.
2, The instruction,
"Add 1 to the number"
should be in
annotation box.
3, The instruction,
"Display the number"
should be in the
Procedure box.
4, There is no error in
the flowchart.
1
1, int
This_variable_name_
is_very_long;
2, int #score; 3, int 9_strank; 4, int class; 1
1, 1 2, 2 3, 4 4, Variable length 2
1, X=6, Y=6 2, X=5, Y=5 3, X=6, Y=5 4, X=5, Y=6 3
1, Comparison
operators
2, Unary operators 3, Arithmetic
assignment operators
4, Logical operators 1