Menu

Show posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Show posts Menu

Messages - Mobo01

#1
I'm creating a database for a basic web game.

To isolate my issue, assume there are two tables that reference each other as seen below.
Player ( p_id, p_name, inventory(multiple i_id) )
Item ( i_id, i_name )

The issue is with the inventory column, which is used to store numerous ids from the Item database. First and foremost, I'm not sure if holding several id values in a single column is a smart design approach. Alternately, split into three tables as follows:
Player ( p_id, p_name )
Item ( i_id, i_name )
Inventory ( i_id )

Now that Inventory is no longer a column, it may have numerous ids, but how do I associate this collection of inventory data with a certain player? This https://www.scaler.com/topics/dbms/normalization-in-dbms/">website that if I want to have numerous 'daggers' in my inventory, I need to add a field to the inventory table. Is that right?

Each player, as in other RPG games, has their own inventory where they may keep their things and conduct the following actions.
#2
I'm just getting started with recursion, but I was able to utilize it to construct a basic factorial program without any difficulty. I'm now attempting to construct a recursive function that writes an array in reverse order, but I'm not sure what I'm doing wrong. I'm following the advice in this https://www.scaler.com/topics/reverse-an-array-in-java/">article. I'm not sure what I'm missing. Thank you very much.
import java.io.*;

public class Recursion {
  public static void main(String[] args) throws IOException{
    int myArray[] = {1,2,3,4,5,6,7,8,9,10};
  }

  public static void reverseDisplay(int[] ary, int position){
    if(position > 0)
      System.out.print(ary[position]);
     reverseDisplay(ary, position - 1);
  }
}
#3
In SQL Developer, I'm attempting to acquire a count result by using the SET operator.

I need to determine how many instances of "attribute1" exist in "table name1" but not in "table name2."

Essentially, I want the same result as the following query, but with a SET operator.
[code]SELECT count(distinct <attribute1>)
FROM <table_name1>
WHERE <attribute1> IS NOT (SELECT <attribute1>
                           FROM <table_name2>);
[/code]

I've looked through many Oracle https://docs.oracle.com/cd/B19306_01/server.102/b14200/operators005.htm">manuals and other internet https://www.scaler.com/topics/sql/set-operators-in-sql/">directories but haven't found satisfactory answers; could somebody kindly assist me?
#4
I recently gave a midterm test for an Operating System course, and one of the questions went as follows:



Which of the following statements is false?

Virtual memory translates a program's address space into physical memory address space.

Virtual memory enables each application to outgrow the primary memory.

Virtual memory expands the scope of multiprogramming.

Virtual memory minimizes the overhead of context switching.

I'm torn between alternatives 1 and 4. Context switching should be faster with VM (I'm not sure why, this is simply an intuition). Option 1: Virtual memory does not implement address translation; instead, the MMU does. Is there something I'm missing? So, what is the correct response?



Source: https://www.scaler.com/topics/multiprogramming-operating-system/">Scaler, https://en.wikipedia.org/wiki/THE_multiprogramming_system">Wiki