ms

अब Quizwiz के साथ अपने होमवर्क और परीक्षाओं को एस करें!

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 be always executed. What should you do?

Constructors are special class methods that are executed when a new instance of a class is created. Constructors are used to initialize the data members of the object. Constructors must have exactly the same name as the class, and they do not have a return type. Multiple constructors, each with a unique signature, can be defined for a class. A constructor that takes no arguments is called the default constructor. Destructor is a special method of a class and it is used in a class to destroy the object or instances of classes. The destructor will invoke automatically whenever the class instances become unreachable. Each class can have only one destructor. A value type directly stores data within its memory and resides on the stack. A reference type stores a reference to a location on the heap.

Constructor method

Constructors are special class methods that are executed when a new instance of a class is created. Constructors are used to initialize the object's data members.

Deque

Dequeue removes the item that was added to the Queue first. Not the back of the list

Dictionary

Dictionaries: Represents a collection of data consisting of key/value pairs. The key will be a unique value in the Dictionary, but the same value can be assigned to more than one key. You can iterate through the items in a Dictionary to retrieve the key-value pair. Arrays: An array is a data structure in which You can store multiple variables of the same type. Each element in the array has an index. The indexes are zero-based so it starts at 0. You can access the elements in the array by using the index.

Dictionaries

Dictionaries: Represents a collection of data consisting of key/value pairs. The key will be a unique value in the Dictionary, but the same value can be assigned to more than one key. You can iterate through the items in a Dictionary to retrieve the key-value pair. The Dictionary class in C# represents a generic data structure that can contain keys and values of data. Hence, you can store data of any type in a Dictionary instance. The Dictionary class is contained inside the System.Collections.Generic namespace.

DOM

Document object Model Structural representation of the model and their relationships

This question requires that you evaluate the underlined text to determine if it is correct. Arguments are passed to console applications as a Hashtable object. Select the correct answer if the underlined text does not make the statement correct. Select "No change is needed'' if the underlined text makes the statement correct.

Explanation: Arguments are passed to console applications as a String Array object.

The purpose of the Finally section in an exception handler is to:

Explanation: By using a finally block, you can clean up any resources that are allocated in a try block, and you can run code even if an exception occurs in the try block. Typically, the statements of a finally block run when control leaves a try statement. The transfer of control can occur as a result of normal execution, of execution of a break, continue, goto, or return statement, or of propagation of an exception out of the try statement.

Which service can host an ASP.NET application?

Explanation: Using Internet Information Services (IIS) Manager, you can create a local Web site for hosting an ASP.NET Web application.

Performance is a benefit of encapsulation

FALSE Encapsulation is an information-hiding mechanism that makes code easy to maintain and understand. Properties offer a great way to encapsulate data fields along with any accompanying logic. Access modifiers such as private and public allow you to control the level of access for a class member or for the class itself.

Protected access modifier

For the protected access modifier, access is restricted only to the derived classes.

You have a website that includes a form for usemame and password. You need to ensure that users enter their username and password. The validation must work in all browsers. Where should you put the validation control?

From version 2.0 on, ASP.NET recognized the JavaScript capabilities of these browsers, so client-side validation is now available to all modern browsers, including Opera, Firefox, and others. Support is even better now in ASP.NET 4.0. That said, its important not to forget that JavaScript can be disabled in any browser, so client-side validation cannot be relied uponwe must always validate any submitted data on the server.

HTML

Hypertext Markup Language. It is a declarative language. HTML is an open markup language. It can be accessed by any application that can read plain text. That includes, but is not limited to, a web browser. Only correctly marked up HTML documents are accessible.

Where is the DOM

In the browser, generated when the HTML document is loaded, and manipulated by JavaScript

Interfaces

Interfaces are used to establish contracts through which objects can interact with each other without knowing the implementation details.

IIS

Internet Information Services

Which programming language is characterized as client-side, dynamic and weakly typed?

JavaScript is characterized as a dynamic, weakly typed, prototype-based language with first-class functions. It is primarily used in the form of client-side JavaScript for the development of dynamic websites.

