2
Name: Ahmed Gaber Yehia ID# 800130801 1 A) ^(0|1)*111$ B) ^([AZ] | [az] | [09])+$ C) ^([09]{3}) \s [09]{3} \– [09]{4}$ D) ^(19|20)[09]{2} \– (0[19] | [12][09] | 3[01])$ E) ^([AZ][az])* \s ([09][19]$ 2A) ([az] | [AZ] | [09] )+ \.(com|org|net|mil|edu|COM|ORG|NET|MIL|EDU) A URL that starts with a combination of alpha numeric letters both upper and lower cases followed by a dot, and ends with the domain name in both upper and lower case format. Example: ahmedGABER1.com 0+ 1+ (11)* 0? One or more of 0, one or more of 1, zero or more of the consecutive two digits of 1, and zero or one of 0. Example: 01110 [0-9]+ ((E|e) (\+|\-)? [0-9]+)? One or more of digits between 0 and 9, zero or one of the expression (one of the letter E upper and lower, zero or one of the literal sign plus or minus, one or more of digits between 0 and 9). Example: 0123E146 (int | float | byte | double | long) ‘ ‘ ([a-z] ([a-z] | [0-9])*) (\= ([1-9][0-9])+)? \; Variable declaration. Example: int x=10;

Concepts of Programming

Embed Size (px)

DESCRIPTION

Excercise sheet

Citation preview

  • Name: Ahmed Gaber Yehia ID# 800-130-801 1- A) ^(0|1)*111$ B) ^([A-Z] | [a-z] | [0-9])+$ C) ^([0-9]{3}) \s [0-9]{3} \ [0-9]{4}$ D) ^(19|20)[0-9]{2} \ (0[1-9] | [12][0-9] | 3[01])$ E) ^([A-Z][a-z])* \s ([0-9][1-9]$ 2 A) - ([a-z] | [A-Z] | [0-9] )+

    \.(com|org|net|mil|edu|COM|ORG|NET|MIL|EDU) A URL that starts with a combination of alpha numeric letters both upper and lower cases followed by a dot, and ends with the domain name in both upper and lower case format. Example: ahmedGABER1.com - 0+ 1+ (11)* 0? One or more of 0, one or more of 1, zero or more of the consecutive two digits of 1, and zero or one of 0. Example: 01110 - [0-9]+ ((E|e) (\+|\-)? [0-9]+)? One or more of digits between 0 and 9, zero or one of the expression (one of the letter E upper and lower, zero or one of the literal sign plus or minus, one or more of digits between 0 and 9). Example: 0123E-146 - (int | float | byte | double | long) ([a-z] ([a-z] | [0-9])*) (\=

    ([1-9][0-9])+)? \; Variable declaration. Example: int x=10;

  • 4- Find out why a C++ class must end with a semi-colon, while a function does not.

    A class must end with semi colon as instances of the class may be declared: e.g. Class Ahmed { Int x = 0; } test; This declares both class Ahmed and an object test. The colon has to be there so the compiler would know whether instances of the class have been declared or not. Conversely, you do not need to put a semi colon after a method implementation as instances are not declared post function declaration, therefore a semi colon would be redundant.