0

programming languages Online Quiz - 349

Description: programming languages Online Quiz - 349
Number of Questions: 20
Created by:
Tags: programming languages
Attempted 0/20 Correct 0 Score 0

What type is a div in asp.net?

  1. System.Web.UI.HtmlControls.HtmlMeta

  2. System.Web.UI.HtmlControls.HtmlInputText

  3. System.Web.UI.HtmlControls.HtmlControl

  4. System.Web.UI.HtmlControls.HtmlGenericControl


Correct Option: D

Which two methods are defined by IHttpHandler Interface?

  1. ProcessRequest and IsReusable

  2. ProcessResponse and IsReusable

  3. GenerateRequest and ProcessResponse

  4. GenerateResponse and ProcessRequest


Correct Option: A
  1. The Page_PreRender event is not executed for downlevel browsers.

  2. The Page_Load event happens before the page has been rendered and the Page_PreRender event happens after the page has been rendered.

  3. The Page_PreRender event happens after the Page_Load event and after any control events.

  4. The Page_PreRender event and Page_Load event can be used interchangeably.


Correct Option: C
  1. for (int i = 0; i < 80; i++) { stream1.WriteByte(byteArray[i]); bytesTransferred = i; if (!stream1.CanWrite) { break; }}

  2. bytesTransferred = stream1.Read(byteArray, 0, 80);

  3. while (bytesTransferred < 80) { stream1.Seek(1, SeekOrigin.Current); byteArray[bytesTransferred++] = Convert.ToByte(stream1.ReadByte());}

  4. stream1.Write(byteArray, 0, 80);bytesTransferred = byteArray.Length;


Correct Option: B
  1. Contact the ISP and have them switch the website to have ASP capability.

  2. Develop a transition plan first that includes a step-by-step plan on every detail prior to contacting the ISP.

  3. Have your ISP install the Microsoft FrontPage extensions

  4. All the above


Correct Option: B

You want to add ASP capability to your company's website. What is the first thing you would check?

  1. That all pages are saved in .asp extensions.

  2. Check that the web server has Microsoft FrontPage extensions installed

  3. Make sure the web server is capable of hosting ASP pages

  4. Check the coding and be sure the ASP code is surrounded with

  5. All of the above


Correct Option: C

AI Explanation

To answer this question, you need to understand the basics of adding ASP capability to a website.

Option A) That all pages are saved in .asp extensions - This option is incorrect because saving the pages with the .asp extension alone does not enable ASP capability. It is a common practice to save ASP pages with the .asp extension, but it is not necessary for ASP functionality.

Option B) Check that the web server has Microsoft FrontPage extensions installed - This option is incorrect because Microsoft FrontPage extensions are not required for ASP functionality. FrontPage extensions are used for managing and publishing websites, but they are not specifically related to ASP.

Option C) Make sure the web server is capable of hosting ASP pages - This option is correct because the first thing you need to check when adding ASP capability to a website is whether the web server supports ASP. ASP (Active Server Pages) is a server-side scripting language that requires specific server-side support. The web server needs to have ASP support enabled or installed in order to host ASP pages.

Option D) Check the coding and be sure the ASP code is surrounded with - This option is incomplete and incorrect. The option is cut off, so we can't determine the full context. However, just checking the coding and ensuring that the ASP code is properly surrounded with something (e.g., tags, delimiters) is not sufficient to enable ASP capability. The web server needs to support ASP in order to execute the ASP code.

Option E) All of the above - This option is incorrect because not all of the options listed are correct. Only option C is correct, as explained above.

The correct answer is C) Make sure the web server is capable of hosting ASP pages. This option is correct because it is the first thing you need to check when adding ASP capability to a website.

What base class do all Web Forms inherit from?

  1. Web class

  2. Page class

  3. Data class

  4. Html classs


Correct Option: B

Which is the best place to store connectionstring in .NET projects ?

  1. Session

  2. Cookie

  3. Web.config

  4. Variable


Correct Option: C

Can you call one constructor from another if a class has multiple constructors?

  1. True

  2. False


Correct Option: A

Which of the following lines will compile without warning or error.

  1. float f=1.3;

  2. char c="a";

  3. byte b=257;

  4. int i=10;


Correct Option: D

