You are on page 1of 11

Aptitude Test

1. A train running at the speed of 60 km/hr crosses a pole in 9 seconds. What is the length of the
train?

A. 120 metres B. 180 metres

C. 324 metres D. 150 metres

2. A train 125 m long passes a man, running at 5 km/hr in the same direction in which the train
is going, in 10 seconds. The speed of the train is:

A. 45 km/hr B. 50 km/hr

C. 54 km/hr D. 55 km/hr

3. The length of the bridge, which a train 130 metres long and travelling at 45 km/hr can cross in
30 seconds, is:

A. 200 m B. 225 m

C. 245 m D. 250 m

4. Two trains running in opposite directions cross a man standing on the platform in 27 seconds
and 17 seconds respectively and they cross each other in 23 seconds. The ratio of their speeds
is:

A. 1:3 B. 3:2

C. 3:4 D. None of these

5. A train passes a station platform in 36 seconds and a man standing on the platform in 20
seconds. If the speed of the train is 54 km/hr, what is the length of the platform?

A. 120 m B. 240 m

C. 300 m D. None of these


6. A train 240 m long passes a pole in 24 seconds. How long will it take to pass a platform 650 m
long?

A. 65 sec B. 89 sec

C. 100 sec D. 150 sec

7. Two trains of equal length are running on parallel lines in the same direction at 46 km/ hr and
36 km/hr. The faster train passes the slower train in 36 seconds. The length of each train is:

A. 50 m B. 72 m

C. 80 m D. 82 m

8. A train 360 m long is running at a speed of 45 km/hr. In what time will it pass a bridge 140 m
long?

A. 40 sec B. 42 sec

C. 45 sec D. 48 sec

9. Two trains are moving in opposite directions @ 60 km/hr and 90 km/hr. Their lengths are 1.10
km and 0.9 km respectively. The time taken by the slower train to cross the faster train in
seconds is:

A. 36 B. 45

C. 48 D. 49

10. A jogger running at 9 kmph alongside a railway track in 240 metres ahead of the engine of a
120 metres long train running at 45 kmph in the same direction. In how much time will the
train pass the jogger?

A. 3.6 sec B. 18 sec

C. 36 sec D. 72 sec
SQL Test

1. You can add a row using SQL in a database with which of the following?

A. ADD B. CREATE

C. INSERT D. MAKE

2. The command to remove rows from a table 'CUSTOMER' is:

A. REMOVE FROM CUSTOMER ...

B. DROP FROM CUSTOMER ...

C. DELETE FROM CUSTOMER WHERE ...

D. UPDATE FROM CUSTOMER ...

3. The SQL WHERE clause:

A. limits the column data that are returned.

B. limits the row data are returned.

C. Both A and B are correct.

D. Neither A nor B are correct.

4. Which of the following is the original purpose of SQL?

A. To specify the syntax and semantics of SQL data definition language

B. To specify the syntax and semantics of SQL manipulation language

C. To define the data structures

D. All of the above.


5. The wildcard in a WHERE clause is useful when?

A. An exact match is necessary in a SELECT statement.

B. An exact match is not possible in a SELECT statement.

C. An exact match is necessary in a CREATE statement.

D. An exact match is not possible in a CREATE statement.

6. A view is which of the following?

A. A virtual table that can be accessed via SQL commands

B. A virtual table that cannot be accessed via SQL commands

C. A base table that can be accessed via SQL commands

D. A base table that cannot be accessed via SQL commands

7. The command to eliminate a table from a database is:

A. REMOVE TABLE CUSTOMER;

B. DROP TABLE CUSTOMER;

C. DELETE TABLE CUSTOMER;

D. UPDATE TABLE CUSTOMER;

8. ON UPDATE CASCADE ensures which of the following?

A. Normalization

B. Data Integrity

C. Materialized Views

D. All of the above.


9. SQL data definition commands make up a(n) .

A. DDL B. DML

C. HTML D. XML

10. Which of the following is valid SQL for an Index?

A. CREATE INDEX ID;

B. CHANGE INDEX ID;

C. ADD INDEX ID;

D. REMOVE INDEX ID;


Linux Test
1. Suppose that you have an application whose behavior depends on the environment
variable BAR. Which of the following command lines may be used in a bash shell to
configure the application?
 A. export $BAR=baz; echo $BAR
 B. set BAR=baz
 C. BAR=baz ; export BAR
 D. echo $BAR=baz
 E. declare -x BAR=baz
 F. echo BAR=baz

