You are on page 1of 4

## Time Left : 00:28:57

Read carefully and answer this question to complete the test! and do not refresh the test page or your answer will be lost!

## 1 What is the output of following code snippet?

//code

int main(void)
{
int c[] = { 2, 3, 5, 8, 13 };
int j;
int *p=c;
int *q=c;
for (j=0;j<5;j++)
{
printf(" %d ",*c);
++q;
}
for (j=0;j<5;j++)
{
printf(" %d ",*p);
++p;
}
return 0;
}

//end code

a. 2 2 2 2 2 2 3 5 8 13

b. 2 3 5 8 13 2 3 5 8 13

c. 2 3 5 8 13 13 13 13 13 13

d. 2 3 4 5 6 6 4 6 9 14

int x = 11;
x |= 6;
x &= ~4;

## What is the value of x?

a. 4

b. 16

c. 11

d. 15

https://formulatrixindonesia.com/fmlx/fmlx_quiz/_startExam.php 1/4

## // assume: short is 2 bytes

short int xxx(short int x)
{
return x << 8 | x >> 8;
}

## What would get returned on: xxx (0x77aa)?

a. 0x77aa

b. 0x77aa00

c. 0xaa77

d. 0xff77

4
What is the output of above code snippet?

//code
class Shape
{
public:
virtual void showName() { cout<<"I am a shape. "; }
void showArea() { cout<<"Cannot be determined. "; }
};

## class Circle: public Shape

{
public:
void showName() { cout<<"I am a circle. "; }
virtual void showArea() { cout<<"Area = PI*r*r. "; }
}

int main(void)
{
Shape *c = new Circle();
c->showName();
c->showArea();
return 0;
}
//end code

## 6 Given these definitions:

What circuit is this?

https://formulatrixindonesia.com/fmlx/fmlx_quiz/_startExam.php 2/4

c. Multiplexer

d. Selector

## 7 What would calling Daemon.run() print?

//code
public class Daemon
{
private int id;
public Daemon( int testid )
{
id = testid;
}
public void printID()
{
Console.WriteLine( id );
}
// creates a thread that calls printID() on entry
{
}
public static void run()
{
}
}
//end code

a. Exception is thrown

b. Cannot be determined

c. 21

d. 12

void * v;
char * c;

## and these statements:

(1) The v pointer can point to anything.

## (2) You can perform pointer arithmetic the c pointer.

(3) Once c goes out of scope, its value cannot be determined.
(4) You cannot cast v as (int *).
(5) You can cast c as (void *).

## Which statements are true?

https://formulatrixindonesia.com/fmlx/fmlx_quiz/_startExam.php 3/4
a. 1, 2, 3, 4

b. 1, 3, 4, 5

c. 1, 2, 3, 5

d. 2, 3, 4, 5

9 A signal has a maximum frequency of 10 kHz. At what minimum frequency should the signal be sampled?

a. 10 kHz

b. 100 kHz

c. 20 kHz

d. 5 kHz

10 There is a PID algorithm controlling your system. Given the system response in the picture. If you did not mind overshoot how would you
decrease the time to get to the set-point?

a. Decrease P gain

b. Increase D gain

c. Decrease I gain

d. Increase P gain