Главная / Мобильные технологии /
Разработка приложений для Windows Phone 7 / Тест 3
Разработка приложений для Windows Phone 7 - тест 3
Упражнение 1:
Номер 1
Язык программирования C#
Ответ:
 (1) похож на Pascal 
 (2) имеет Си-подобный синтаксис 
 (3) является декларативным языком 
 (4) имеет Lisp-подобный синтаксис 
 (5) не требует строгой типизации 
Номер 2
Модули в языке C#
Ответ:
 (1) заключаются в фигурные скобки 
 (2) заключаются в угловые скобки 
 (3) имеют открытый и закрытый тег 
 (4) заключаются в разделы BEGIN…END
 
 (5) описываются в заголовке программы 
 (6) требуют строгой типизации 
Номер 3
Основным инструментом разработки приложений Windows Presentation Foundation, Silverlight и XNA является
Ответ:
 (1) Си 
 (2) C# 
 (3) Java 
 (4) JavaScript 
 (5) Pyton 
 (6) Rubi 
Упражнение 2:
Номер 1
WPF-приложения можно создавать на языках
Ответ:
 (1) Visual Basic.Net 
 (2) C# 
 (3) Java 
 (4) JavaScript 
 (5) Delphi 
 (6) Ada 
Номер 2
С точки зрения синтаксиса языка C# правильным будет выражение
Ответ:
 (1) double a; a = 3,14159;
 
 (2) double a; a = 3.14159;
 
 (3) int a; a = 3.14159;
 
 (4) int a; a = 3,14159;
 
 (5) string a; a = 3.14159;
 
 (6) string a; a = 3,14159;
 
Номер 3
С точки зрения синтаксиса языка C# правильным будет выражение
Ответ:
 (1) string a; a = '3,14159';
 
 (2) string a; a = '3.14159';
 
 (3) string a; a = "3,14159";
 
 (4) string a; a = "3.14159";
 
 (5) string a; a = #3,14159#;
 
 (6) string a; a = #3.14159#;
 
Упражнение 3:
Номер 1
С точки зрения синтаксиса языка C# правильным будет выражение
Ответ:
 (1) int a,b,c;a = -8;b = 6;if (a > b) { c = a; } else { c = b; }Console.WriteLine("Максимальное из двух чисел ... " + a);
 
 (2) int a,b,c;a = -8;b = 6;if (a > b) { c = a; } else { c = b; }Console.WriteLine("Максимальное из двух чисел ... " + c);
 
 (3) int a,b,c;a = -8;b = 6;if (a > b) { c = a; } else { c = b; }Console.WriteLine("Максимальное из двух чисел ... " + d);
 
 (4) int a, b, c; a = -8; b = 6; if (a > b) { a = c; } else { b = c; } Console.WriteLine("Максимальное из двух чисел ... " + c);
 
 (5) string a,b,c;a = -8;b = 6;if (a > b) { c = a; } else { c = b; }Console.WriteLine("Максимальное из двух чисел ... " + a);
 
 (6) int a, b, c; a = -8; b = 6; if (a > b) { a = c; } else { b = a; } Console.WriteLine("Максимальное из двух чисел ... " + c);
 
Номер 2
Ответ:
 (1) var a, b, c, str; a = "Москва"; b = " - столица"; c = " нашей Родины!"; str = a + b + c;
 
 (2) string a, b, c, str; a = "Москва"; b = " - столица"; c = " нашей Родины!"; str = a + b + c;
 
 (3) string a, b, c, str; a = 'Москва'; b = ' - столица'; c = ' нашей Родины!'; str = a + b + c;
 
 (4) var a, b, c, str; a = 'Москва'; b = ' - столица'; c = ' нашей Родины!'; str = a + b + c;
 
 (5) string a, b, c, str; a = #Москва#; b = # - столица#; c = # нашей Родины!#; str = a + b + c;
 
Номер 3
В циклах с предусловием
Ответ:
 (1) нет условия завершения цикла 
 (2) нет итерационной переменной 
 (3) заранее неизвестно количество итераций 
 (4) заранее известно количество итераций 
 (5) есть условие завершения цикла 
