Doncho Minkov Telerik School Academy schoolacademy.telerik.com Technical Trainer
2 1. Write a program that, for a given two integer numbers N and X, calculates the sum S = 1 + 1!/X + 2!/X 2 + … + N!/X N 2. Write a program that reads a number N and calculates the sum of the first N members of the sequence of Fibonacci: 0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144, 233, 377, … Each member of the Fibonacci sequence (except the first two) is a sum of the previous two members. 3. Write a program that calculates the greatest common divisor (GCD) of given two numbers. Use the Euclidean algorithm (find it in Internet).
4. Write a program that fills a matrix of size (N, N) as shown in the examples (for N=4): a)b) *c)*d)
4 5. * Write a program that converts a number in the range [ ] to a text corresponding to its English pronunciation. Examples: 0 "Zero" 273 "Two hundred seventy three" 400 "Four hundred" 501 "Five hundred and one" 711 "Severn hundred and eleven"
6. Write a program that reads a list of words, separated by spaces and prints the list in an alphabetical order. 7. Write a program to check if in a given expression the brackets are put correctly. Example of correct expression: ((a+b)/5-d). Example of incorrect expression: )(a+b)). 8. Write a program that generates and prints to the console 10 random values in the range [100,200]. 9. Write a program that prints to the console which day of the week is today. Use System.DateTime. 5
10. Write a program that parses an URL address given in the format: and extracts from it the [protocol], [server] and [resource] elements. For example from the URL the following information should be extracted: [protocol] = "http" [server] = " [resource] = "/forum/index.php" 6 [protocol]://[server]/[resource]
11. We are given a library of books. Define classes for the library and the books. The library should have name and a list of books. The books have title, author, publisher, year of publishing and ISBN. Keep the books in List (first find how to use the class System.Collections.Generic.List ). 12. Implement methods for adding, searching by title and author, displaying and deleting books. 13. Write a test class that creates a library, adds few books to it and displays them. Find all books by Nakov, delete them and print again the library. 7
14. Create a class student with properties FirstName, LastName, FN, Tel, , Marks (a List ), GroupNumber. Create a List with sample students. Select only the students that are from group number 2. Use LINQ query. Order the students by FirstName. 15. Implement the previous using the same query expressed with extension methods. 16. Extract all students that have in abv.bg. Use string methods and LINQ. 17. Extract all students with phones in Sofia. Use LINQ and regular expressions. 8
18. Select all students that have at least one mark Excellent (6) into a new anonymous class that has properties – FullName and Marks. Use LINQ. 19. Write down a similar program that extracts the students with exactly two marks "2". Use extension methods. 20. Extract all Marks of the students that enrolled in (The students from 2006 have 06 as their 5-th and 6-th digit in the FN). 22. Create a program that extracts all students grouped by GroupName and then prints them to the console. Use LINQ. 9
23. Using the Visual Studio Entity Framework designer create a ObjectContext for the Northwind database 24. Create a DAO class with static methods which provide functionality for inserting, modifying and deleting customers. Write a testing class. 25. Write a method that finds all customers who have orders made in 1997 and shipped to Canada. 26. Implement previous by using native SQL query and executing it through the ObjectContext. 27. Write a method that finds all the sales by specified region and period (start / end dates).
28. Create a database called NorthwindTwin with the same structure as Northwind using the features from ObjectContext. Find for the API for schema generation in MSDN or in Google. 29. Try to open two different data contexts and perform concurrent changes on the same records. What will happen at SaveChanges() ? How to deal with it? 30. By inheriting the Employee entity class create a class which allows employees to access their corresponding territories as property of type EntitySet.
31. Create a method that places a new order in the Northwind database. The order should contain several order items. Use transaction to ensure the data consistency. 32. Create a stored procedures in the Northwind database for finding the total incomes for given supplier name and period (start date, end date). Implement a C# method that calls the stored procedure and returns the retuned record set. 12