MTA Quiz Software Part 1 - Maysa Hassan

47 Questions | Total Attempts: 59

SettingsSettingsSettings
Please wait...
MTA Quiz Software Part 1 - Maysa Hassan

MTA certifications are a great place to start if you would like to get into the technology field. MTA certifications address a wide spectrum of fundamental technical concepts, assess and validate core technical knowledge, and enhance technical credibility. Give the software quiz below a test to gauge how conversant you are on softwares.


Questions and Answers
  • 1. 
    You need to gain a better understanding of the solution before writing the program. You decide to develope an algorithm that lists all necessary steps toperform an operation in the correct order. Any tecnique that you use should minimize complexity and ambiguity. Which of the following tecniques shouldyou use?
    • A. 

      Flowchart

    • B. 

      Decision table

    • C. 

      C# programme

    • D. 

      A paragraph in English

  • 2. 
    Which of the following languages is not considered a high-level programming language?
    • A. 

      C#

    • B. 

      Visual Basic

    • C. 

      Common Intermediate Language

    • D. 

      C ++

  • 3. 
    You are writing code for a business application by using C#. Write the following statement to declare an array:int[] numbers = { 1, 2, 3, 4, 5, };Now, you need to access the second item in this array (the number 2). Which of the following expression should you use?
    • A. 

      Numbers[0]

    • B. 

      Numbers[1]

    • C. 

      Numbers[2]

    • D. 

      Numbers[3]

  • 4. 
    You are writing a method namedPrintReportthat doesn't return a value to the calling code. Which keyword should you use in your methoddeclaration to indicate this fact?A
    • A. 

      Void

    • B. 

      Private

    • C. 

      Int

    • D. 

      String

  • 5. 
    You need to provide complex multi-way branching in your C# program. You need to make sure that your code is easy to read and understand. Which ofthe following C# statements should you use?
    • A. 

      Casr

    • B. 

      Break

    • C. 

      If-else

    • D. 

      Switch

  • 6. 
    You are developing a C# program that needs to perform 5 iterations. You write the following code:01: int count = 0;02: while (count <= 5)03: {04: Console.WriteLine("The value of count = {0}", count);05: count++;06: }When you run the program, you notice that the loop does not iterate five times. What should you do to make sure that the loop is executed exactly fivetimes?
    • A. 

      Change the code in line 01 to int count = 1;

    • B. 

      Change the code in line 02 to: while (count == 5)

    • C. 

      Change the code in line 02 to while (count >= 5)

    • D. 

      Change the code in line 05 to ++count;

  • 7. 
    You are developing a C# program. You write the following code line:int x = 6 + 4 * 4 / 2 - 1;What will be the value of the variablexafter this statement is executed?
    • A. 

      13

    • B. 

      19

    • C. 

      20

    • D. 

      14

  • 8. 
    You are writing a C# program that needs to manipulate very large integer values that may exceed 12 digits. The values can be positive or negative.Which data type should you use to store a variable like this?
    • A. 

      Int

    • B. 

      Float

    • C. 

      Double

    • D. 

      Long

  • 9. 
    You have written a C# method that opens a database connection by using theSqlConnectobject. The method retrieves some information from the database and then closes the connection. You need to make sure that your code fails gracefully when there is a database error. To handle this situation ,  you wrap the database code in a try-catch-finallyblock. You use two catch blocks—one to catch the exceptions of typeSqlException and the second to catch the exception of type Exception. Which of the following places should be the best choice for closing theSqlConnectionobject?
    • A. 

      Inside the try block, before the first catch block

    • B. 

      Inside the catch block that catches SqlException objects

    • C. 

      Inside the catch block that catches Exception objects

    • D. 

      Inside the finally block

  • 10. 
    You are assisting your colleague in solving a compiler error that his code is throwing. Following is the problematic portion of his code:try{bool success = ApplyPicardoRotation(100, 0);// additional code lines here}catch(DivideByZeroException dbze){//exception handling code}catch(NotFiniteNumberException nfne){//exception handling code}catch(ArithmeticException ae){//exception handling codewww.vceplus.com - Website designed to help IT pros advance their careers - Born to Learn}catch(OverflowException oe){//exception handling code}To remove the compilation error, which of the following ways should you suggest to rearrange the code ?
    • A. 

      Try { bool success = ApplyPicardoRotation(100, 0); // additional code lines here } catch(DivideByZeroException dbze) { //exception handling code } catch(ArithmeticException ae) { //exception handling code } catch(OverflowException oe) { //exception handling code }

    • B. 

      Try { bool success = ApplyPicardoRotation(100, 0); // additional code lines here } catch(DivideByZeroException dbze) { //exception handling code } catch(Exception e) { //exception handling code } catch(OverflowException oe) { //exception handling code }

    • C. 

      Try { bool success = ApplyPicardoRotation(100, 0); www.vceplus.com - Website designed to help IT pros advance their careers - Born to Learn // additional code lines here } catch(DivideByZeroException dbze) { //exception handling code } catch(NotFiniteNumberException nfne) { //exception handling code } catch(OverflowException oe) { //exception handling code } catch(ArithmeticException ae) { //exception handling code }

    • D. 

      Try { bool success = ApplyPicardoRotation(100, 0); // additional code lines here } catch(DivideByZeroException dbze) { //exception handling code } catch(NotFiniteNumberException nfne) { //exception handling code } catch(Exception e) { //exception handling code } catch(ArithmeticException ae) { //exception handling code }

  • 11. 
    You are developing a C# program. You write the following code:int i = 6;do{if (i == 3)break;Console.WriteLine("The value of i = {0}", i);i++;}while (i <= 5);How many times will the control enter the while loop?
    • A. 

      0

    • B. 

      1

    • C. 

      2

    • D. 

      3

  • 12. 
    You are developing an algorithm for a retail Web site. You need to calculate discounts on certain items based on the quantity purchased. You developthe following decision table to calculate the discount:   Quantity < 10  Y  N  N  N  Quantity < 50  Y  Y  N  N  Quantity < 100  Y  Y  Y  N   Discount   5 % 10 % 15 % 20 %If a customer buys 50 units of an item, what discount will be applicable to the purchase?
    • A. 

      5 percent

    • B. 

      10 percent

    • C. 

      15 percent

    • D. 

      20 percent

  • 13. 
    You are developing an algorithm before you write the C# program. You need to perform some calculations on a number. You develop the following  flowchart for the the calculationif the input valu   of n  is 5, what is the output value of the variable fact according to this flowchart?
    • A. 

      720

    • B. 

      120

    • C. 

      24

    • D. 

      6

  • 14. 
    You are writing a C# program that needs to iterate a fixed number of times. You need to make sure that your code is easy to understand and maintaineven when the loop body contains complex code. Which of the following C# statements provide the best solution for this requirement?
    • A. 

      While

    • B. 

      For

    • C. 

      Foreach

    • D. 

      Do-while

  • 15. 
    You created a class named GeoShape. You defined a method called Areain the GeoShape class. This method calculates the area of a geometric shape. You want the derived classes of  GeoShapeto supersede this functionality to support the area calculation of additional geometric shapes. Whenthe method Area is invoked on a GeoShape object, the area should be calculated based on the runtime type of the GeoShape object. Which keyword should you use with the definition of the Area method in the GeoShape class?
    • A. 

      Abstract

    • B. 

      Virtual

    • C. 

      New

    • D. 

      Overrides

  • 16. 
    Suppose that you defined a class Scenario that defines functionality for running customized pivot transform on large data sets. You do not want the functionality of this class to be inherited into derived classes. What keyword should you use to define the Scenario class?
    • A. 

      Sealed

    • B. 

      Abstract

    • C. 

      Abstract

    • D. 

      Internal

  • 17. 
    You are writing code for a class named Book . You should be able to get a list of all books sorted by the author’s last name. You need to write code to define this behavior of a class. Which of the following class elements should you use?
    • A. 

      Method

    • B. 

      Property

    • C. 

      Event

    • D. 

      Delegate

  • 18. 
    Suppose that you are writing code for a class named Product. You need to make sure that the data members of the class are initialized to their correct values as soon as you create an object of the Product class. The initialization code should always be executed. What should you do?
    • A. 

      Create a static method in the Product class to initialize data members.

    • B. 

      Create a constructor in the Product class to initialize data members.

    • C. 

      Create a static property in the Product class to initialize data members

    • D. 

      Create an event in the Product class to initialize data members.

  • 19. 
    You are creating a new class named Polygon. You write the following code class Polygon : IComparable{public double Length { get; set; }public double Width { get; set; }public double GetArea(){return Length * Width;}public int CompareTo(object obj){// to be completed}}You need to complete the definition of the Compare To method to enable comparison of the Polygon objects. Which of the following code segments should you use?
    • A. 

      Public int CompareTo(object obj) Polygon target = (Polygon)obj; double diff = this.GetArea() - target.GetArea(); if (diff == 0) return 0; else if (diff > 0) return 1; else return -1; } { Polygon target = (Polygon)obj; double diff = this.GetArea() - target.GetArea(); if (diff == 0) return 0; else if (diff > 0) return 1; else return -1; }

    • B. 

      Public int CompareTo(object obj) { Polygon target = (Polygon)obj; double diff = this.GetArea() - target.GetArea(); if (diff == 0) return 1; else if (diff > 0) return -1; else return 0; }

    • C. 

      Public int CompareTo(object obj) { Polygon target = (Polygon)obj; if (this == target) return 0; else if (this > target) return 1; else return -1; } if (this == target) return 0; else if (this > target) return 1; else return -1; }

    • D. 

      Public int CompareTo(object obj) { Polygon target = (Polygon)obj; if (this == target) return 1; else if (this > target) return -1; else return 0; }

  • 20. 
    You are writing code for a new method named Proces :void Draw(object o){}The code receives a parameter of type object . You need to cast this object into the type Polygon . At times, the value of  o  that is passed to the method might not be a valid Polygon value. You need to make sure that the code does not generate any System.InvalidCastException errorswhile doing the conversions. Which of the following lines of code should you use inside the Draw method to accomplish this goal
    • A. 

      Polygon p = (Polygon) o;

    • B. 

      Polygon p = o is Polygon;

    • C. 

      Polygon p = o as Polygon;

    • D. 

      Polygon p = (o != null) ? o as Polygon : (Polygon) o;

  • 21. 
    You are developing a C# application. You create a class of the name Widget . You use some third-party libraries, one of which also contains a class of the name Widget . You need to make sure that using the Widget class in your code causes no ambiguity. Which C# keyword should you use to address this requirement?
    • A. 

      Namespace

    • B. 

      Override

    • C. 

      Delegate

    • D. 

      Class

  • 22. 
    You are reviewing a C# program. The program contains the following class:public struct Rectangle{public double Length {get; set;}public double Width { get; set; }}The program executes the following code as part of theMainmethod:Rectangle r1, r2;r1 = new Rectangle { Length = 10.0, Width = 20.0 };r2 = r1;r2.Length = 30;Console.WriteLine(r1.Length);What will be the output when this code is executed?
    • A. 

      10

    • B. 

      20

    • C. 

      30

    • D. 

      40

  • 23. 
    You are developing a C# application. You need to decide whether to declare a class member as static. Which of the following statements is true about static members of a class?
    • A. 

      You can use the this keyword reference with a static method or property

    • B. 

      Only one copy of a static field is shared by all instances of a class.

    • C. 

      Static members of a class can be used only after an instance of a class is created.

    • D. 

      The static keyword is used to declare members that do not belong to individual objects but to a class itself.

  • 24. 
    You are C# developer who is developing a Windows application. You develop a new class that must be accessible to all the code packaged in the same assembly. Even the classes that are in the same assembly but do not directly or indirectly inherit from this class must be able to access the code. Any code outside the assembly should not be able to access the new class. Which access modifier should you use to declare the new class?
    • A. 

      Public

    • B. 

      Protected

    • C. 

      Private

    • D. 

      Internal

  • 25. 
    You are C# developer who is developing a Windows application. You need to provide a common definition of a base class that can be shared by multiple derived classes. Which keyword should you use to declare the new class?
    • A. 

      Virtual

    • B. 

      Sealed

    • C. 

      Interface

    • D. 

      Abstract