What's new

.NET 2 question programming quiz. Simple but Majority will fail {PRIZE}

  • Thread starter NukeZilla
  • Start date
  • Views 703
N

NukeZilla

Enthusiast
Messages
144
Reaction score
40
Points
105
Sin$
0
Hi All,

I'm in the process of writing a tutorial series to help create the next upcoming project. But I just want to know how much detail I'll be needed and what I can avoid writing.

Question 1:
I want you to create an application called FizzBuzz. So If a number is divisible by 3 you need to print Fizz. If a number is divisible by 5 you need to print out Buzz. If divisible by 3 and 5 yo need to print FizzBuzz. If the number is divisible by 3 or 5 then print the number. But here's the catch. You need to do it all in one line from 1 to 100 inclusive.

Question 2:
Create a function in it's the simplest form to calculate the total value of cubing a number over x amount of time. By simplest form, I mean following the KISS rule. Example: 5 x 5 x 5 = 125 or 2 x 2 x 2 x 2 x 2 = 32.


I will provide you the answer on Monday! These are simple task any programmer should know, but the majority will struggle.

PRIZE:
First person who answer question 1 correctly will get 1 Month premium
First person who answer question 2 correctly will get 1 Month premium
Answer both correctly you will get 3 months premium.

RULE:
no copying the answer. i will not state if you have correctly answer the quiz until Monday night when I release the answers

Kind regards,
Jordan.

If you want answer quicker you can inbox me
 
Last edited:
Mr Smithy x

Mr Smithy x

Enthusiast
Programmer
Messages
320
Reaction score
186
Points
165
Sin$
0
Hi All,

I'm in the process of writing a tutorial series to help create the next upcoming project. But I just want to know how much detail I'll be needed and what I can avoid writing.

Question 1:
I want you to create an application called FizzBuzz. So If a number is divisible by 3 you need to print Fizz. If a number is divisible by 5 you need to print out Buzz. If divisible by 3 and 5 yo need to print FizzBuzz. If the number is divisible by 3 or 5 then print the number. But here's the catch. You need to do it all in one line from 1 to 100 inclusive.

Question 2:
Create a function in it's the simplest form to calculate the total value of cubing a number over x amount of time. By simplest form, I mean following the KISS rule. Example: 5 x 5 x 5 = 125 or 2 x 2 x 2 x 2 x 2 = 32.


I will provide you the answer on Monday! These are simple task any programmer should know, but the majority will struggle.

PRIZE:
First person who answer question 1 correctly will get 1 Month premium
First person who answer question 2 correctly will get 1 Month premium
Answer both correctly you will get 3 months premium.

RULE:
no copying the answer. i will not state if you have correctly answer the quiz until Monday night when I release the answers

Kind regards,
Jordan.

If you want answer quicker you can inbox me

Question 1:
:biggrin:
 
Last edited:
Pyroman

Pyroman

No
VIP
Retired
Messages
5,977
Reaction score
5,566
Points
2,420
Sin$
7
If only I knew how to code lol.
Of: Why isn't this is contest section?
 
Im4eversmart

Im4eversmart

The hacks are real
Glitcher Modder Programmer
Messages
2,156
Reaction score
1,903
Points
455
Sin$
7
Question 2:
int f(int n, int e){
if(e==0) return 1;
return n*f(n,e-1);
}
 
N

NukeZilla

Enthusiast
Messages
144
Reaction score
40
Points
105
Sin$
0
Keep it going people. It's still not over. Plus it be nice to see multiple approach's.
 
Pyroman

Pyroman

No
VIP
Retired
Messages
5,977
Reaction score
5,566
Points
2,420
Sin$
7
?
C:
#include <stdio.h>

main()
{
int a;
scanf("%d",a);
printf("%d",cube(a)+sqr(a));
}

cube(int x)
{
return(x*x*x);
}

sqr(int arg)
{
return(arg*arg);
}
 
N

NukeZilla

Enthusiast
Messages
144
Reaction score
40
Points
105
Sin$
0
Added Question because I'm feeling good with the replies.

Using question 2. it's int's simplest form -<< simplest being the key word. Cube the number then take 1 in a single method
 
Pyroman

Pyroman

No
VIP
Retired
Messages
5,977
Reaction score
5,566
Points
2,420
Sin$
7
Added Question because I'm feeling good with the replies.

Using question 2. it's int's simplest form -<< simplest being the key word. Cube the number then take 1 in a single method

?

Code:
Private Function CubeRoot(Num As Variant) As Varient

CubeRoot = Num ^ (1/3)

End Function
 
N

NukeZilla

Enthusiast
Messages
144
Reaction score
40
Points
105
Sin$
0
Ok So the second question is working making a function to calculate the cube of a given value. Question 3 in a single function work the cube value then minus 1
 
