Solution:NIIT/GNIIT Sonugiri0032@gmail.com

Sunday, January 03, 2016

C# Mt Solved



c# Mt Solved

https://drive.google.com/folderview?id=0B_k0mGjeovElYW4wNTRfRUFCd2c&usp=sharing

The ____ block in the if…else construct is optional and can be omitted.

Answer:


else

The _______ statement is used to exit the switch statement.

Answer:

break

-------------------------------------

State whether the following statement is True or False:

In the while loop, the while statement always checks the condition after executing the statements within the loop.

Answer:

False

-------------------------------------------

The statements within the _________ loop are executed at least once.

Answer:

do..While

---------------------------------------

State whether the following statement is True or False:

In a for loop, the initialization expression is executed only once at the beginning of the loop.

Answer:

True

--------------------------

Which of the following statements is the correct syntax of declaring a character array?

a. char [] ch;

b. char ch [];

c. char { } ch;

d. char ch { };

Answer:

a. char [] ch;

-----------------------------------

Which of the following options can you use to assign values to an array? (Choose all that apply)

a. int[] arr = new int[2];
arr[0] = 5;
arr[1] = 3;

b. int[] arr = new int[2] {0, 1};

c. int [] arr = new int [2][0,1];

d. int[] arr = {5, 10};

Answer:

a. int[] arr = new int[2];
arr[0] = 5;
arr[1] = 3;

b. int[] arr = new int[2] {0, 1};

d. int[] arr = {5, 10};

------------------------------------------------------------------

The ________ statement interprets the common loop process and removes the need to check the array size.

Answer:

foreach



----------------------------------------------------------

Which of the following methods of the Array class will return the number of items in an array?

a. GetLength()

b. GetValue()

c. IndexOf()

d. Sort()

Answer:

a. GetLength()

----------------------------------------

Which of the following options are the possible states of a mobile phone? (Choose all that apply)

a. Off

b. Ring

c. Vibrate

d. Color

Answer:

a. Off

b. Ring

c. Vibrate

----------------------------------

John went to a shopping mall to buy some clothes. The door of the shopping mall was automatic, which opened as soon as John stepped near it and closed as soon as John entered the mall. Identify the possible receiver of the message in this situation.

a. Door

b. John

c. Shopping mall

d. Clothes

Answer:

a. Door







Let’s Practice (Contd.)






Identify which of the following features ABC Ltd. will take advantage of. (Choose all that apply)

a. Realistic modeling

b. Reusability

c. Modularity

d. Flexibility to change






Answer:

b. Reusability

d. Flexibility to change










A __________ is a special program that converts a particular programming language into machine language.



Answer:

Compiler

-----------------------------------------------------------



· Help Michelle to select the correct code snippet that needs to be inserted in the Main()function to get the preceding output?

a. Console.WriteLine("Michelle Gracias \t Email:

michelle2012@abc.net \n126, Parkway Street Boulevard, \nMiami, FL, \n122001");

b. Console.WriteLine("Michelle Gracias \v Email:

michelle2012@abc.net \r 126, Parkway Street

Boulevard, \n Miami, FL, \n 122001");

c. Console.WriteLine("Michelle Gracias \t Email:

michelle2012@abc.net \v 126, Parkway Street

Boulevard, \v Miami, FL, \v 122001");

d. Console.WriteLine("Michelle Gracias \n Email:

michelle2012@abc.net \t 126, Parkway Street

Boulevard, \t Miami, FL, \t 122001");

· Answer:

a. Console.WriteLine("Michelle Gracias \t Email:

michelle2012@abc.net \n126, Parkway Street

Boulevard, \nMiami, FL, \n122001");

------------------------------------------------------------------------------------



· Which of the following options displays the correct way of declaring and initializing a variable?

a. <data_type> <variable_name>=<value>

b. <variable_name>=<value>;

c. <data_type> <variable_name>=<value>;

d. <variable_name>=<value>;



· Answer:

a. <data_type> <variable_name>=<value>;

-------------------------------------------------------------------------

· Which of the following data types return the value as true or false?

a. int

b. string

c. bool

d. double





· Answer:

c. bool



----------------------------------------------------------------------

· The Console.ReadLine() method, by default, accepts the data in the ______ format.

a. string

b. int

c. char

d. float





· Answer:

a. string



----------------------------

· Problem Statement:

· Write a program to display the following details on the screen:

· Event: Tennis Match

· Venue: Star Sports Complex

· Time: 4:00 p.m. to 6:00 p.m

· Solution:

· The following code will create the Event class with the desired functionality:

public class Event

{

public static void Main(string[] args)

{

System.Console.WriteLine("Event:\tTennis Match\n");

System.Console.WriteLine("Venue:\tStar Sports

Complex\n");

System.Console.WriteLine("Time:\t4:00 p.m. to 6:00 p.m. \n");

}

}

-----------------------------------

· If x is 22 and y is 4, then predict the output of the x % y; statement?

a. 5

b. 2

c. 4

d. 3



· Answer:

b. 2

------------------------------------------------

· If x is 10 and y is 3, then predict the value of variable x after execution of the following statement: x%=y;?

a. 2

b. 3

c. 1

d. 0



· Answer:

c. 1

----------------------------------------

· If x is 2, then what will be the output of the statement x=++x;?

a. 3

b. 2

c. 4

d. Compilation error





· Answer:

a. 3



------------------------------------

· Identify the comparison operators from the following options. (Choose all that apply)

a. !=

b. =

c. ==

d. +=





· Answer:

a. !=

c. ==

------------------------------

· Predict the output of the variable result:

bool result;

int x = 10;

result = (!(x == 10));

a. True

b. False



· Answer:

b. False





-------------------------------------------



------------------------------------

· Identify which of the following options will be used to instantiate a class named Animal.

a. Animal a;

b. Animal a = new Animal;

c. Animal a = new Animal();

d. Animal a = new.Animal();



· Answer:

c. Animal a = new Animal();

-----------------------------------

· Consider the following code snippet:

static void Main(string[] args)

{

int x=0;

//Insert the code here

{

Console.WriteLine("Value of x is:" +x);

x = x + 5;

}

}

· The output desired from the preceding code snippet is:

Value of x is: 0

Value of x is: 5

Value of x is: 10

Value of x is: 15

Value of x is: 20

· Select the correct options that can be inserted in the code snippet so as to generate the preceding output.

· Answer:

· while(x<=20)



-----------------------------------------------------------------------











Share:

Related Posts:

0 comments:

GNIITSOLUTION GNIIT SOLUTION. Powered by Blogger.

Translate

Blog Archive

undefined