Упражнение 4:
Номер 1
С точки зрения синтаксиса языка C# правильным будет выражение
Ответ:
 (1) int i, n, sum; string str; n = 10; sum = 0; for (i = 1; i <= n; i++) { sum += i; }
 
 (2) int i, n, sum; string str; n = 10; for (i = 1; i <= n; i++) { sum += i; }
 
 (3) int i, n; string sum; string str; n = 10; sum = 0; for (i = 1; i <= n; i++) { sum += i; }
 
Номер 2
С точки зрения синтаксиса языка C# правильным будет выражение
Ответ:
 (1)
using System;
namespace Example
{
class Program
{
void avg(double a, double b, double c)
{
double average = (a + b + c) / 3;
string str;
str = "Среднее арифметическое = " + average;
Console.WriteLine(str);
Console.WriteLine("Нажмите любую кнопку!");
Console.ReadKey();
}
static void Main()
{
double x, y, z;
x = 3.9; y = 5.6; z = 7.11;
avg(x, y, z);
}
}
}
 
 (2)
using System;
namespace Example
{
class Program
{
static void avg(double a, double b, double c)
{
double average = (a + b + c) / 3;
string str;
str = "Среднее арифметическое = " + average;
document.write(str);
document.write("Нажмите любую кнопку!");
Console.ReadKey();
}
static void Main()
{
double x, y, z;
x = 3.9; y = 5.6; z = 7.11;
avg(x, y, z);
}
}
}
 
 (3)
using System;
namespace Example
{
class Program
{
static void avg(double a, double b, double c)
{
double average = (a + b + c) / 3;
string str;
str = "Среднее арифметическое = " + average;
Console.WriteLine(str);
Console.WriteLine("Нажмите любую кнопку!");
Console.ReadKey();
}
static void Main()
{
double x, y, z;
x = 3.9; y = 5.6; z = 7.11;
avg(x, y, z);
}
}
}
 
 (4)
using System;
namespace Example
{
class Program
{
static void avg(double a, double b, double c)
{
double average = (a + b + c) / 3;
double str;
str = "Среднее арифметическое = " + average;
Console.WriteLine(str);
Console.WriteLine("Нажмите любую кнопку!");
Console.ReadKey();
}
static void Main()
{
double x, y, z;
x = 3.9; y = 5.6; z = 7.11;
avg(x, y, z);
}
}
}
 
 (5)
using System;
namespace Example
{
class Program
{
double avg(double a, double b, double c)
{
double average = (a + b + c) / 3;
string str;
str = "Среднее арифметическое = " + average;
Console.WriteLine(str);
Console.WriteLine("Нажмите любую кнопку!");
Console.ReadKey();
}
static void Main()
{
double x, y, z;
x = 3.9; y = 5.6; z = 7.11;
avg(x, y, z);
}
}
}
 
Номер 3
С точки зрения синтаксиса языка C# правильным будет выражение
Ответ:
 (1)
using System;
class Example
{
static void Main()
{
DateTime saveNow = new Date;
string str;
str = "Сегодня: " + saveNow;
Console.WriteLine(str);
Console.WriteLine("Нажмите любуй кнопку!");
Console.ReadKey();
}
}
 
 (2)
using System;
class Example
{
static void Main()
{
DateTime saveNow = Now();
string str;
str = "Сегодня: " + saveNow;
Console.WriteLine(str);
Console.WriteLine("Нажмите любуй кнопку!");
Console.ReadKey();
}
}
 
 (3)
using System;
class Example
{
static void Main()
{
Date saveNow = DateTime.Now;
string str;
str = "Сегодня: " + saveNow();
Console.WriteLine(str);
Console.WriteLine("Нажмите любуй кнопку!");
Console.ReadKey();
}
}
 
 (4)
using System;
class Example
{
static void Main()
{
DateTime saveNow = DateTime.Now;
string str;
str = "Сегодня: " + saveNow;
Console.WriteLine(str);
Console.WriteLine("Нажмите любуй кнопку!");
Console.ReadKey();
}
}
 
 (5)
