All questions in C#:
using System;
using System.Linq;
using System.Data.Linq;
using System.Xml.Linq;
using System.Collections;
and that the following array is defined:
string[] colors = { ""green"", ""brown"", ""blue"", ""red"" };
var query = from c in colors where c.Length > 3 orderby c.Length select c;
what type is variable query?
| int |
| string |
| IEnumerable<string> |
| IEnumerable<int> |
| IQueryable<string> |
| IQueryable<int> |
In current .NET Framework, what assembly must be included in a project to use the SoundPlayer class?
| System |
| System.Media |
| corelib |
| Sound |
In Generic Method implementation, the ________ clause specifies the type constraint for type parameter T.
| when |
| constraint |
| where |
| cnstr |
All arrays implicitly inherit from which generic interface?
| IList |
| IEnumerable |
| IEnumerator |
| a and b |
| a and c |
To avoid having to use fully qualified referenced classes, you could:
| Add a reference to the class. |
| Add an import statement for the class. |
| Add a using directive. |
| Inherit from the class. |
| Package the classes in the same solution. |
what type is variable query?
Answer:
IEnumerable<string>
Explanation:
The compiler translates this query to:
IEnumerable<string> query = colors .Where (c => c.Length > 3) .OrderBy (c => c.Length);
The Where and OrderBy methods, in this case, resolve to Enumerable.Where and Enumerable.OrderBy, which both return IEnumerable<T>. T is inferred to be stringbecause we haven't transformed or projected the input sequence elements in any way.
In current .NET Framework, what assembly must be included in a project to use the SoundPlayer class?
Answer:
Sound
Explanation:
To play a sound using the SoundPlayer class, configure a SoundPlayer with a path to the .wav file and call one of the play methods.
In Generic Method implementation, the ________ clause specifies the type constraint for type parameter T.
Answer:
where
Explanation:
The where clause in a generic definition specifies constraints on the types that are used as arguments for type parameters in a generic type, method, delegate
All arrays implicitly inherit from which generic interface?
Answer:
a and b
Explanation:
All arrays implicitly inherit from the generic interfaces IList and Innumerable with the type of thearray as the type argument, so the string array colors2 implements IEnumerable< string >
All questions in C#: using System; using System.Linq; using System.Data.Linq; using System.Xml.Linq; using System.Collections; and that...
Write a C++ program to manage a Point of Sale System for a Supermarket. The main user is an employee at the Supermarket. Build Specifications (36 points) 1. The system should load a catalog of all items that the store sells. 2. A user can search the inventory: The user of the system can search the inventory by using the name of the item or by category. 3. A user can sell items once they are found. Or can sell...
1 using System; 2 using System.Collections.Generic; 3 using System.Linq; 4 using System.Text; 5 namespace ConsoleApplication1 6 { class Program { 9 static void Main(string[] args) 10 { 11 test t = new test(10); Console.WriteLine(t. Getio); Console.WriteLine(t.J); 14 } 15 } 16 class test 17 { 18 18 private int i; 19 private int j; 20 public test(int a) 21 { 22 i = a; 23 j = a +5; public int Getio return i; } public int ) 29 30...
==Modify the M8B by using C#== using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace M8B { class Magic8Ball { static void Main(string[] args) { string question; Console.WriteLine("I am the Magic 8-ball! Ask me a question and I will give you an answer."); Console.Write("Your question: "); question = Console.ReadLine(); Console.WriteLine("\nLet me part the mists of the time for you."); Random rnd = new Random(); int roll =...
Question 1 If a method is marked as protected internal, who can access it? Classes that are both in the same assembly and derived from the declaring class. Only methods that are in the same class as the method in question. Internal methods can only be called using reflection. Classes within the same assembly, and classes derived from the declaring class Question 2 To avoid having to use fully qualified referenced classes, you could: Add a reference to the class....
using C#, implement classes as shown below:
Ready to pay as 4 questions for this (not only 1), just tell me
how can I pay the other 3.
nterface Order +make Order): string +make Payment (double amount): string Contact +contactID: integer name:string +address: string +phoneNum :string +Contact(int id, string name, st ring address, string phoneNum) +To String): string Customer Vendor +Customer (int id, st ring name, string address, string phoneNum) A +Vendor int id, string name, string address, string phoneNum)...
c++
6. Define classes shape, and classes circle and square, which inherit from shape. At the bottom of the page is a sample program using these classes, followed by its output. (a) Class shape has abstract virtual constant functions area and border which do not take arguments and which return double. It has a virtual constant function where which has no arguments and returns its lo- cation. It has a private field of type location and a ctor which accepts...
You must write C# classes which are used to manage product review data for Books and Cars. You will write an abstract class called Review which abstracts common properties (review rating and comments). You will then create an Interface responsible for the functionality to display the Reviewcontent. Then, you will create 2 concrete classes which inherit from Review and implement the Interface. Finally, you will create console applicationwhich will create 2 CarReview instances and 2 BookReview instances and display them...
Trying to make an autocomplete java program that given a prefix, find all strings in set that start with said prefix, in descending weight order. I created the classes Term.java, BinarySearchDeluxe.java, and Autocomplete.java posted below. I believe Term.java is correct, but where you see "//?" needs added code. I will also list before the code, the descriptions of said methods with "//?" to explain their purpose. DO NOT add more import packages or change the main methods as that is...
Write a program in C++ with comments! Create an abstract class Property, containing the data items owner, address and price. Add an abstract method showOwner(). Also provide getter/setters for all the data items. Make validations if necessary in the setter so that no invalid values are entered. Create a class House, to inherit the Property class. This class should contain additional data item – yardSize – an integer – the size of the yard of the house, getter and setter...
C# - Inheritance exercise
I could not firgure out why my code was not working. I was
hoping someone could do it so i can see where i went wrong.
STEP 1: Start a new C# Console Application project and rename its main class Program to ZooPark. Along with the ZooPark class, you need to create an Animal class. The ZooPark class is where you will create the animal objects and print out the details to the console. Add the...