2. Which of the following commands can be used to assure that a file 'myfile' exists?
 A. cp myfile /dev/null
 B. touch myfile
 C. create myfile
 D. mkfile myfile

3. Which of the following command lines can be used to convert a file containing DOS-style
CR-LF line endings into Unix-style LF line endings? Assume for this question that the
DOS-style file is called 'dosfile', and we want the modified contents in 'unixfile'
 A. sed 's/\r//' dosfile > unixfile
 B. tr -d '\r' < dosfile > unixfile
 C. dos2unix dosfile unixfile
 D. strip '\r' < dosfile > unixfile

4. Suppose for this question that you have a file called 'wordlist' that contains a number of
words, one per line. You would like to produce an ad-hoc report that contains a numbered
list of the first five words, according to alphabetical order. Which of the following
command lines can be used to produce this report to the console?
 A. sort wordlist | nl | head -5
 B. split -1 wordlist ; cat xa? | head -5
 C. nl wordlist | sort | sed '/^ [^12345]/d'
 D. nl wordlist | sort | head -5

5. The command 'ps -A' displays an ordered list of all running processes, with the right-
justifed process ID in the first space-separated field. Suppose you would like to display to
screen a list of the five most recently launched processes (those with the highest process
IDs). Which of the following commands will display the desired items?
 A. ps -A | tail -5 | cut -f 1 -d " "
 B. ps -A | tail -5 | sed 's/[ ]*[0-9]*//'
 C. ps -A | head -5 | nl
 D. ps -A | tac | head -5 | cut -b 0-5
6. Suppose that a file 'names' contains a list of names in the form, "firstname lastname", one
per line. These names are unsorted, and you would like them sorted by lastname;
however, the format of names on each line should remain the same. Which ONE of the
following commands will NOT output an appropriately sorted list of names to the
console?
 A. cut -f 2 -d " " names | paste names - | sort -k 3 | cut -f 1
 B. sort -k 2 names
 C. sed 's/\(\w*\) \(\w*\)/\2\1\2/' names | sort | cut -f2-3 -d" "
 D. cut -f 2 -d " " names | sort
 E. cut -f 2 -d " " names | paste - names | sort | cut -f 2

7. Assume that your current working directory is '/tmp' and your home directory is
'/home/jane'. Which of the below commands will copy all the content of '/tmp/test/' to a
'test' subdirectory of your home directory?
 A. cp -r test/* /home/jane
 B. cp -r ./test ~
 C. cp -r ~/test .
 D. cp -r /tmp/test /home/jane/test

8. Suppose that you have several files matching the filename pattern 'file[0-9]'. You would
like to visually compare the contents of all such files, in a side-by-side fashion. Which of
the following commands would let you view the desired adhoc report?
 A. ls file[0-9] | xargs paste | less
 B. paste `ls file[0-9]` > report ; vi report ; rm report
 C. cat file[0-9] | paste - | more | less
 D. ls file[0-9] | tee fnames | paste `cat fnames`
 E. ls file[0-9] | tee fnames | xargs paste | more
 F. ls *word* > fnames ; paste < xargs `cat fnames` | vi

9. Which of the following Linux utilities does NOT include the capability to list the
process IDs of running applications?
 A. jobs
 B. ps
 C. nice
 D. top
# jobs -l
[1] 5110 Running kedit &
[2]- 5382 Stopped (signal) pine
[3]+ 5457 Stopped (tty output) vi

10. Given the 'jobs' display in the exhibit, which command could you use to switch
display focus to the application 'vi'?
 A. bg %3
 B. fg %3
 C. top -p 5457
 D. switch %5457
# jobs -l
[1] 5110 Running kedit &
[2]- 5382 Stopped (signal) pine
[3]+ 5457 Stopped (tty output) vi
11. Given the 'jobs' display in the exhibit, which command could you use to terminate
the application 'vi'?
 A. bg %3
 B. kill -9 5457
 C. term -i %3
 D. fg 5457

12. Suppose you have a running program called 'myprog', that is a child of the current shell.
You would like to decrease the CPU usage of this program. Which of the following
command lines can you use to make 'myprog' yield more CPU resources?
 A. nice +1 myprog
 B. ps h -o pid -C myprog | xargs nice +1 -
 C. renice +1 -u `whoami` myprog
 D. renice +1 -p `ps -a | grep myprog | cut -b 1-6`
int double(int n)
{ /* int arg, int return */
return n*2;
}
char hello(int n)
{ /* int arg, char return */
printf("hello %i\n", n);
}
int five()
{ /* no args, int return */
return 5;
}
int triple(int n, int other, char nonsense)
{ /* int arg, int return */
return n*3;
}

