NPRG38 zkouska 3.6.2010
Napsal: 3. 6. 2010 16:17
Zdravim, tak zkouska uz je za nama a otazky byly vazne zajimave
1)
Co bude na vystupu?
2)
Do prazdneho mista zadejte kod, tak aby oba TextBlocky mely cervene pozadi.
3) (Tady se omlouvam, ale ten kod neni uplne presny)
Jakou barvu bude mit ctverec po spusteni programu?
Jakou barvu bude mit ctverec po najeti mysi do ctverce?
Jakou barvu bude mit ctverec pote co mys opusti ctverec?
4)
Do prazdnych mist vyplnte kod, tak aby trida byla serializovatelna pomoci nejakeho formateru a aby pri deserializaci nevznikaly chyby.
5) CLI/C++
tu si prilis nepamatuju, tak nekdo doplnte!
1)
Kód: Vybrat vše
class Program
{
static void Main(string[] args)
{
var n = new MyEnumerable();
var list = from x in n where x > 1 select x;
foreach (var i in list)
{
Console.Write("g({0}) ", i);
}
}
}
public class MyEnumerable : IEnumerable<int>
{
public IEnumerator<int> GetEnumerator()
{
Console.Write("1 ");
yield return 1;
Console.Write("2 ");
yield return 2;
Console.Write("3 ");
yield return 3;
}
IEnumerator IEnumerable.GetEnumerator()
{
return GetEnumerator();
}
}
2)
Kód: Vybrat vše
<Window x:Class="WPFZkouska.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="MainWindow" Height="350" Width="525">
<StackPanel>
<TextBlock Margin="10" Text="neco1" />
<TextBlock Margin="10" Text="neco2" />
</StackPanel>
</Window>
3) (Tady se omlouvam, ale ten kod neni uplne presny)
Kód: Vybrat vše
<Window x:Class="WPFZkouska.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="MainWindow" Height="350" Width="525">
<StackPanel>
<Rectangle x:Name="ctverec" Fill="Red" Width="50" Height="50">
<Rectangle.Style>
<Style>
<Style.Triggers>
<Trigger Property="Rectangle.IsMouseOver" Value="true">
<Setter Property="Rectangle.Fill" Value="Green" />
</Trigger>
</Style.Triggers>
</Style>
</Rectangle.Style>
</Rectangle>
</StackPanel>
</Window>
Jakou barvu bude mit ctverec po najeti mysi do ctverce?
Jakou barvu bude mit ctverec pote co mys opusti ctverec?
4)
Kód: Vybrat vše
public class MyClass
{
int a;
int b;
public int A
{
get { return a; }
set
{
if (value > 0)
throw new ArgumentException();
a = value;
}
}
public int B
{
get { return b; }
set { b = value; }
}
}
5) CLI/C++
tu si prilis nepamatuju, tak nekdo doplnte!