Namespaces

Namespaces in C# are used to organize too many classes so that it can be easy to handle the application. In a simple C# program, we use System.Console where System is the namespace and Console is the class. To access the class of a namespace, we need to use namespacename.classname.

You defined a class AdvMath that defines advanced mathematical functionality. You do not want the functionality of this class to be inherited into derived classes. What keyword should you use to define the AdvMath class?

SEALED. NOT PRIVATE When applied to a class, the sealed modifier prevents other classes from inheriting from it.

Later in the program, you need to add a method named CalculateArea to the method invocation list of the handler variable. The signature of the CalculateArea method matches the signature of the PolygonHandler method. Any code that you write should not affect any existing event-handling code. Given this restriction, which of the following code lines should you write? a) handler = new PolygonHandler(CalculateArea); b) handler = CalculateArea; c) handler += CalculateArea; d) handler -= CalculateArea;

Section Reference: Understanding Events You need to use the += operator rather than the simple assignment operator (=) to attach the event handler. By using the += operator, you ensure that this event handler will be added to a list of event handlers already attached with the event

List facts

Singly Linked List: Singly linked lists contain nodes which have a data part and an address part, i.e., Next, which points to the next node in the sequence of nodes. The next pointer of the last node will point to null, so backtracking is not possible. Doubly Linked List: In a doubly linked list, each node contains two links - the first link points to the previous node and the next link points to the next node in the sequence. The previous pointer of the first node and next pointer of the last node will point to null. Circular Linked List: In the circular linked list, the next of the last node will point to the first node, thus forming a circular chain. Doubly Circular Linked List: In this type of linked list, the next of the last node will point to the first node and the previous pointer of the first node will point to the last node.

Static members:

Static members belong to a class itself rather than individual objects. A static method is callable on a class even when no instance of the class has been created.

You are creating a variable for an application. You need to store data that has the following characteristics in this variable: ✑ Consists of numbers and characters ✑ Includes numbers that have decimal points Which data type should you use?

String

Design

The Design phase consists of designing models, plans and architecture for how the software will be developed and implemented. Resulting documentation Technical Specification: A technical specification document defines the requirements for a project, product, or system. A specification is the information on technical design, development, and procedures related to the requirements it outlines. This document provides information to developers and other stakeholders on business requirements, internal standards, and best practices as well as Non-functional requirements, e.g. scalability, security, reliability. Main Stakeholders in Design phase: An architect designs the technical blueprint of the system. This includes identifying components and services, their behaviour, and how they interact with each other and with the external world. A user-experience designer creates the user experience of the system. This includes designing the user interface (UI) elements; designing navigation between various forms, screens or pages, etc.

The Hashtable

The Hashtable class is contained in the System.Collections namespace. Hashtable represents a data structure that can store objects as key value pairs. You can search for a value in an instance of Hashtable class using the corresponding key. Note that both the key and the value that is stored in a Hashtable instance is of the object type. You can iterate through the keys in Hastable.keys to retireve the keys and values of the items in a Hashtable. A HAshtable is known for fast searches: Searching an item in a Hashtable is faster compared to other non-generic collections - let's understand why. A record in a Hashtable in buckets (each bucket can contain multiple records) using hash keys. The hash key is in turn generated automatically by using a hashing algorithm. The MSDN states: "When an element is added to the Hashtable, the element is placed into a bucket based on the hash code of the key. Subsequent lookups of the key use the hash code of the key to search in only one particular bucket, thus substantially reducing the number of key comparisons required to find an element.

The activities of an application lifecycle are likely to take place in the following order

The activities of an application lifecycle are likely to take place in the following order: requirements analysis, design, coding, testing, and release.

as operator

The as operator is similar to the cast operation but, in the case of as, if the type conversion is not possible, null is returned rather than an exception raised. An exception may be generated with the code in the other answer choices.

TrimToSize.

The capacity of the queue can be decreased by calling TrimToSize.

Get

