---
# System prepended metadata

title: EP-SFT-2022-79-LD Written Test (Brieuc FRANÇOIS)

---

EP-SFT-2022-79-LD Written Test (Brieuc FRANÇOIS)
==========================================

* The test should be completed within __20 minutes__
* There are __13 questions__ grouped in 6 categories: C++, Python, Git, ROOT, Gaudi, DD4hep.
* The test consists in __selecting (ticking)__ the valid answer among the proposed ones
* We __prefer no answer__ rather than a meaningless answer 
* You should __not have access to any external source__ of information
  * You may use your terminal, the man pages, your editor


* __Good luck!__

Question 1: C++
---------------

a) What is the difference between a `while` loop and a `do-while` loop?

- [ ] None, they execute the loop body the same number of times 
- [x] The `while` loop might not need to execute the body loop 

b) Can you compile a file with C++ code which does not include the `main` function?
- [x] Yes, but I cannot execute it
- [ ] Yes and I can execute
- [ ] No, the `main` function is mandatory

c) What is the output of the program

```c=
#include <iostream>

using namespace std;

int main()
{
    enum { blue, green = 5, LAST};
    
    cout << blue << " " << LAST << "\n";
}
```


- [ ] 0 2
- [x] 0 6
- [ ] 1 10


Question 2: Python
------------------

a) What is the output of the following Python code

```python=
def fun1(l):
    l=[3,2,3,4]

def fun2(l):
    l[0]=5

l=[1,2,3,4]

fun1(l)
print(l)

fun2(l)
print(l)
```

- [x] [1, 2, 3, 4] 
      [5, 2, 3, 4]
- [ ] [3, 2, 3, 4] 
      [3, 2, 3, 4]
- [ ] [3, 2, 3, 4] 
      [5, 2, 3, 4]


b) Which of the following statements is true (possibly multiple):
- [ ] A piece of code written in Python is likely to be faster than the equivalent C++ implementation
- [x] A piece of code written in Python is likely to be less complex than the equivalent C++ implementation
- [ ] Errors in a Python piece of code will be found at compilation time


Question 3: GIT
---------------

Consider the command
```
git rebase -i <commit-hash-of-last-pushed-commit>
```

Identify the valid statements among the following describing actions enabled by the command (possibly multiple)
- [x] Meld one or more unpushed commits
- [x] Edit commit messages for unpushed commits
- [x] Move all the unpushed commits on the top of the upstream branch


Question 4: ROOT
----------------

Consider a `ROOT` file `event.root` available in the working directory:

a) Which of the following actions is valid to check which objects it contains?
- [x] `$ root event.root`
      `root[] _file0->ls()`
- [ ] `$ root`
      `root[] new TBrowser("event.root")`


b) Suppose now the file is not available locally but remotely at `root://myserver.data.org//data/`. Would you still be able to check the content?
- [ ] Yes, but __only__ after having copied locally the file
- [x] Yes by using the URL `root://myserver.data.org//data/event.root`
- [ ] No


c) You are given a ROOT file created with the latest version of ROOT, which you still not have installed. Can you still open the file?
- [x] No, I need to install the latest version of ROOT first
- [ ] Yes, because ROOT provides backward and forward compatibility


Question 5: Gaudi
-----------------

a) Which of the following statements are true (possibly multiple)

- [x] A Gaudi `Tool` can be called many times per event
- [ ] Gaudi `Algorithm` and a Gaudi `Tool` are exactly the same
- [x] Both Gaudi `Algorithm` and a Gaudi `Tool` are configurable

b) You are given a Gaudi configuration file `gaudijob.py`. Assuming that your system provides a Gaudi steering application `gaudirun`, how can you check what it runs and __all__ the configurable options?

- [ ] I open`gaudijob.py` with my preferred editor
- [ ] I run `gaudirun -h`
- [x] I run `gaudirun gaudijob.py -h`

Question 6: DD4hep
------------------

a) Which is the format of the DD4hep detector description files?

- [ ] ROOT
- [ ] GDML
- [x] Plain XML

b) You are provided a `MyDet/compact` directory with a set of `DD4hep` files, one of which called `MyDet_master`. Under the assumption that `DD4hep` and all the relevant code are installed properly on your system, what is the most direct way to inspect graphically the volumes described by the provided files?

- [ ] Open `MyDet/compact/MyDet_master` with the preferred editor
- [ ] Open `MyDet/compact/MyDet_master` with the preferred web browser
- [x] Run `geoDisplay MyDet/compact/MyDet_master`
