Quizzes
Quizzes
• 92
• 89
• 90
• 91
• 106
• 104.789
• 105.8546
• 103.45
What is the output of the following C# code?
int a,b ;
for (a=2 ; a>=0 ; a- )
{
for (b=0 ; b<= 2 ; b++ )
{
if (a==b)
{
Console.WriteLine("1");
}
else
{
Console.WriteLine("0");
}
}
Console.WriteLine("\n");
}
• 100
010
001
• 010
100
001
• 001
010
100
• 100
001
010
What will be the output of the following C# code?
static void Main(string[] args)
{
int a,b;
int c=10;
int d=12;
int e=5;
int f=6;
a = c*(d+e)/f+d;
Console.WriteLine(a);
b = c*(d+e/f+d);
Console.WriteLine(b);
if (a<b)
{
Console.WriteLine("Parentheses Changes Values");
}
else if (a>b)
{
Console.WriteLine("they have same value");
}
}
• They have same value
• Parentheses Changes Values
• Since both have equal values , no conclusion
• None of the mentioned
Consider the following method:
public static void Divide(double first , double second)
{
Console.WriteLine("The division of {0} by {1} is {2}", first , second , first/ second);
}
What will be the output when called the method from another method defined in the
same static class as : Divide(5,2);
• This will give Compiler error due to incompatible parameter types
• The output is: The division of 5 by 2 is 2 is 2
• The output is: The division of 5 by 2 is 2 is 2.5
• The output is: The division of 5,2,2.5
• true
• false
Consider the following function:
static double function1(double x , int n)
{
double result=0;
for(int i=1 ; i<=n ; i++)
result *= x;
return result;
}
What will be the output of the function if it is called using the parameters : 3,0
• Compiler error occurs
• 1
• 0
• run-time error occurs
• Data input
• Adding delay
• Waiting until the user can view the program reults
What will be the output of the following C# code?
static void Main(string[] args)
{
char c = 'g';
string s = c.ToString();
string s1 = "I am a human being" + c;
Console.WriteLine(s1);
Console.ReadLine();
}
• I am a human bein c
• I am a human beingg
• I am a human being c
• I am a human bein
int a, b, c, x;
a= 80;
b = 15;
c = 2;
x = a –(b/3) + (a%c);
Console.WriteLine(x);
Console.ReadLine();
• 78
• -84
• 80
• 75
• 12 11
• 10 11
• 11 12
• 11 10
for a source file that contains 100 lines of code of which the line numbered 50 contains
a syntax error, the compiler:
• compiles the first 49 line and scops
• compiles the all lines sxcept the line numbered 50
• Does not compile the source file.,it only announces the errors
• Hangs up and stop working
What will be the output of the following C# code?
static void Main(string[] args)
{
const int a = 5 ;
const int b = 6 ;
for (int i =1 ; i<=5 ; i++)
{
a= a*i ;
b= b*i ;
}
Console.WriteLine(a);
Console.WriteLine(b);
Console.ReadLine();
}
• 600, 720
• Compile time error
• 25, 30
• 5, 6
Given:
int x=2 ;
x*=2;
int y = x++ +2 ;
The value of y is:
• 4
• 6
• 8
• 9
Java programming language is:
• a high-level language
• used to write cross-platform applications
• used to write applications that target a virtual machine
• all the given