The get keyword defines an accessor method in a property or indexer that returns the property value or the indexer element. The Consumer of the class will be able to read the values of the property but will not be able to write values to the property.

You are creating a new class named Square that is derived from the Polygon class. The Polygon class has the following code: class Polygon { public virtual void Draw() { // additional code . . . } } The Draw method in the Square class should provide new functionality but also hide the Polygon class implementation of the Draw method. Which code segment should you use to accomplish this?

The override keyword replaces a base-class member in a derived class. The new keyword creates a new member with the same name in the derived class and hides the base-class implementation.

The return statement

The return statement terminates execution of the method in which it appears and returns control to the calling method. It can also return an optional value. If the method is a void type, the return statement can be omitted.

The virtual and interface keywords

The virtual and interface keywords cannot be applied to a class.

Virtual

The virtual keyword is used to modify a method, property, indexer, or event declared in the base class and allow it to be overridden in the derived class. The override keyword is used to extend or modify a virtual/abstract method, property, indexer, or event of base class into derived class

Let

This keyword is a part of a query expression. It introduces a variable. We can then reuse the variable elsewhere in the query.

Branching

This question is about version control. Version control systems allow you to compare files, identify differences, and merge the changes if needed prior to committing any code. Versioning is also a great way to keep track of application builds by being able to identify which version is currently in development. Coding files on a project under version control can be separated in parallel for more than one Software Developer to work on different parts of the code simultaneously. This is known as branching. At some point the coding files are merged again to the parent branch (trunk or mainline).

StackOverflowException

Thrown when the execution stack is exhausted by having too many pending method calls; usually indicates a very deep or infinite recursion.

What is the purpose of a class constructor?

To initialize an object of the class Constructors are special class methods that are executed when a new instance of a class is created. Constructors are used to initialize the data members of the object. Constructors must have exactly the same name as the class, and they do not have a return type. Multiple constructors, each with a unique signature, can be defined for a class. A constructor that takes no arguments is called the default constructor. Destructor is a special method of a class and it is used in a class to destroy the object or instances of classes. The destructor will invoke automatically whenever the class instances become unreachable. Each class can have only one destructor. A value type directly stores data within its memory and resides on the stack. A reference type stores a reference to a location on the heap.

URL

Universal Resource Locator

In a class, you defined a method called Render. This method provides functionality to render bitmap files on the screen. You would like the derived classes to supersede this functionality to support the rendering of additional image formats. You also want the Render method of the derived classes to be executed even if a derived class is cast as the base class. Which keyword should you use with the definition of the Render method in the base class?

Use the abstract modifier in a class declaration to indicate that a class is intended only to be a base class of other classes. Members marked as abstract, or included in an abstract class, must be implemented by classes that derive from the abstract class. The virtual keyword is used to modify a method, property, indexer, or event declaration and allow for it to be overridden in a derived class. The virtual member can also be executed from the base class. The override modifier is required to extend or modify the abstract or virtual implementation of an inherited method, property, indexer, or event.

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

Use the namespace keyword. A namespace is a language element that allows you to organize code and create globally unique class names.

Sealed Class

When applied to a class, the sealed modifier prevents other classes from inheriting from it.

You have a class named Glass that inherits from a class named Windows. The Windows class includes a protected method named break(). How should you call the Glass class implementation of the break() method? In other words, which line of code should you add to the Glass.break() method below the //Add code here comment?

When you create the break method in the Glass class in Visual Studio, it automatically adds the base.break(); implementation to the overridden break method in the Glass class.

Local Service

You have a Windows Service running in the context of an account that acts as a non- privileged user on the local computer. The account presents anonymous credentials to any remote server. What is the security context of the Windows Service?

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 errors while 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;

c

You need to provide printing functionality to several of your classes. Each class's algorithm for printing will likely be different. Also, not all the classes have an "is-a" relationship with each other. How should you support this functionality? a) Add the print functionality to a base class with the public access modifier. b) Have all classes inherit from an abstract base class and override the base-class method to provide their own print functionality. c) Have all the classes inherit from a base class that provides the print functionality. d) Create a common interface that all classes implement.

d

DNS

domain name server

Polymorphism vs Inheritance

he abstract classes provide a common definition of a base class that can be shared by multiple derived classes.

Requirements Analysis

is the process of determining the detailed business requirements for a new software system.

2. You are planning to develop a new software system for your organization. You need to review the plans, models, and architecture for how the software will be implemented. Of which of the following activities should you review the output? a) requirements analysis b) design c) coding d) testing

