# Practise Technical Test 1(For Citrix R&d)

Approved & Edited by ProProfs Editorial Team
The editorial team at ProProfs Quizzes consists of a select group of subject experts, trivia writers, and quiz masters who have authored over 10,000 quizzes taken by more than 100 million users. This team includes our in-house seasoned quiz moderators and subject matter experts. Our editorial experts, spread across the world, are rigorously trained using our comprehensive guidelines to ensure that you receive the highest quality quizzes.
| By Khushbuz
K
Khushbuz
Community Contributor
Quizzes Created: 1 | Total Attempts: 138
Questions: 13 | Attempts: 138

Settings

C Programming Interview Prep for Citrix, OS, Aptitude

• 1.

• 2.

### #define square(x) x*x void main() {          int i;          i = 64/square(4);                   printf("%d",i); }

• A.

4

• B.

64

• C.

16

• D.

32

B. 64
Explanation
The correct answer is 64 because the square macro is defined as x*x. In the main function, the expression 64/square(4) is evaluated. Since square(4) is expanded to 4*4, the expression becomes 64/16 which equals 4. Therefore, the value of i is 4. However, the printf statement is missing a semicolon at the end, so the code will not compile.

Rate this question:

• 3.

### Int fact(int N) {              return (N * fact(N-1));       }   void main() {            int N=5;      int factorial = fact(N);       printf(“%d”,factorial); }

• A.

Compiler Error

• B.

Stack overflow

• C.

120

• D.

-120

B. Stack overflow
Explanation
The given code defines a recursive function called "fact" which calculates the factorial of a given number. In the main function, the variable N is assigned a value of 5, and then the fact function is called with N as the argument. The result of the factorial calculation is stored in the variable "factorial" and then printed using printf.

However, the code does not have a base case for the recursive function, which means it will keep calling itself indefinitely, causing a stack overflow error. This error occurs when the call stack, which keeps track of function calls, exceeds its maximum limit.

Rate this question:

• 4.

### What is the output of this statement ? (Question asked in Citrix) printf(“%d”,printf(“%d%d”,2,2) & printf(“%d%d ”, 2, 2));

• A.

22222

• B.

22221

• C.

22223

• D.

Compiler Error

A. 22222
Explanation
The printf function is used to print the output to the console. In this statement, there are three printf functions nested within each other. The innermost printf function ("%d%d", 2, 2) will print "22" to the console. The middle printf function ("%d%d", 2, 2) will also print "22" to the console. The outermost printf function ("%d", printf("%d%d", 2, 2) & printf("%d%d ", 2, 2)) will print the result of the bitwise AND operation between the return values of the two inner printf functions. Since both inner printf functions return 2, the bitwise AND operation will result in 2. Therefore, the output of the statement is "22222".

Rate this question:

• 5.

### #include<stdio.h> int main() {          int *p[10];          printf(“%d %d”,sizeof(p),sizeof(*p));          return 0; }

• A.

40 4

• B.

80 8

• C.

4 4

• D.

Depends on Compiler

D. Depends on Compiler
Explanation
TRAP: all who have marked 40,4. Please note whenever there is an option for such questions as compiler dependent then plz mark that as the answer. For 64 bit compiler, answer is 80 8. For 32 bit compiler- 40 4

Rate this question:

• 6.

### If there is a large quantum in round robin scheduling method, it will be equivalent to

• A.

First Come First Serve

• B.

Least Recently Used

• C.

Shortest Job First

• D.

None of the above

A. First Come First Serve
Explanation
Question on Operating System, scheduling policies

Rate this question:

• 7.

### Which among the following scheduling policies will lead to starvation of processes?

• A.

Round Robin Policy

• B.

Shortest Job First

• C.

Least Recently Used

• D.

First in First Out

B. Shortest Job First
Explanation
Shortest Job First scheduling policy can lead to starvation of processes. This is because in this policy, the process with the shortest burst time is given the highest priority and is executed first. If there are long processes in the system, they may have to wait for a long time before getting a chance to execute, leading to starvation. This policy prioritizes short processes, neglecting the longer ones, which can result in unfairness and starvation.

Rate this question:

• 8.

### If there are 9 yellow balls, 3 red balls and 2 green balls. What is the probability that the second ball picked is yellow given the first ball is yellow ?

• A.

8/13

• B.

9/13

• C.

8/14

• D.

9/14

A. 8/13
Explanation
The probability of picking a yellow ball as the second ball depends on the number of yellow balls remaining in the bag after the first yellow ball is picked. Since there are 9 yellow balls in total, and one is already picked, there are 8 yellow balls remaining. The total number of balls remaining in the bag is 13 (9 yellow + 3 red + 2 green). Therefore, the probability of picking a yellow ball as the second ball is 8/13.

Rate this question:

• 9.

### #include<stdio.h> struct ABC {     int a;     char b; }abc; int main() {    printf("sizeof structure:%d",sizeof(abc));    return 0; }

• A.

5

• B.

4

• C.

8

• D.

6

C. 8
Explanation

Rate this question:

• 10.

### #include<stdio.h> int main() {          if(sizeof(int)>-1)                   printf(“TRUE”);          else                   printf(“FALSE”);          return 0; }

• A.

TRUE

• B.

FALSE

B. FALSE
Explanation
Only use unsigned types for modular arithmetic, bits manipulations (&, |, ^, , ~ operators), byte manipulations (unsigned char means "byte" in C/C++), and characters (unsigned char means character in C/C++).

Rate this question:

• 11.

### #include<stdio.h> void main() {     int a =10;     void *k;     k =&a;     k++;      printf(“%d”,k); }

• A.

Compiler Error

• B.

Some garbage value

• C.

Some pointer value

• D.

1

A. Compiler Error
Explanation
Hint: its related to void pointer concept

Rate this question:

• 12.

### Void main() { static int a = 5; printf(“%d”, a--); if (a) main(); }

• A.

5 4 3 2 1

• B.

5 4 3 2 1 0

• C.

5 5 5 5 5…Infinite

• D.

4 3 2 1 0

A. 5 4 3 2 1
Explanation
The code starts by declaring a static integer variable "a" with a value of 5. It then prints the value of "a" (which is 5) and decrements it by 1. After that, it checks if "a" is still non-zero, and if it is, it calls the main function recursively. This process continues until "a" becomes 0. Therefore, the code will print the values of "a" in descending order: 5, 4, 3, 2, 1.

Rate this question:

• 13.

### Void main()  (Assume int to be of 2 bytes) {        unsigned int i= 3;        while(i-- >=0)                   printf(“%u”,i);  }

• A.

3 2 1 0 65535 65534 …..3 2 1 0 ….

• B.

3 2 1 0

• C.

3 2 1