Domanda di colloquio di Palo Alto Networks

what is git rebase what is git merge

Risposta di colloquio

Anonimo

9 lug 2022

class MyClass { int sum = 0; void foo() { for (int i=0; i < 100; i++) { sum+=1; } } } If we create an instance of MyClass and run foo() on two threads in parallel, what will be the value in sum after both threads have finished running? abstract class Base { public Base() { System.out.println("in Base ctor"); foo(); } public abstract void foo(); }; class Derived extends Base { public Derived() { System.out.println("in Derived ctor"); } public void foo() { System.out.println("in foo"); } }; public class Main { public static void main(String args[]) { new Derived(); } } How will look the printing? Implement the function print_perm(x) that will print to the screen a random permutation of the numbers 1..x, where all the numbers from 1 to x are printed to the screen, each number is printed only once, and the order is random. Your function should have minimal complexity in both time and space. You can use the function rand(x) which returns a random number between 0 and x-1 in o(1) complexity. Choose the language of your choice, or in pseudo-code.

1