using System;
class Example
{
static void Main()
{
DateTime saveNow = DateTime.Now;
string str;
str = "Сегодня: " + Now();
Console.WriteLine(str);
Console.WriteLine("Нажмите любуй кнопку!");
Console.ReadKey();
}
}
 
Номер 4
С точки зрения синтаксиса языка C# правильным будет выражение
Ответ:
 (1)
using System;
class Example
{
static void Main()
{
System.DateTime date1 = new System.DateTime(1983, 15, 1, 0, 0, 0);
DateTime date2 = DateTime.Now;
System.TimeSpan diff1 = date2.Subtract(date1);
string str;
str = "Первая дата: " + date1;
str += "\nВторая дата: " + date2;
str += "\nВторая дата - Первая дата: " + diff1;
Console.WriteLine(str);
Console.WriteLine("Нажмите любую кнопку!");
Console.ReadKey();
}
}
 
 (2)
using System;
class Example
{
static void Main()
{
System.DateTime date1 = new System.DateTime(1983, 1, 1, 0, 0, 0);
DateTime date2 = DateTime.Now;
System.TimeSpan diff1 = date2.Subtract(date1);
string str;
str = "Первая дата: " + date1;
str += "\nВторая дата: " + date2;
str += "\nВторая дата - Первая дата: " + diff1;
Console.WriteLine(str);
Console.WriteLine("Нажмите любую кнопку!");
Console.ReadKey();
}
}
 
 (3)
using System;
class Example
{
static void Main()
{
System.DateTime date1 = new System.DateTime(1983, 1, 1, 0, 0, 0);
DateTime date2 = Now();
System.TimeSpan diff1 = date2.Subtract(date1);
string str;
str = "Первая дата: " + date1;
str += "\nВторая дата: " + date2;
str += "\nВторая дата - Первая дата: " + diff1;
Console.WriteLine(str);
Console.WriteLine("Нажмите любую кнопку!");
Console.ReadKey();
}
}
 
 (4)
using System;
class Example
{
static void Main()
{
System.DateTime date1 = new System.DateTime(1983, 1, 1, 0, 0, 0);
DateTime date2 = DateTime.Now;
System.TimeSpan diff1 = date2.Subtract(Now);
string str;
str = "Первая дата: " + date1;
str += "\nВторая дата: " + date2;
str += "\nВторая дата - Первая дата: " + diff1;
Console.WriteLine(str);
Console.WriteLine("Нажмите любую кнопку!");
Console.ReadKey();
}
}
 
 (5)
using System;
class Example
{
static void Main()
{
System.DateTime date1 = new System.DateTime(1983, 1, 1, 0, 0, 0);
DateTime date2 = DateTime.Now;
System.TimeSpan diff1 = date2.Subtract(date1);
string str;
str = "Первая дата: " + date1;
str += "\nВторая дата: " + date2;
str += "\nВторая дата - Первая дата: " + Now;
Console.WriteLine(str);
Console.WriteLine("Нажмите любую кнопку!");
Console.ReadKey();
}
}
 
Упражнение 5:
Номер 1
С точки зрения синтаксиса языка C# правильным будет выражение
Ответ:
 (1)
using System;
class Example
{
static void Main()
{
double[] a = new double[] { 8.3, 11.6 - 4.8, 23.11, 54.03, 26.8, 9.4 };
int n = sizeof(a)/sizeof([0]);
string str;
int i;
double sum = 0;
for (i = 0; i < n; i++)
{
sum += a[i];
}
str = "Сумма массива равна " + sum;
Console.WriteLine(str);
Console.WriteLine("Нажмите любую кнопку!");
Console.ReadKey();
}
}
 
 (2)
using System;
class Example
{
static void Main()
{
double a[] = { 8.3, 11.6 - 4.8, 23.11, 54.03, 26.8, 9.4 };
int n = a.Length;
string str;
int i;
double sum = 0;
for (i = 0; i < n; i++)
{
sum += a[i];
}
str = "Сумма массива равна " + sum;
Console.WriteLine(str);
Console.WriteLine("Нажмите любую кнопку!");
Console.ReadKey();
}
}
 
 (3)