Xeren

Xeren

♦♦♦ God Complex ♦♦♦
Legendary Veteran Programmer Modder
Messages
5,668
Reaction score
2,107
Points
795
Sin$
0
Ok So the second question is working making a function to calculate the cube of a given value. Question 3 in a single function work the cube value then minus 1
I purposely never replied to this thread because I didn't and still don't understand what you mean. The first example of the second question is indeed the cube of five, which makes sense, but then you give a second example of two to the fifth power.
 
Im4eversmart

Im4eversmart

The hacks are real
Glitcher Modder Programmer
Messages
2,156
Reaction score
1,903
Points
455
Sin$
7
I purposely never replied to this thread because I didn't and still don't understand what you mean. The first example of the second question is indeed the cube of five, which makes sense, but then you give a second example of two to the fifth power.

He said this in a PM

Hi,

I wasn't going to reply to any but I was kinda impress by your attempt. See When doing this before people will create a loop. The only bug in the method is the return 1.

If you do 5 * 0 you will get 1 not 5. But very very good try even if it wasn't in the simplest of forms.

Kind regards,
Jordan

He didn't correct me, so I assume he wants a function that raises x to the y power.
 
Xeren

Xeren

♦♦♦ God Complex ♦♦♦
Legendary Veteran Programmer Modder
Messages
5,668
Reaction score
2,107
Points
795
Sin$
0
He said this in a PM



He didn't correct me, so I assume he wants a function that raises x to the y power.
That doesn't even come close to what he expects in the opening post, so if that's correct, then he should re-consider what he's saying. I'll just have my entry include both ways of going about it.

Question 1:
C:
void fizzbuzz()
{
    for (int i = 1, fizz = 1, buzz = 1; i < 101; i++, fizz = i % 3, buzz = i % 5) printf((fizz == 0 || buzz == 0) ? "%i: %s\r\n" : "", i, fizz == 0 && buzz == 0 ? "FizzBuzz" : fizz == 0 ? "Fizz" : buzz == 0 ? "Buzz" : "");
}

Question 2:
C:
//"cubing a number over x amount of time"
int unk_1(int var, int count)
{
    for (int i = 0; i < count; i++)
    {
        var = var * var * var; //unk_2(var, 3)
    }
    return var;
}

//Im4eversmart's method: raise to a variable to a certain power
int unk_2(int var, int power)
{
    int i = power > 0;
    for (int j = 0; j < power; j++)
    {
        i *= var;
    }
    return i;
}
 
S7 Pro

S7 Pro

Seasoned Member
Modder Programmer
Messages
2,511
Reaction score
1,599
Points
560
Sin$
7
Solution One:
Code:
def FizzBuzz():
    for i in xrange(1,101):
        print "%s" % ("FizzBuzz" if (i % 5 == 0 and i % 3 == 0) else "Fizz" if (i % 3 == 0) else "Buzz" if (i % 5 == 0) else str(i))

Solution Two:
Code:
def Power(number,numTimes):
    return number**numTimes

Alternatie to question two:
Code:
def CubeXTimes(num,numTimes):
    for x in xrange(numTimes):
        num = num**3
    return num
 
Last edited:
N

NukeZilla

Enthusiast
Messages
144
Reaction score
40
Points
105
Sin$
0
They was a reason why I left the question open to interpretation. It's a task you have to overcome when you working full time. I'll announce the winner tomorrow. Just walked in from a long day in the office.
 
Im4eversmart

Im4eversmart

The hacks are real
Glitcher Modder Programmer
Messages
2,156
Reaction score
1,903
Points
455
Sin$
7
They was a reason why I left the question open to interpretation. It's a task you have to overcome when you working full time. I'll announce the winner tomorrow. Just walked in from a long day in the office.

When you work full time, you have these things call meetings to make sure everyone is on the same page.
 
N

NukeZilla

Enthusiast
Messages
144
Reaction score
40
Points
105
Sin$
0
When you work full time, you have these things call meetings to make sure everyone is on the same page.
But you always don't have meetings with customers you tell you what they want but example isn't that they asked for.
 
Sumo

Sumo

ヽ༼ຈل͜ຈ༽ノ raise your dongers ヽ༼ຈل͜ຈ༽ノ
VIP
Retired
Nevar gon' happen in your lifetime Odysseus' Summit 5th Anniversary
Messages
5,496
Reaction score
3,452
Points
1,085
Sin$
0
But you always don't have meetings with customers you tell you what they want but example isn't that they asked for.

If they want it done a specific way, they will tell you to do it like that. Otherwise its up to the programmer.
 
Top Bottom
Login
Register