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)
No comments:
Post a Comment