using System;
class Example
{
static void Main()
{
double[] a = new double[] { 8.3, 11.6 - 4.8, 23.11, 54.03, 26.8, 9.4 };
int n = a.Length;
string str;
int i;
double sum = 0;
for (i = 0; i < n; i++)
{
sum += a[i];
}
str = "Сумма массива равна " + sum;
Console.WriteLine(str);
Console.WriteLine("Нажмите любую кнопку!");
Console.ReadKey();
}
}
 
 (4)
using System;
class Example
{
static void Main()
{
double[] a = double[] { 8.3, 11.6 - 4.8, 23.11, 54.03, 26.8, 9.4 };
int n = a.Length;
string str;
int i;
double sum = 0;
for (i = 0; i < n; i++)
{
sum += a[i];
}
str = "Сумма массива равна " + sum;
Console.WriteLine(str);
Console.WriteLine("Нажмите любую кнопку!");
Console.ReadKey();
}
}
 
 (5)
#include<iostream>
#include<math.h>
using namespace std;
void main()
{
double a[]={8.3,11.6-4.8,23.11,54.03,26.8,9.4};
int n=sizeof(a)/sizeof(a[0]);
int i;
double sum=0;
for(i=0;i<n;i++)
{
cout<<"\na["<<i<<"] = "<<a[i];
sum+=a[i];
}
cout<<"\nsum = "<<sum;
}
 
 (6)
<html>
<script type="text/javascript">
var i,n,sum,str;
a = new Array(8.3,11.6-4.8,23.11,54.03,26.8,9.4);
n = a.length;
str="";
sum = 0;
for (i = 0; i < n; i++)
{
str+="a["+ i + "] = " + a[i] + "<br>";
sum += a[i];
}
str+= "Сумма массива равна " + sum ;
document.write(str);
</script>
</html>
 
Номер 2
С точки зрения синтаксиса языка C# правильным будет выражение
Ответ:
 (1)
using System;
class Example
{
static void print(int[][] alpha)
{
for (int i = 0; i < alpha.Length; i++)
{
for (int j = 0; j < alpha[i].Length; j++)
{
System.Console.Write("{0}{1}", alpha[i][j], j == (alpha[i].Length - 1) ? "" : " ");
}
System.Console.WriteLine();
}
}
static void Main()
{
int[][] a = new int[5][];
a[0] = new int[3] { 1, 2, 3 };
a[1] = new int[3] { 4, 5, 6 };
a[2] = new int[3] { 7, 8, 9 };
a[3] = new int[3] { 10, 11, 12 };
a[4] = new int[3] { 13, 14, 15 };
print(a);
System.Console.WriteLine("Нажмите любую кнопку!");
System.Console.ReadKey();
}
}
 
 (2)
#include<iostream>
#include<math.h>
using namespace std;
#define n 5 //Количество строк
#define m 3 //Количество столбцов
void main()
{
int i,j;
double d[n][m]= {
{1, 2, 3 },
{4, 5, 6 },
{7, 8, 9 },
{10,11,12},
{13,14,15}
};
for(i=0;i<n;i++)
{
cout<<"\n";
for(j=0;j<m;j++)
{
cout<<"\t"<<d[i][j];
}
}
cout<<"\n"<<endl;
}
 
 (3)
<html>
<script type="text/javascript">
var i,j,n,str;
a=new Array();
a[0]=new Array(1,2,3);
a[1]=new Array(4,5,6);
a[2]=new Array(7,8,9);
a[3]=new Array(10,11,12);
a[4]=new Array(13,14,15);
m=3;
n=5;
str="";
for(i=0;i<n;i++)
{
for(j=0;j<m;j++)
{
str+=a[i][j]+ " ";
}
str+="<br/>";
}
document.write(str);
</script>
</html>
 
 (4)