nswer: b Difficulty: Medium The design activity is used to create plans, models, and architecture for how the software will be implemented.

How many parameters can a default constructor have?

0. If you don't provide a constructor for your class, C# creates one by default that instantiates the object and sets member variables to default values. The default constructor does not have any parameters.

LinkedList

1. You can add nodes anywhere in a linked list - true. 2. A linked list has a maximum of 200 nodes - false, the number of nodes in a linkedlist can grow or shrink on demand. 3. A linked list is a sequential data structure and cannot easily be sorted in another order - true, but nodes can be added and removed after or before any other node. 4. Data− Each node of a linked list can store a data. - true. 5. Address − Each node of a linked list contains an address to the next node, called "Address". - false this address is called "Next". 6. The first node of a Linked List is referenced by a pointer called Head -= true. 7. Effective Memory Management: They are dynamic in nature and allocate memory as and when required. - true.

Which of the following types of functions can be overridden by a derived class?

A member must be either virtual or abstract to be overridden. The private access modifier restricts access to its containing class, so it is not accessible by a derived class. A protected member is accessible within its class and by all derived classes, so the correct answer is a protected virtual member function.

Method

A method defines the behavior of a class. You can write a method that returns a list of all books sorted by the author's last name.

Static Method

A static method in C# is a method that keeps only one copy of the method at the Type level, not the object level. That means, all instances of the class share the same copy of the method and its data. The last updated value of the method is shared among all objects of that Type.

Web browser

Advanced viewer for web documents

Which of the following must exist to inherit attributes from a particular class?

An Is-a Relationship There needs to be inheritance to inherit attributes from a particular class - so there needs to be an is-a relationship. The is-a relationship refers to inheritance. Properties can also be protected or internal to be inherited. The has-a relationship refers to composition of classes - one class can make use of the properties of another, e.g. Car has an engine, so there would be a Car class in which you can instantiate an Engine object, but an Engine is not a Car.

Abstract Class vs Interface

An abstract class is a class that is not implemented directly, containing one or more abstract methods, or methods that are not yet implemented. An interface can have only abstract methods, with a caveat in default methods. They are not close enough entities to classes to be thought of as one-- they exist primarily to describe a set of functions that a class that is said to be of that interface should have. (cars should accelerate, brake, and change gears, but you would never say that a car is a child of brakes). An important feature of interfaces is that multiple can be implemented by a class, as opposed to the option of extending a single abstract class.

6. You are planning to develop a new software system for your organization. You need to review the plan for packaging, deployment, delivery, and support for the software. Which of the following should you contact? a) quality assurance manager b) release manager c) technical architect d) database administrator

Answer: b Difficulty: Medium Section Reference: Understanding Application Lifecycle Management Release management includes activities such as packaging and deploying the software, managing software defects, and managing software change requests. The release manager coordinates various teams and business units to ensure timely release of a software product.

3. You are planning to develop a new software system for your organization. You need to review the system's technical blueprint. Which of the following participants is responsible for providing the technical blueprint? a) user interface designer b) developer c) architect d) technical writer

Answer: c Difficulty: Medium Section Reference: Understanding Application Lifecycle Management An architect designs the technical blueprint of the system. This includes identifying components and services, their behavior, and how they interact with each other and with the external world.

19. You are C# developer who is developing a Windows application. You write the following code: Object o; Later in the code, you need to assign the value in the variable o to an object of Rectangle type. You expect that at runtime the value in the variable o is compatible with the Rectangle class. However, you need to make sure that no exceptions are raised when the value is assigned. Which of the following code should you use? a) Rectangle r = (Rectangle) o; b) Rectangle r = o; c) Rectangle r = o as Rectangle; d) Rectangle r = o is Rectangle;