A byte can be of what size?

  1. -128 to 127

  2. (-2 power 8 )-1 to 2 power 8

  3. -255 to 256

  4. depends on the particular implementation of the Java Virtual machine


Correct Option: A

AI Explanation

To answer this question, we need to understand the concept of a byte and its size.

A byte is a unit of digital information that consists of 8 bits. Each bit can either be a 0 or a 1. Therefore, a byte can represent 2^8 (256) different values.

Option A) -128 to 127 - This option is correct. In a byte, the range of values is typically represented as -2^7 to 2^7 - 1. This means that the minimum value that can be stored in a byte is -128 (-2^7) and the maximum value is 127 (2^7 - 1).

Option B) (-2^8)-1 to 2^8 - This option is incorrect. The range mentioned in this option is incorrect. The correct range should be from -2^7 to 2^7 - 1.

Option C) -255 to 256 - This option is incorrect. The range mentioned in this option is incorrect. The correct range should be from -128 to 127.

Option D) depends on the particular implementation of the Java Virtual Machine - This option is incorrect. The size of a byte is standardized across different programming languages and platforms. It is always 8 bits.

Based on the explanations above, the correct answer is option A. A byte can represent values from -128 to 127.

What will be printed out if this code is run with the following command line? java myprog good morning public class myprog{ public static void main(String argv[]) { System.out.println(argv[2]); } }

  1. myprog

  2. good

  3. morning

  4. Exception raised: "java.lang.ArrayIndexOutOfBoundsException: 2"


Correct Option: D

AI Explanation

To answer this question, let's go through the code:

public class myprog {
    public static void main(String argv[]) {
        System.out.println(argv[2]);
    }
}

The main method is the entry point of the program. It takes a String array called argv as a parameter, which represents the command-line arguments passed to the program.

In the given command line: java myprog good morning, the arguments passed are "myprog", "good", and "morning".

The line System.out.println(argv[2]); attempts to print the element at index 2 of the argv array. In Java, arrays are zero-indexed, which means the first element is at index 0, the second element is at index 1, and so on.

However, in this case, the argv array only has 3 elements: "myprog", "good", and "morning". Since there is no element at index 2, an ArrayIndexOutOfBoundsException will be raised.

Therefore, the correct answer is:

D. Exception raised: "java.lang.ArrayIndexOutOfBoundsException: 2"

Which of the following are keywords or reserved words in Java?

  1. if

  2. then

  3. goto

  4. case


Correct Option: A,C,D

What will be printed out if you attempt to compile and run the following code ? int i=1; switch (i) { case 0: System.out.println("zero"); break; case 1: System.out.println("one"); case 2: System.out.println("two"); default: System.out.println("default"); }

  1. one

  2. one, default

  3. one, two, default

  4. default


Correct Option: C

Given the following declarations String s1=new String("Hello"); String s2=new String("there"); String s3=new String(); Which of the following are legal operations?

  1. s3=s1 + s2;

  2. s3=s1-s2;

  3. s3=s1 & s2;

  4. s3=s1 && s2


Correct Option: A

AI Explanation

To answer this question, you need to understand the operations that can be performed on strings in Java. Let's go through each option to understand why it is correct or incorrect:

Option A) s3 = s1 + s2 - This option is correct because the + operator can be used to concatenate strings in Java. It concatenates the string represented by s1 with the string represented by s2 and assigns the result to s3.

Option B) s3 = s1 - s2 - This option is incorrect because the - operator cannot be used with strings in Java. It is used for arithmetic operations and is not applicable to strings.

Option C) s3 = s1 & s2 - This option is incorrect because the & operator is a bitwise operator and cannot be used with strings in Java. It is used for bitwise operations on integers.

Option D) s3 = s1 && s2 - This option is incorrect because the && operator is a logical operator and cannot be used with strings in Java. It is used for logical operations on boolean values.

The correct answer is A. This option is correct because the + operator can be used to concatenate strings in Java.

You need to create a class that will store unique object elements. You do not need to sort these elements but they must be unique. What interface might be most suitable to meet this need?

  1. Set

  2. List

  3. Map

  4. Vector


Correct Option: A

What is the result of the following operation? System.out.println(4 | 3);

  1. 6

  2. 0

  3. 1

  4. 7


Correct Option: D
- Hide questions