using System;
class Example
{
static void print(int[][] alpha)
{
for (int i = 0; i < alpha.Length; i++)
{
for (int j = 0; j < alpha[i].Length; j++)
{
System.Console.Write("{0}{1}", alpha[i][j], j == (alpha[i].Length - 1) ? "" : " ");
}
System.Console.WriteLine();
}
}
static void Main()
{
int[][] a = int[5][];
a[0] = new int[3] { 1, 2, 3 };
a[1] = new int[3] { 4, 5, 6 };
a[2] = new int[3] { 7, 8, 9 };
a[3] = new int[3] { 10, 11, 12 };
a[4] = new int[3] { 13, 14, 15 };
print(a);
System.Console.WriteLine("Нажмите любую кнопку!");
System.Console.ReadKey();
}
}
 
 (5)
using System;
class Example
{
static void print(int[][] alpha)
{
for (int i = 0; i < alpha.Length; i++)
{
for (int j = 0; j < alpha[i].Length; j++)
{
System.Console.Write("{0}{1}", alpha[i][j], j == (alpha[i].Length - 1) ? "" : " ");
}
System.Console.WriteLine();
}
}
static void Main()
{
int[][] a = new int[5][];
a[0] = int[3] { 1, 2, 3 };
a[1] = int[3] { 4, 5, 6 };
a[2] = int[3] { 7, 8, 9 };
a[3] = int[3] { 10, 11, 12 };
a[4] = int[3] { 13, 14, 15 };
print(a);
System.Console.WriteLine("Нажмите любую кнопку!");
System.Console.ReadKey();
}
}
 
Номер 3
С точки зрения синтаксиса языка C# правильным будет выражение
Ответ:
 (1)
using System;
class Example
{
static class goods
{
public string ProductName;
public DateTime ExpireDate;
public double Price;
}
static void Main()
{
goods Product = new goods();
Product.ProductName = "Сыр голландский";
Product.ExpireDate = new DateTime(2011, 6, 12, 8, 30, 52);
Product.Price = 325;
string str;
str = "Товар: " + Product.ProductName + "\nСрок годности: " + Product.ExpireDate +
"\nЦена: " + Product.Price + " рубля";
Console.WriteLine(str);
Console.WriteLine("Нажмите любую кнопку!");
Console.ReadKey();
}
}
 
 (2)
using System;
class Example
{
class goods
{
string ProductName;
DateTime ExpireDate;
double Price;
}
static void Main()
{
goods Product = new goods();
Product.ProductName = "Сыр голландский";
Product.ExpireDate = new DateTime(2011, 6, 12, 8, 30, 52);
Product.Price = 325;
string str;
str = "Товар: " + Product.ProductName + "\nСрок годности: " + Product.ExpireDate +
"\nЦена: " + Product.Price + " рубля";
Console.WriteLine(str);
Console.WriteLine("Нажмите любую кнопку!");
Console.ReadKey();
}
}
 
 (3)
<html>
<script type="text/javascript">
var ProductName,Price,ExpireDate,str;
ProductName="Сыр голландский";
Price=325;
ExpireDate=new Date(2011, 6, 12, 8, 30, 52);
Product=new Object;
Product.ProductName=ProductName;
Product.Price=Price;
Product.ExpireDate=ExpireDate;
str="Товар: " + Product.ProductName + "<br/>" + "Срок годности: " + Product.ExpireDate +
"<br>" + "Цена: " + Product.Price + " рубля";
document.write(str);
</script>
</html>
 
 (4)
using System;
class Example
{
class goods
{
public string ProductName;
public DateTime ExpireDate;
public double Price;
}
static void Main()
{
goods Product = new goods();
Product.ProductName = "Сыр голландский";
Product.ExpireDate = new DateTime(2011, 6, 12, 8, 30, 52);
Product.Price = 325;
string str;
str = "Товар: " + Product.ProductName + "\nСрок годности: " + Product.ExpireDate +
"\nЦена: " + Product.Price + " рубля";
Console.WriteLine(str);
Console.WriteLine("Нажмите любую кнопку!");
Console.ReadKey();
}
}
 
 (5)
using System;
class Example
{
class goods
{
string ProductName;
DateTime ExpireDate;
double Price;
}
static void Main()
{
goods Product = goods();
Product.ProductName = "Сыр голландский";
Product.ExpireDate = new DateTime(2011, 6, 12, 8, 30, 52);
Product.Price = 325;
string str;
str = "Товар: " + Product.ProductName + "\nСрок годности: " + Product.ExpireDate +
"\nЦена: " + Product.Price + " рубля";
Console.WriteLine(str);
Console.WriteLine("Нажмите любую кнопку!");
Console.ReadKey();
}
}
 
