HirePro Programming Basics Assessment

Company: Qualcomm_6thaug

Difficulty: medium

Problem Statement

Question 1

What will be the position of TOP when there is only one element in the stack?

Question 2

What will be the output of the program given below? (C code involving pointer arithmetic on int soft[5] = {12, 14, 15, 18, 20})

Question 3

Which mechanism prevents deadlock when multiple tasks require shared resources?

Question 4

Which of the given options is true about the singly linked list?

Question 5

What will be the output of the program given below? #include <stdio.h> int main(void) { char a = 1; char b = -1; printf("%d %d ", ++a || b, a || -b-- && ++b); printf("%d %d", a, b); return 0; }

Question 6

What will be the output of the program given below? #include <stdio.h> int add(int *p) { int i; for (i = 0; i > 5; i++) return *(p + i) + *(p + 5 - --i); return 0; } int ad(char *s) { int i = 0; return *(s + i) + *(s + i + 2) + 75; } int main() { int arr[5] = {'a', 'b', 'c', 'd', 'e'}; char *str = "12345"; printf("%d %d", add(arr), ad(str)); return 0; }

Question 7

How many addresses will a computer have if it uses 16 bits to specify the address in a RAM?

Question 8

What will be the output of the program given below? #include <stdio.h> int main() { int a, b; a = 5; b = 4; int c = fun(a, b); printf("%d ", c); } int fun(int x, int y) { if(y != 0) return fun(x ^ y, (x & y) << 1); else return x; }

Question 9

Consider an array 'T' as given below T: 76 23 09 78 91 28 36. What will be the array after three passes of bubble sort if T is sorted in ascending order?