UML diagram - Composition - uml

Could someone help me out with this UML diagram?
Given this UML diagram, suppose that at runtime, we have created objects a1 and a2 from class A, b1 and b2 from class B, c1 and c2 from class C, d1 and d2 from class D, e1 and e2 from class E. Which one of these situations could happen at runtime?
a. e1 contains d1, and d1 contains e2, and e2 contains b2
b. a1 contains c1, and c1 contains d1
c. b1 contains d1, and d1 contains e2
d. c1 contains a1, and a1 contains b1
I haven't been able to solve this, as I tend to think that both b) and d) are possible.

a) is the correct answer.
b) is false, as a1 can't contain anything
c) is false, because b1 can't contain anything
d) is false, a1 can't contain anything
Description: C and it's children (D,E) can contain any class of this hierarchy as it can contain children of A

Related

Spark Join Returning Null Values in Columns

I'm pulling my hair out trying to solve what I feel is an extremely simple problem, but I'm not sure if there's some spark voodoo occurring as well.
I have two tables, which are both very small. Table A has about 90K rows and Table B has about 2K rows.
Table A
A B C D
===========
a1 b1 c1 d1
a1 b1 c2 d2
a1 b1 c3 d3
a2 b2 c1 d1
a2 b2 c2 d2
.
.
.
Table B
A B E F
===========
a1 b1 e1 f1
a2 b2 e2 f2
I want a table that looks like
Result Table
A B C D E F
=================
a1 b1 c1 d1 e1 f1
a1 b1 c2 d2 e1 f1
a2 b2 c1 d1 e2 f2
.
.
.
I was a little loose, but the idea is I want to join the table with fewer rows on the table with more rows and it's okay to have multiple associated values in the final table.
This should be really simple:
table_a.join(table_b, table_a.a == table_b.a, table_a.b == table_b.b).select(..stuff..)
HOWEVER, for almost all of the resulting values in the Result Table (which should have about 90K rows since Table A has about 90K rows), I get null values in columns E and F.
When I save the result of just Table B, I see all the columns and values.
When I save the result of just Table A, I see all the columns and values.
(i.e I could do a paper and pencil join)
The weird thing is that even though ~89K rows have null values in columns E and F in the Result Table, there are a few values that do randomly join.
Does anyone know what's going on or how I can diagnose this?
Have you tried <=> instead of == in your join?

Conditional transpose of rows to columns

I have the following table with around 500 rows that I need to transpose into columns:
A B
A1 B1
A2 B2
A3 B3
The result I'm trying to get is
A B C D E F
A1 B1 A2 B2 A3 B3
Because the results are to be the interleaving of two columns I think not a duplicate of the OP indicated (at one time). Assuming A1 is in cell A2 (i.e. A and B are column labels) I suggest in C2 and copied across to suit:
=IF(ISODD(COLUMN()),OFFSET($A1,COLUMN()/2,0),OFFSET($A1,(COLUMN()/2)-1,1))

Excel2013 - return max(col C) of matched wildcard pattern in array(col B) to string in (col A)

I want to get the maximum score of each cell in column A from the matched pattern in column B
For example,
cell A2 matches with the wildcard pattern in column B including B3, B9 and B13
I want the max score among C3, C9 and C13
So, cell A2 get 39.17
Then moving on to cell A3, A4, A5 until the end (about a thousand row)
Place in D2 and copy down. Enter with CTRL+SHIFT+ENTER:
=MAX((ISNUMBER(SEARCH($B$2:$B$24,A2)))*(LEN($B$2:$B$24)=LEN(A2))*$C$2:$C$24)
Adjust the ranges as necessary.

Excel VBA to transpose multiple columns to single column multiple rows

I'm a beginner in VBA. Even after trying to find a solution and searching through all the forums, i was not able to find the correct way of dealing with this. Here's my problem:
Data ( in sheet1 )
a a1 a2 a3 a4
b b1 null b3 b4 b5
c c1 c2 c3
....
Required output ( in sheet2 )
a a1
a a2
a a3
a a4
b b1
b null
b b3
b b4
b b5
c c1
c c2
c c3
....
Thanks in advance.
Add column labels (may be deleted later) apply the process described here and filter ColumnC to delete rows blank in that column.

Get all combinations of the first column's value and other column's value

I have an irregular table in Excel:
A A1 A2 A3
B B1
C C1 C2 C3 C4
...
How can I get the following its representation?
A A1
A A2
A A3
B B1
C C1
C C2
C C3
C C4
...
This answer in SuperUser to Transform horizontal table layout to vertical table using VBA appears to give exactly what you are looking for.
The code is self explanatory by virtue of working step by step.
Hope it helps.

Resources