Answer: c Difficulty: Medium Section Reference: Understanding Inheritance In case of simple cast operation, the runtime checks whether the value of the variable o is compatible with the Rectangle class. If, at execution time, the value of o is not compatible with the Rectangle class, the runtime throws a System.InvalidCastException. The as operator is similar to the cast operation but, in the case of as, if the type conversion is not possible, null is returned rather than an exception raised.

13. You are reviewing a C# program that contains the following class: public class Rectangle { public double Length {get; set;} public double Width { get; set; } } The program executes the following code as part of the Main method: 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

Answer: c Difficulty: Medium Section Reference: Understanding Values and References The class Rectangle is a reference type, and the content of variable r1 is actually a reference to a memory location that holds a Rectangle object. So, after the r2 = r1; statement, both r1 and r2 point to the same memory location and in turn the same Rectangle object. In other words, there is only one rectangle object in memory, and both r1 and r2 are referring to it. When the Length property is modified, the change applies to both objects r1 and r2.

7. 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

Answer: d Difficulty: Medium Section Reference: Understanding Access Modifiers For the private access modifier, access is restricted only to the containing class. For the public access modifier, access is not restricted. For the protected access modifier, access is restricted only to the derived classes. For the internal access modifier, access is restricted only to the code in the same assembly.

. You are planning to develop a new software system for your organization. Someone needs to be responsible for developing system manuals and help files. Which of the following participants should you identify for this task? a) user interface designer b) content developer c) user interface designer d) technical writer

Answer: d Difficulty: Medium Section Reference: Understanding Application Lifecycle Management Identify a technical writer for this task. Technical writers develop the system manuals and help files that will be delivered with the application.

7. You are in the process of developing a new software application. As defects are reported, you take the necessary steps to fix them. You need to make sure that each new fix doesn't break anything that was previously working. Which type of testing should you use? a) integration testing b) system testing c) acceptance testing d) regression testing

Answer: d Difficulty: Medium Section Reference: Understanding Testing As the defects in a software application are reported and fixed, you need to make sure that each new fix doesn't break anything that was previously working. This is where regression testing comes in handy. With every new fix, software testers usually run a battery of regression tests to make sure that every function that was already known to work correctly is still working.

Converting a value type to a reference type in an object

Bixing

What is the difference between a double and a float?

Both Double and float data type are used to represent floating point numbers in Java, a double data type is more precise than float. A double variable can provide precision up to 15 to 16 decimal points as compared to floatprecision of 6 to 7 decimal digits

private modifier

restricts the access to the class in which the member was defined.

internal modifier

restricts the access to the code in the same assembly.

protected modifier

restricts the access to the containing class and to any class derived directly or indirectly from the containing class

Bussiness Analyst

s responsible for analyzing business needs and converting them into requirements that can be executed by the development team.

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?

sealed

virtual method

the runtime type of the object is checked for an overriding member. The overriding member in the most derived class is called, which might be the original member, if no derived class has overridden the member.

Both inheritance and composition allow you to create subojects

true

You created a class named GeoShape. You defined a method called Area in the GeoShape class. This method calculates the area of a geometric shape. You want the derived classes of GeoShape to supersede this functionality to support the area calculation of additional geometric shapes. When the 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?

virtual

the abstract classes

provide a common definition of a base class that can be shared by multiple derived classes.

sealed classes

provide complete functionality but cannot be used as base classes.


संबंधित स्टडी सेट्स

Nurse 2 Test 9 Diabetes PrepU Study Guide

View Set

Certification Exam QBO - Version A

View Set

Managing IT Projects Chapter 5, IT PROJECT MANAGEMENT 7e, IT Project Management Chapter 6, ch.7 It project management schwalbe, IT Project Management Chapter 8, Project Management Chapter 6, IT Project Management Chapter 7, Project Management Exam 2,...

View Set