Trustwave On-Site Flashcards

1
Q

How does Java pass a large string?

A

by reference, a string is a just a pointer to a sequence of characters

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

What style of database would you use for your Barista example?

A

Personally, as I think of it. Using a NoSQL database makes the most sense. Because each nested combination could be stored as a JSON object. For example each Drink has a mix. In that mix could be a count of each object. This prevents from having to create a unique id for a mix in a different database tables in a regular SQL table.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

What else would you do to improve your solution?

A

I believe finding a way to reduce the repetitive code when accepting the input would be a start. I could check if its a number first. If not, show the error. If it is a number push it through the switch statement.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

Is Java pass by reference?

A

Java manipulates objects by reference. You get a reference to the pointer. However, Java passes method arguments by value.

https://www.javaworld.com/article/2077424/learn-java/learn-java-does-java-pass-by-reference-or-pass-by-value.html

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

Write/describe/analyze an algorithm which converts binary numbers to decimals

A

int decimal=0,p=0;

            while(n!=0)
            {
                decimal+=((n%10)*Math.pow(2,p));
                n=n/10;
                p++;
            }
        System.out.println(decimal);
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

Explain hashcode method in java

A

Answer

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

Difference between list and set, which one is ordered

A

Answer

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

What is Spring

A

Framework to be used in any web application with Java.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

Explain REST

A

The set of functions that can be performed via http. GET POST. Not limited to one language

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

What makes an api restful

A

Client server relationship, client handles the front end and server handles the backend. stateless in the fact that the server doesnt store data in between requests. clients can cache responses

How well did you know this?
1
Not at all
2
3
4
5
Perfectly