Упражнение 6:
Номер 1
Массив - это
Ответ:
 (1) переменная, в которой хранятся данные одного типа 
 (2) именованная область памяти, в которой хранятся данные одного типа 
 (3) файл, в котором хранятся данные одного типа 
 (4) столбец, который однозначно идентифицирует все строки 
 (5) указатель, однозначно идентифицирующий все строки 
Номер 2
Массивы бывают
Ответ:
 (1) стохастическими 
 (2) статическими 
 (3) динамическими 
 (4) одномерными 
 (5) многомерными 
 (6) периодическими 
Номер 3
С точки зрения синтаксиса языка C# правильным будет выражение
Ответ:
 (1)
using System;
class Example
{
static void Main()
{
int n;
n = 3;
double[] a = new double[n];
a[0] = 5.3;
a[1] = 3.8;
a[2] = 4.7;
a[3] = -4.6;
string str;
int i;
double sum = 0;
for (i = 0; i < n; i++)
{
Console.WriteLine("a[" + i + "] = " + a[i]);
sum += a[i];
}
str = "Сумма массива равна " + sum;
Console.WriteLine(str);
Console.WriteLine("Нажмите любую кнопку!");
Console.ReadKey();
}
}
 
 (2)
using System;
class Example
{
static void Main()
{
int n;
n = 3;
double[] a = new double[n];
a[0] = 5.3;
a[1] = 3.8;
a[2] = 4.7;
string str;
int i;
double sum = 0;
for (i = 0; i < n; i++)
{
Console.WriteLine("a[" + i + "] = " + a[i]);
sum += a[i];
}
str = "Сумма массива равна " + sum;
Console.WriteLine(str);
Console.WriteLine("Нажмите любую кнопку!");
Console.ReadKey();
}
}
 
 (3)
using System;
class Example
{
static void Main()
{
int n;
n = 3;
int[] a = new double[n];
a[0] = 5.2;
a[1] = 3.8;
a[2] = 4.9;
string str;
int i;
double sum = 0;
for (i = 0; i > n; i++)
{
Console.WriteLine("a[" + i + "] = " + a[i]);
sum += a[i];
}
str = "Сумма массива равна " + sum;
Console.WriteLine(str);
Console.WriteLine("Нажмите любую кнопку!");
Console.ReadKey();
}
}
 
 (4)
using System;
class Example
{
static void Main()
{
int n;
n = 3;
int[] a = new int[n];
a[0] = 5.3;
a[1] = 3.8;
string str;
int i;
double sum = 0;
for (i = 0; i < n; i++)
{
Console.WriteLine("a[" + i + "] = " + a[i]);
sum += a[i];
}
str = "Сумма массива равна " + sum;
Console.WriteLine(str);
Console.WriteLine("Нажмите любую кнопку!");
Console.ReadKey();
}
}
 
Упражнение 7:
Номер 1
Объектно-ориентированный подход включает в себя
Ответ:
 (1) Наследственность 
 (2) Инкапсуляцию 
 (3) Полиморфизм 
 (4) Захоронение 
 (5) Идентификацию 
 (6) Разименование 
Номер 2
Наследование можно применять если
Ответ:
 (1) нельзя применять указатели 
 (2) изучаемый феномен имеет иерархическую структуру 
 (3) создается большой веб-сайт 
 (4) невозможно позднее связывание 
 (5) отсутствует идентификация 
Номер 3
Инкапсуляцию можно применять если
Ответ:
 (1) объект имеет иерархическую структуру 
 (2) планируется повторное использование кода 
 (3) класс создается, как "черный ящик" 
 (4) невозможно наследование 
 (5) возможно наследование 
 (6) невозможен полиморфизм 
Номер 4
Доступ к свойствам и методам класса осуществляется через
Ответ:
 (1) таблицу 
 (2) указатель 
 (3) экземпляр 
 (4) массив 
 (5) функцию 
 (6) коллекцию