Java and .NET Programming Fundamentals

A quiz covering fundamental concepts in Java programming (9 questions on syntax, operators, collections, and OOP) and .NET/ASP.NET development (11 questions on web forms, configuration, server-side programming, and page lifecycle)

20 Questions Published

Questions

Question 1 Multiple Choice (Single Answer)

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
Question 2 Multiple Choice (Single Answer)

Which two methods are defined by IHttpHandler Interface?

  1. ProcessRequest and IsReusable
  2. ProcessResponse and IsReusable
  3. GenerateRequest and ProcessResponse
  4. GenerateResponse and ProcessRequest
Question 3 Multiple Choice (Single Answer)

Both the Page_Load and Page_PreRender events happen with each page Request.What is the difference between these two events?

  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.
Question 4 Multiple Choice (Single Answer)

You need to write a code segment that transfers the first 80 bytes from a stream variable named stream1 into a new byte array named byteArray. You also need to ensure that the code segment assigns the number of bytes that are transferred to an integer variable named bytesTransferred. Which code segment should you use?

  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;
Question 5 Multiple Choice (Single Answer)

You have determined that your company's website is housed on a web server that cannot handle ASP. What would you do?

  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
Question 6 Multiple Choice (Single Answer)

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
Question 7 Multiple Choice (Single Answer)

Abandon is an ASP ________ object method.

  1. server
  2. request
  3. session
  4. response
Question 8 Multiple Choice (Single Answer)

Which of these page extensions WILL NOT recognize and execute an include file?

  1. .shtml
  2. .shtm
  3. .stm
  4. .html
Question 9 Multiple Choice (Single Answer)

What is the transport protocol you use to call a Web service?

  1. TCP/IP
  2. UDP
  3. SOAP
  4. HTTP
Question 10 Multiple Choice (Single Answer)

What base class do all Web Forms inherit from?

  1. Web class
  2. Page class
  3. Data class
  4. Html classs
Question 11 Multiple Choice (Single Answer)

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

  1. Session
  2. Cookie
  3. Web.config
  4. Variable
Question 12 True/False

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

  1. True
  2. False
Question 13 Multiple Choice (Single Answer)

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;
Question 14 Multiple Choice (Single Answer)

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
Question 15 Multiple Choice (Single Answer)

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"
Question 16 Multiple Choice (Multiple Answers)

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

  1. if
  2. then
  3. goto
  4. case
Question 17 Multiple Choice (Single Answer)

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
Question 18 Multiple Choice (Single Answer)

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
Question 19 Multiple Choice (Single Answer)

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
Question 20 Multiple Choice (Single Answer)

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

  1. 6
  2. 0
  3. 1
  4. 7