Tin Học >> Lập trình >> C#
|| C#
C++
Visual Basic
Visual Foxpro
C
Java
Pascal
Thiết Kế Web
ASP.NET
XML
CSS
PHP
Có 53 bài trong 6 trang (10 bài/trang) và bạn đang ở trang 2.
Which of the following will be the correct output for the C#.NET program given below? namespace IndiabixConsoleApplication { class Sample { int i; Single j; public void SetData(int i, Single j) { this.i = i; this.j = j; } public void Display() { Console.WriteLine(i + " " + j); } } class MyProgram { static void Main(string[ ] args) { Sample s1 = new Sample(); s1.SetData(36, 5.4f); s1.Display(); } } } A. 0 0.0 B. 36 5.4 C. 36 5.400000...... Which of the following statements is correct about the C#.NET code snippet given below? class Sample { private int i; public Single j; private void DisplayData() { Console.WriteLine(i + " " + j); } public void ShowData() { Console.WriteLine(i + " " + j); } } A. j cannot be declared as public. B. DisplayData() cannot be declared as private. C. DisplayData() cannot access j. D. ShowData() cannot access to i. E. There is no error in this class........ Which of the following statements are correct about functions used in C#.NET? Function definitions cannot be nested. Functions can be called recursively. If we do not return a value from a function then a value -1 gets returned. To return the control from middle of a function exit function should be used. Function calls can be nested. A. 1, 2, 5 B. 2, 3, 5 C. 2, 3 D. 4, 5 E. None of these....... How many values is a function capable of returning? A. 1 B. 0 C. Depends upon how many params arguments does it use. D. Any number of values. E. Depends upon how many ref arguments does it use........ Which of the following will be the correct output for the C#.NET program given below? namespace IndiabixConsoleApplication { class SampleProgram { static void Main(string[] args) { int num = 1; funcv(num); Console.Write(num + ", "); funcr(ref num); Console.Write(num + ", "); } static void funcv(int num) { num = num + 10; Console.Write(num + ", "); } static void funcr (ref int num) { num = num + 10; Console.Write(num + ", "); } } } A. 1, 1, 1, 1, B. 11, 1, 11, 11, C. 11, 11, 11, 11, D. 11, 11, 21, 11, E. 11, 11, 21, 21,........ What will be the output of the C#.NET code snippet given below? int num = 1, z = 5; if (!(num <= 0)) Console.WriteLine( ++num + z++ + " " + ++z ); else Console.WriteLine( --num + z-- + " " + --z ); A. 5 6 B. 6 5 C. 6 6 D. 7 7........ Suppose n is a variable of the type Byte and we wish to put OFF its fourth bit (from right) without disturbing any other bits. Which of the following statements will do this correctly? A. n = n && HF7 B. n = n & 16 C. n = n & 0xF7 D. n = n & HexF7 E. n = n & 8.......... Which of the following statements is correct about the C#.NET code snippet given below? int i, j, id = 0; switch (id) { case i: Console.WriteLine("I am in Case i"); break; case j: Console.WriteLine("I am in Case j"); break; } A. The compiler will report case i and case j as errors since variables cannot be used in cases. B. Compiler will report an error since there is no default case in the switch case statement. C. The code snippet prints the result as "I am in Case i"". D. The code snippet prints the result as "I am in Case j". E. There is no error in the code snippet......... The C#.NET code snippet given below generates ____ numbers series as output? int i = 1, j = 1, val; while (i < 25) { Console.Write(j + " "); val = i + j; j = i; i = val; } A. Prime B. Fibonacci C. Palindrome D. Odd E. Even...... Which of the following statements are correct about the C#.NET code snippet given below? if (age > 18 && no < 11) a = 25; The condition no < 11 will be evaluated only if age > 18 evaluates to True. The statement a = 25 will get executed if any one condition is True. The condition no < 11 will be evaluated only if age > 18 evaluates to False. The statement a = 25 will get executed if both the conditions are True. ..... What does the following C#.NET code snippet will print? int i = 0, j = 0; label: i++; j+=i; if (i < 10) { Console.Write(i +" "); goto label; } A. Prints 1 to 9 B. Prints 0 to 8 C. Prints 2 to 8 D. Prints 2 to 9 E. Compile error at label:........ Which of the following statements are correct? We can assign values of any type to variables of type object. When a variable of a value type is converted to object, it is said to be unboxed. When a variable of type object is converted to a value type, it is said to be boxed. Boolean variable cannot have a value of null. When a value type is boxed, an entirely new object must be allocated and constructed. A. 2, 5 B. 1, 5 C. 3, 4 D. 2, 3...... Which of the following statements are correct about data types? If the integer literal exceeds the range of byte, a compilation error will occur. We cannot implicitly convert non-literal numeric types of larger storage size to byte. Byte cannot be implicitly converted to float. A char can be implicitly converted to only int data type. We can cast the integral character codes. A. 1, 3, 5 B. 2, 4 C. 3, 5 D. 1, 2, 5..... |