Math Test
Math Test
Math Test
MathtestatInteractiveBrokers.com
Due:
Balance:N/Ofornow
Quicklinks
FAQ
Register
Login
Boardindex .. IT
PostReply
100posts 1 2 3 4
baton
. (!) .
.
MATH Test
(Time Allowed: 1hr)
Instructions: Please answer the following questions using the information given. No assumptions are necessary.
1. A brick weighs a pound plus 1/2 a brick. How much does a brick weigh?
2. Could a stack of pennies as high as the C.N. Tower fit into a 2x2x2 foot box? (A penny has a radius of 3/8 inch, and
the C.N. Tower is 1900 feet high)
3. When I am as old as my father is now, I will be five times as old as my son is now. By then my son will be eight years
older than I am now. The combined ages of my father and me are 100 years. How old is my son?
1. I+(FI) = 5*s;
2.S+(FI) = I + 8; => 1. F= 5*S; 2. S= 308 3*F; => S=22;
3. I = 100 F;
https://forum.privet.com/viewtopic.php?t=157115
1/16
23/11/2016
MathtestatInteractiveBrokers.com
4. Citizens of Canada pay as much income tax (percentagewise) as they make dollars per week. What is the optimal
salary in Canada?
1. Fmax()=Sal (Sal/100)*Dpw
2. Dpw * 52.18 = Sal.
Where Sal salary, Dpw dollars per week, 52.18 weeks per year.
Fmax()= Sal**2/5218 +Sal
For max first derivative should be 0: Sal/2609 +1 =0 => Sal= 2609
Answer: best salary is $2609/year.
5. A contractor estimated that one of his two bricklayers would take 9 hours to build a certain wall and the other 10
hours. However, he knew from experience that when they worked together, 10 fewer bricks got laid per hour. Since
he was in a hurry, he put both men on the job and found it took exactly 5 hours to build the wall. How many bricks did
it contain?
1. 9*Bh1=10*Bh2
2. Bh1Bh2=10 => Bh1=100; B=5*190=950;
3. B = 5(Bh1 + Bh2)
Answer: the wall contains 950 bricks;
6. The numbers one through seven are mixed up and then drawn from a hat without replacement. What is the
probability that all of the odd numbers will be drawn first?
7. A spider needs to eat three flies a day. Until he fills his quota, he has an even chance of catching any fly that
attempts to pass his web. What are a fly's chances of survival, given that five flies have flown by today and no more
will?
Do not get the question; If a fly already did all the rounds why are you asking What are a flys chances?
Should it be What were a flys chances?
8. Smith's chance of hitting his target on a given shot is twice that of his fellow prison guard, Jones. One dark night
they each had time to fire one shot at an escaping prisoner. Given that the prisoner had an even chance of avoiding
injury, what kind of a marksman was Jones?
https://forum.privet.com/viewtopic.php?t=157115
2/16
23/11/2016
MathtestatInteractiveBrokers.com
Ps=2*Pj;
Phit = Ps+Pj = 1/2;
Pj = 1/2 2*Pj;
Pj = 1/6;
Answer: Probability that Jones will injures the prisoner is 1/6.
Programming
Advantages:
Less work for VM to maintain inheritance.
Simple approach off of two.
Doesnt have to be an object to use composition.
No attribute conflict.
Isolation composee object doesnt know about composer(
Much looser coupling)
2. Which of the following circumstances should throw Exceptions? Explain your reasoning.
A syntax error is found in a configuration file that an object uses to set its initial state.
Depends on type of configuration value. For values which can be defaulted warning message in log file should be enough.
Values failed validation should throw exception.
A method that searches for a programmerspecified word in a string array cannot find any occurrence of the word.
Depends on what is returned from the method. If count of matched rows in string array no exception, just return
0(zero). If returning subset of matching rows generate an exception if no matches found.
https://forum.privet.com/viewtopic.php?t=157115
3/16
23/11/2016
MathtestatInteractiveBrokers.com
3. What are some situations where you would make constructors private?
Java
CODE: SELECT ALL
1.UpgradethePersonclassbelowtoimplementtheComparableinterfacesothatitsortsfirstby
lastnamethenbyfirstname.
classPersonimplementsComparable{
Stringm_firstName
Stringm_lastName
publicStringget_FirstName(){returnm_firstName}
publicStringget_LastName(){returnm_lastName}
publicintcompareTo(ObjectPersonToCompareTo)ThrowsException{
intlnWeight=10
intfnWeight=1
if((Person)PersonToCompareTo.get_LastNAme().ToString().equalsIgnoreCase()(
this.get_LastName())){
if((Person)PersonToCompareTo.get_FirstNAme().ToString().equalsIgnoreCase()(
2. Change the function divide() to throw an exception if the den is zero and change the function fun() to catch the
exception.
PublicclassZero_Exceptionextendsexception(){
PublicStrintoString(){
returnZeroexception!
}
}
classSomeClass{
voiddivide(intnum,intden){
doublend_dev
Exceptione
nd_dev=num/den
if(nd_dev==0){
thrownewZero_Exception()
https://forum.privet.com/viewtopic.php?t=157115
4/16
23/11/2016
MathtestatInteractiveBrokers.com
classNode{
publicintvalue
publicNodenext
}
classLinkedList{
privateNodefirst
publicvoidaddToBeginningOfList(Nodenode){
node.next=this.first
this.first=node
}
}
Database
https://forum.privet.com/viewtopic.php?t=157115
5/16
23/11/2016
MathtestatInteractiveBrokers.com
TableMenu_Item(
Menu_Itam_Id(PRIMARYKEY)notnull,
Menu_Item_Name,
Menu_Item_Description,
Menu_Item_Price,
)
TableCategory(
Category_Id(PRIMARYKEY)notnull,
Category_Name
)
TableMenu(
Order_Of_Categorynotnull,
Write a SQL statement to fetch a list of the names of appetizers for Monday ordered by their prescribed order.
SELECTmi.Menu_Item_Name
FROMMenu_Itemmi,Categoryc,Menum
WHEREm.Category_id=c.Category_id
ANDm.Menu_Item_Id=mi.Menu_Item_Id
ANDc.Category_Name=appetizers
ANDBIT_AND(m.Available_On,1/*1forMonday*/)!=0
ORDERBYm.Order_Of_Itemdesc
SELECTWEEKDAY(day_num)week_day_name
FROMCategoryc,Menum,
(SELECTrownumday_num
FROMdual
CONNECTBYLEVEL<=7)week_days,
WHEREm.Category_id=c.Category_id
ANDc.Category_Name=soup
ANDBIT_AND(m.Available_On,day_num)=0
https://forum.privet.com/viewtopic.php?t=157115
6/16
23/11/2016
MathtestatInteractiveBrokers.com
SELECTCOUNT(*)Qty_AvailableFROM(
SELECTmcml.MCMeal_Name
FROMMulti_Cource_Mealmcml,Multi_Cource_Menumcmn,Menum
WHEREm.Menu_Item_Id=mcmn.Menu_Item_Id
ANDmcmn.MCMeal_Id=mcml.MCMeal_Id
GROUPBYmcml.MCMeal_Name
HAVINGsum(DECODE(BIT_AND(m.Available_On,4/*4forThursday*/),0,1,0))=mcml.
Qty_Of_Menu_Items
)
C++
1. What is the difference between malloc and new? Why is one preferable to the other?
Answer:
New is a (C++) operator, but malloc is a function from C library.
New will throw an exception (by default) if theres no memory, but maloc will return NULL.
Malloc will not call a ctor.
With malloc you have to explicitly specify the object size.
Typecast required if calling malloc
Use malloc if you need better control of raw heap memory allocation.
Use malloc if you want to dynamically resize the allocated memory (with realloc)
Use new if you need to call a ctor/dtor, or to use overloading.
Use malloc if you need fine grained control over memory allocation.
2. memset is sometimes used to initialize data in a constructor like the example below. What is the benefit of
initializing this way? Does it work in this example? Does it work in general ? Is it a good idea in general?
classA{
public:
A()
private:
inta
floatf
charstr[35]
long*lp
}
A::A()
{
memset(this,0,sizeof(*this))
}
Answer:
It will not work in general (not for virtual class).
It may work if all the variable formats are specified in class definition.
Will not work on nonPOD classes (the ones only C++ can handle)
https://forum.privet.com/viewtopic.php?t=157115
7/16
23/11/2016
MathtestatInteractiveBrokers.com
Math
1) When customers trade we charge them commission. An order may get broken up into multiple trades. The commission
is based on the number of shares executed for their order. (A negative quantity indicates a sell.) Calculate the
commission for the trades below:
Commission Schedule
<= 500 shares .013/share
> 500 shares .008/share
Order Number Symbol Quantity Commission
1 IBM 450 5.85
1 IBM 150 1.95
3 INTC 500 6.5
4 KO 1,000 8
4 KO 950 7.6
2) Assume a customer can borrow up to 50% of his stock portfolio value to buy additional stock. For example if a customer
has $10,000 worth of IBM and 0 cash they can buy an additional $5,000 of stock. How much more stock can the customer
below buy before he runs out of margin room?
Current IBM Price: 104.00
Current ORCL Price: 20.30
Current Cash Balance: 100,000
Current IBM Position: 5,000 shares
Current ORCL Position: 10,000 shares
Answer:
$100.000 is equivalent of ~962 IBM shares or ~4927 ORCL shares.
Considering this, customer can buy 1538 IBM shares and 5,000 ORCL shares, or 2,500 IBM shares and 73 ORCL shares.
Lasteditedbybatonon22Mar201012:20,edited1timeintotal.
o
baton
https://forum.privet.com/viewtopic.php?t=157115
8/16
23/11/2016
MathtestatInteractiveBrokers.com
:
Sr. Java or C++ Database Development for Securities Industry (Stamford, CT area)
An international electronic brokerage company is seeking a strong Java or C++ programmer with database development
experience for the backend development of client registration and account management systems. This is an excellent
opportunity to work in a dynamic environment with advanced programmers.
Our client offers excellent compensation potential and a longterm career opportunity.
Requirements:
Expert level Core Java or expert level C++ programming skills
Expert level Database development skills
Experience with PL/SQL preferred but not required
2 to 15 years of real world software development completing nontrivial projects
Demonstrated ability to complete software projects quickly and efficiently.
Ability to handle a succession of numerous development projects while handling maintenance issues as they arise.
Ability to work as a peer with very smart and productive programmers.
MS, PhD, or BS in computer science, EE, math, physics, or similar field..
o Location: Stamford, CT area
o Compensation: $90,000 to $150,000 + annual bonus + stock grants + excellent benefits
o
Irish2
.. .
,
, .
100 100
H
o
baton
https://forum.privet.com/viewtopic.php?t=157115
9/16
23/11/2016
MathtestatInteractiveBrokers.com
Irish2 wrote:
.. .
( ),
o
baton
.
Moe reshenije:
It's multiplication of number of continuous number sequences between 1 and n to number of the same between 1 to m.
1: 1
2: 2 + (21)
3: 3+ (31) + (32)
...
n: n+(n1)+...+1
Same for m.
Answer: n**2*m**2/4
Lasteditedbybatonon22Mar201016:52,edited2timesintotal.
o
https://forum.privet.com/viewtopic.php?t=157115
10/16
23/11/2016
MathtestatInteractiveBrokers.com
58080
baton
58080 wrote:
, .
o
Gross
2 ,
....
o
dimp
58080 wrote:
2 . .
o
dimp
https://forum.privet.com/viewtopic.php?t=157115
11/16
23/11/2016
MathtestatInteractiveBrokers.com
o
Gross
3 ...
:
F=5S
5S=I+8
F+I = 100
=> S=10.8
....
o
Gross
5
, Bh2=100 Bh1
....
o
Areg
dimp wrote:
A brick weighs a pound plus 1/2 a brick. How much does a brick weigh?
B=1p+1/2*B => B=2p
Answer: 2 pounds;
??? ?
o
Gross
https://forum.privet.com/viewtopic.php?t=157115
12/16
23/11/2016
MathtestatInteractiveBrokers.com
....
o
Areg
Gross wrote:
... 900 , ,
o
baton
, .
Irish2
, .. . ..
.
..
, .
. ..
DSS/DMS, AI/MachineLearning/NeuralNets, KR&R/RulesEngine
o
Uzito
baton Gross . .
baton: 22 , 110. , + = 100.
10 ?
Gross. 10.8 , 54. 10054 = 46 . .
:
1 11 ,
https://forum.privet.com/viewtopic.php?t=157115
13/16
23/11/2016
MathtestatInteractiveBrokers.com
.
2 = 24 . 6/8 , 32 . 2
* 2 32*32 = 1024 , . 1024 * 2 = 2048
, . , 1900
2x2x2 .
o
daemon_
4 ^, ( ) N
, , C++
,.
o
U96
" ",
,
...
, ...
"CorrectmoralsarisefromknowingwhatManisnotwhatdogoodersandwellmeaningoldAuntNellieswouldlikehimto
be."
o
ddv
Uzito wrote:
baton Gross . .
https://forum.privet.com/viewtopic.php?t=157115
14/16
23/11/2016
MathtestatInteractiveBrokers.com
. ,
308 208 . ,
. :
1. F = 5*s;
2.S+(FI) = I + 8; => S= 208 3*F; => S=13;
3. I = 100 F;
Answer: Son is 13 years old;
S= 13
F= 65
I= 35
alex904
baton wrote:
Irish2 wrote:
.. .
( ),
?
o
Irish2
Uzito
ddv wrote:
100 .
https://forum.privet.com/viewtopic.php?t=157115
15/16
23/11/2016
MathtestatInteractiveBrokers.com
12,32,60, .
, ,
o
quackert
5 , , Bh1Bh2=10 ( ,
). , , . , Bh2
Bh1, Bh = Bh1 + Bh2 10 ( ).
900, Areg.
8 Phit , . Pnohit=(1Ps)*(1Pj) = 1/2
7 , . .. , .
, . , /
. , .
o
Displaypostsfromprevious: Allposts
Sortby Posttime
Ascending
Go
PostReply
100posts 1 2 3 4
ReturntoIT
Jumpto
WHOISONLINE
Usersbrowsingthisforum:Noregisteredusersand3guests
Boardindex
Theteam
Deleteallboardcookies AlltimesareUTC08:00
PoweredbyphpBBForumSoftwarephpBBLimited
https://forum.privet.com/viewtopic.php?t=157115
16/16