13. Correctly parsing a C source file requires a full-fledged parser (such as that built into a C
compiler). Nonetheless, regular expressions can be used to provide a pretty good
approximate descriptions of many program constructs. Which of the following searches
will locate at least most of the C functions that accept an int as a first argument, and
return an int (and will not produce false positives very often). The exhibit contains a
fragment of C code with several annotated matching and non-matching functions (for
non-C programmers).
 A. grep -E "int[ \t]+\w+[ \t]*\([ \t]*int" *.c
 B. grep -E "^int\w+[A-Za-z_]+\w*\(\w*int" *.c
 C. grep -E "int.+\([ \t]+int.*\) " *.c
 D. grep -E "int[ \t]+[A-Za-z_][ \t]+\(int" *.c
14. Some tools that use regular expressions support so-called "extended" regular expressions.
For example, GNU 'grep' with the '-E' option uses extended regular expressions. Other
tools like 'sed' only support "basic" regular expressions. As a consequence, one must be
careful in selecting the right regular expression syntax. Which of the following characters
have a special meaning in extended regular expressions, but not in basic regular
expressions. That is, which of the following is an extended regular expression "meta-
character", but only a regular character in basic regular expressions?
 A. ^
 B. [
 C. +
 D. *

15. Based on Linux' partition naming system, which of the following device names point to
"logical" partitions (assuming the corresponding partitions exist at all on the system in
question)?
 A. /dev/sda3
 B. /dev/fd0
 C. /dev/hdb7
 D. /dev/hda4
 E. /dev/fd7
 F. /dev/sdc11

16. Which of the following command lines can (possibly) be used to format a partition?
Assume required partitions exist, and also that logical partitioning is used on each hard-
disk.
 A. mkfs -t msdos /dev/sda1
 B. mkfs.ext2 /dev/null
 C. mkfs -t ext2 /dev/hda4
 D. mkfs --type=ext2 /dev/hdb7

17. Which Linux command can be used to repair improperly shutdown, or otherwise
potentially corrupt partitions?
 A. chkdsk
 B. scandisk
 C. fsck
 D. fdisk

18. Which of the following command lines will produce an ad hoc report on the total disk
space used personally by the current user?
 A. fsck ~
 B. df ~/.
 C. quota --used
 D. du -hs ~
19. Which Linux command can be used to determine the available space on local hard-disk
partitions?
 A. free
 B. df
 C. du
 D. fdisk

Case Test
Web Server comparison

Please explain base on your experience, what do you think about Apache and NGINX web
server

Apache is more resource-intensive, making it less suitable for large projects and simultaneous
handling of massive data. Its performance may not be as effective, especially in high-traffic
situations.

On the other hand, NGINX is more reliable for handling high traffic. However, for those unfamiliar
with configuring NGINX, it may seem more complicated, especially when dealing with settings
such as reverse proxies.

MySQL Replication

Please explain step by step how to create database replication in MariaDB

Step 1: Configure Master Server (Server A):


sudo nano /etc/my.cnf

and then, we adjust server-id


[mysqld]
server-id = 1
log_bin = /var/log/mysql/mariadb-bin
save
restart : sudo systemctl restart mariadb
Log in to MariaDB and create a replication user: mysql -u root -p
CREATE USER 'nanbaru'@'%' IDENTIFIED BY 'rahasia';
GRANT REPLICATION SLAVE ON *.* TO 'nanbaru'@'%';
FLUSH PRIVILEGES;
SHOW MASTER STATUS; ( after u enter this command, we should note ‘file’ and ‘position’ values,
because we need that )
file : hadi
position : mulia

Step 2 : Configure server B


sudo nano /etc/my.cnf
[mysqld]
server-id = 2
sudo systemctl restart mariadb
login : mysql -u root -p

CHANGE MASTER TO
MASTER_HOST='Server_A_IP',
MASTER_USER='nanbaru',
MASTER_PASSWORD='rahasia,
MASTER_LOG_FILE='hadi',
MASTER_LOG_POS=mulia;

Start replication : START SLAVE;


SHOW SLAVE STATUS \G;
make sure Slave_IO_Running and Slave_SQL_Running both show Yes.

Network Security

Please explain the command to block all port connections and open only for 80 ,8080 and 443?

This command sets the default policy for incoming traffic to deny.
sudo ufw default deny incoming

sudo ufw allow 80/tcp


sudo ufw allow 8080/tcp
sudo ufw allow 443/tcp

sudo ufw enable

You might also like