Jump to content

Test help

Sdot

Hey guys, I am back!

 

I just took a 10 question test. I received an 80. I just knew for sure I was going to get a 100 :(

 

Could someone take a look and tell me the two that they think I may have gotten wrong? The questions are on the right monitor.

 

This is the imgur album containing the 10 questions.

Thanks guys.

 

http://imgur.com/a/DRgyF#0

Link to comment
Share on other sites

Link to post
Share on other sites

I think question 6 needs to be

if (area==5);

The rest look fine to me, except #8 which I do not understand...

NEW PC build: Blank Heaven   minimalist white and black PC     Old S340 build log "White Heaven"        The "LIGHTCANON" flashlight build log        Project AntiRoll (prototype)        Custom speaker project

Spoiler

Ryzen 3950X | AMD Vega Frontier Edition | ASUS X570 Pro WS | Corsair Vengeance LPX 64GB | NZXT H500 | Seasonic Prime Fanless TX-700 | Custom loop | Coolermaster SK630 White | Logitech MX Master 2S | Samsung 980 Pro 1TB + 970 Pro 512GB | Samsung 58" 4k TV | Scarlett 2i4 | 2x AT2020

 

Link to comment
Share on other sites

Link to post
Share on other sites

#6 - it says to write an if clause. if(area == 5)

 

#9 - Any non-zero value is true, 0 is false 

main(i){for(;i<101;i++)printf("Fizz\n\0Fizzz\bBuzz\n\0%d\n"+(!(i%5)^!!(i%3)*3)*6,i);}

Link to comment
Share on other sites

Link to post
Share on other sites

#6 - it says to write an if clause. if(area == 5)

 

#9 - Any non-zero value is true, 0 is false 

It's fill in the blank so idk what to put there to get the correct answer. i don't think I can just put "Any" lol. I hate fill in the blank.

I think question 6 needs to be

if (area==5);

The rest look fine to me, except #8 which I do not understand...

imma be honest, I don't necessarily understand 8 either but after my research that looked like the correct answer to me.

Okay so if (area == 5); ??

Not sure if the spaces and stuff matter. I really wish this test didn't have fill in the blanks.

 

Well that's one down, now to find the other that I may have gotten wrong.

Link to comment
Share on other sites

Link to post
Share on other sites

Okay so if (area == 5); ??

Yeah you needed to put the if() part there, not just area==5

Also I made a mistake, there isnt supposed to be a ; after the if statement.

NEW PC build: Blank Heaven   minimalist white and black PC     Old S340 build log "White Heaven"        The "LIGHTCANON" flashlight build log        Project AntiRoll (prototype)        Custom speaker project

Spoiler

Ryzen 3950X | AMD Vega Frontier Edition | ASUS X570 Pro WS | Corsair Vengeance LPX 64GB | NZXT H500 | Seasonic Prime Fanless TX-700 | Custom loop | Coolermaster SK630 White | Logitech MX Master 2S | Samsung 980 Pro 1TB + 970 Pro 512GB | Samsung 58" 4k TV | Scarlett 2i4 | 2x AT2020

 

Link to comment
Share on other sites

Link to post
Share on other sites

#8 is correct. It's asking what is the valid syntax for a switch statement case when using a char type

// Test (realized after I wrote this that you are using C++ and not C#, the syntax is probably the same though minus the "Console.WriteLine()" instead of "cout <<")char c = '3';switch (c){    case '3':        Console.WriteLine("Passed");        break;    default:        Console.WriteLine("Failed");        break;}//case "3": gives you this error message: Cannot convert expression of type 'string' to type 'char'//case = 3 is invalid syntax for a switch statement//case '3'; is also invalid syntax with a semicolon( instead of a colon(

#9 looks correct as it's the most common int used to indicate true (although any integer > 0 should be valid)

 

#6 is incorrect as others mentioned.

area == 5; // is just a boolean condition that evaluates to true or false//since it was asking for an if clause you needif (area == 5)// or if it needs the opening bracket (which I doubt)if (area == 5) {// you don't follow an if with a semicolon(;)if (area == 5);

#5 is the other incorrect answer as you don't follow an if clause with a semicolon (see above).

Link to comment
Share on other sites

Link to post
Share on other sites

Alright, I'm all done, I appreciate the help guys. I got a 90 but I'll take it.

 

Here is a pic of the completed 2nd attempt (final attempt)

 

http://imgur.com/61WQHRP

 

Maybe she did want the opening curly brace, I am not sure.

Link to comment
Share on other sites

Link to post
Share on other sites

It could also be the space between 5 and ) or maybe they wanted both the brackets if (area == 5) {}

 

Who knows what it was looking for exactly. You can probably go to your teacher about it. These kind of things are why I dislike online tests lol

Link to comment
Share on other sites

Link to post
Share on other sites

It could also be the space between 5 and ) or maybe they wanted both the brackets if (area == 5) {}

 

Who knows what it was looking for exactly. You can probably go to your teacher about it. These kind of things are why I dislike online tests lol

same, fill in the blank is bullshit when there are so many options.

Link to comment
Share on other sites

Link to post
Share on other sites

Spoke to her today, she said that if (area ==5)  was correct that that should would change my grade to 100. Thanks again guys :)

Link to comment
Share on other sites

Link to post
Share on other sites

#8 is correct. It's asking what is the valid syntax for a switch statement case when using a char type

// Test (realized after I wrote this that you are using C++ and not C#, the syntax is probably the same though minus the "Console.WriteLine()" instead of "cout <<")char c = '3';switch (c){    case '3':        Console.WriteLine("Passed");        break;    default:        Console.WriteLine("Failed");        break;}//case "3": gives you this error message: Cannot convert expression of type 'string' to type 'char'//case = 3 is invalid syntax for a switch statement//case '3'; is also invalid syntax with a semicolon( instead of a colon(

#9 looks correct as it's the most common int used to indicate true (although any integer > 0 should be valid)

 

#6 is incorrect as others mentioned.

area == 5; // is just a boolean condition that evaluates to true or false//since it was asking for an if clause you needif (area == 5)// or if it needs the opening bracket (which I doubt)if (area == 5) {// you don't follow an if with a semicolon(;)if (area == 5);

#5 is the other incorrect answer as you don't follow an if clause with a semicolon (see above).

 

 

I actually didn't even see the semi-colon the first time I looked, but the way the question is worded either answer is correct.

 

If it evaluates to true it'll do nothing, but the question never said anything about doing anything.

 

This is perfectly valid

#include <iostream>intmain(void){    int quantity = 90;    if(quantity == 100);    else std::cout << "Not 100" << std::endl;    return 0;}

main(i){for(;i<101;i++)printf("Fizz\n\0Fizzz\bBuzz\n\0%d\n"+(!(i%5)^!!(i%3)*3)*6,i);}

Link to comment
Share on other sites

Link to post
Share on other sites

Even if it's valid, it's not normal programming practice so I assume that's why it's deemed incorrect. You use ! not an empty if statement if you need an else to fire. Multiple choice can be annoying like that when more than 1 answer is technically valid. It's something you might be able to argue, but it's probably not going to work.

Link to comment
Share on other sites

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×