HP Drive

Image 1 Image 2
34Rajeswari Krajii205125@gmail.comCSE1120
46Amuthaamuthavenkat178@gmail.comCSE1120
121Haritha Mmharitha2604@gmail.comMorning120
15Benazeer Fathima M21ec016@psr.edu.inECE1119
42NANDHINI Mnanthininanthini708@gmail.comCSE1119
91Sudha Ssudhaganesan2003@gmail.comCSE2119
93S SHAHANAshahana87780@gmail.comCSE2119
96Nagajothi Rjothir239@gmail.comCSE2119
56Latha Rishi Mathi Srishimathi1210@gmail.comCSE1118
37Sathyavathi S21ec085@psr.edu.inECE1117
74Raabiyathul Misria Rraabiyathulmisria2004@gmail.comCSE2116
98Nihariha Knihariha1824@gmail.comCSE2116
60Madhumathirmadhuvenus@gmail.comCSE1113
90Revathi Vengatasamycsrevathiv@gmail.comCSE2111
What will be the output of the program?
#include<stdio.h>
int main()
{
    int x=30, *y, *z;
    y=&x; /* Assume address of x is 500 and integer is 4 byte size */
    z=y;
    *y++=*z++;
    x++;
    printf("x=%d, y=%d, z=%d\n", x, y, z);
    return 0;
}
x=31, y=504, z=504
x=31, y=504, z=508
x=31, y=508, z=508
x=30, y=504, z=508
Correct Answer: x=31, y=504, z=504
What will be the output of the program if the integer is 4 bytes long?
#include<stdio.h>
int main()
{
    int ***r, **q, *p, i=8;
    p = &i;
    q = &p;
    r = &q;
    printf("%d, %d, %d\n", *p, **q, ***r);
    return 0;
}
8, 8, 8
4, 8, 8
8, 4, 8
8, 8, 4
Correct Answer: 8, 8, 8
//Assume 16-bit:
void main()
{
   char *p;
   printf("%d %d ",sizeof(*p),sizeof(p));
}
1 2
2 1
2 2
1 4
Correct Answer: 1 2
#include<stdio.h>
void fun(void *p);
int i=100;
int main()
{
    void *vptr;
    vptr = &i;
    fun(vptr);
    return 0;
}
void fun(void *p)
{
    int **q;
    q = (int**)&p;
    printf("%d\n", **q);
}
100
0
Compilation error
Undefined behavior
Correct Answer: 100
What will be the output of the program?
#include<stdio.h>
int main()
{
    char *str;
    str = "%d\n";
    str++;
    str++;
    printf(str-2, 3000);
    return 0;
}
3000
Error
30
3
Correct Answer: 3000
void main()
{
    int *j;
   {
       int i=10;
       j=&i;
    }
    printf("%d",*j);
}
10
Compilation error
Undefined behavior
0
Correct Answer: 10
Will the following code compile?
void main()
{
    char *cptr,c;
    void *vptr,v;
    c=10; v=0;
    cptr=&c; vptr=&v;
    printf("%c%v",c,v);
}
Yes
No
Compilation error
Runtime error
Correct Answer: No
//Assume int is of 2 bytes, long is of 4 bytes
void main()
{
    char *p;
    int *q;
    long *r;
    p=q=r=0;
    p++;
    q++;
    r++;
    printf("%p...%p...%p",p,q,r);
}
Address increments by 1, 2, 4 bytes
Address increments by 2, 4, 8 bytes
Address increments by 1, 4, 8 bytes
Address increments by 4, 4, 4 bytes
Correct Answer: Address increments by 1, 2, 4 bytes
What will be the output of the program?
#include<stdio.h>
power(int**);
int main()
{
    int a=6, *aa; /* Address of 'a' is 1000 */
    aa = &a;
    a = power(&aa);
    printf("%d\n", a);
    return 0;
}
power(int **ptr)
{
    int b;
    b = **ptr***ptr;
    return (b);
}
36
12
6
Undefined behavior
Correct Answer: 36
Which of the following statements correctly declare a function that receives a pointer to pointer to a pointer to a float and returns a pointer to a pointer to a pointer to a pointer to a float?
float ***foo(float ***x);
float ****foo(float ***x);
float ****foo(float ****x);
float *foo(float *x);
Correct Answer: float ****foo(float ***x);
Which of the statements is correct about the program?
#include<stdio.h>
int main()
{
    int i=10;
    int *j=&i;
    return 0;
}
j is a pointer to i
j is a double pointer
i is a pointer
Compilation error
Correct Answer: j is a pointer to i
In the following program add a statement in the function fun() such that address of a gets stored in j?
#include<stdio.h>
int main()
{
    int *j;
    void fun(int**);
    fun(&j);
    return 0;
}
void fun(int **k)
{
    int a=10;
    /* Add a statement here */
}
j = &a;
k = &a;
*k=&a;
k = j;
Correct Answer: *k=&a;
Are the expressions *ptr++ and ++*ptr the same?
Yes
No
They depend on the context
Undefined behavior
Correct Answer: No
The following program reports an error on compilation.
#include<stdio.h>
int main()
{
    float i=100, *j;
    void *k;
    k=&i;
    j=k;
    printf("%f\n", *j);
    return 0;
}
True
False
Correct Answer: False
Is there any difference between the following two statements?
char *a=0;
char *b=NULL;
No difference
Yes, NULL is defined as ((void*)0)
Yes, 0 is defined as a null pointer constant
Yes, NULL is a macro
Correct Answer: No difference
Is the NULL pointer the same as an uninitialized pointer?
Yes
No
They are similar but not the same
Undefined behavior
Correct Answer: No
Which statement will you add in the following program to work it correctly?
#include<stdio.h>
int main()
{
    printf("%f\n", log(36.0));
    return 0;
}
#include <math.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
Correct Answer: #include <math.h>
What will be the output of the program?
#include<stdio.h>
int main()
{
    float *p;
    printf("%d\n", sizeof(p));
    return 0;
}
2 in 16 bit 2 in 32 bit
2 in 16 bit 4 in 32 bit
4 in 16 bit 8 in 32 bit
4 in 16 bit 2 in 32 bit
Correct Answer: 2 in 16 bit 4 in 32 bit
What will be the output of the program?
#include<stdio.h>
#include<math.h>
int main()
{
    printf("%f\n", sqrt(49.0));
    return 0;
}
7.000000
49.000000
Error
Undefined behavior
Correct Answer: 7.000000
What will be the output of the program?
#include<stdio.h>
#include<math.h>
int main()
{
    float n=1.54;
    printf("%f, %f\n", ceil(n), floor(n));
    return 0;
}
2.000000, 1.000000
1.000000, 1.000000
2.000000, 2.000000
1.000000, 2.000000
Correct Answer: 2.000000, 1.000000
How would you round off a value from 2.75 to 3.0?
roundup(2.75)
roundto(2.75)
ceil(2.75)
floor(2.75)
Correct Answer: ceil(2.75)
Point out the error in the following program.
#include<stdio.h>
int main()
{
    void v = 0;
    printf("%d", v);
    return 0;
}
No error
None of these
Abnormal program termination
Error: Size of v is unkown or zero
Correct Answer: Error: Size of v is unkown or zero
What will be the output of the program?
#include<stdio.h>
void fun(int*, int*);
int main()
{
    int i=5, j=2;
    fun(&i, &j);
    printf("%d, %d", i, j);
    return 0;
}
void fun(int *i, int *j)
{
    *i = *i**i;
    *j = *j**j;
}
25, 4
5, 2
10, 4
Undefined behavior
Correct Answer: 25, 4
#include<stdio.h>
void modify(int *p);
int main()
{
    int x = 10;
    modify(&x);
    printf("%d\n", x);
    return 0;
}
void modify(int *p)
{
    *p = 20;
}
10
20
0
Compilation error
Correct Answer: 20
#include<stdio.h>
void swap(int *a, int *b);
int main()
{
    int x = 5, y = 10;
    swap(&x, &y);
    printf("%d %d\n", x, y);
    return 0;
}
void swap(int *a, int *b)
{
    int temp = *a;
    *a = *b;
    *b = temp;
}
5 10
10 5
5 5
10 10
Correct Answer: 10 5
#include<stdio.h>
int main()
{
    int arr[3] = {1, 2, 3};
    int *ptr = arr;
    printf("%d %d\n", *(ptr+1), *(ptr+2));
    return 0;
}
2 3
1 2
1 3
2 2
Correct Answer: 2 3
#include<stdio.h>
int main()
{
    int i = 10;
    int *ptr = &i;
    printf("%p %p\n", (void*)&i, (void*)ptr);
    return 0;
}
Same address
Different addresses
Undefined behavior
Compilation error
Correct Answer: Same address
#include<stdio.h>
int main()
{
    char str[] = "Hello";
    char *ptr = str;
    printf("%c %c\n", *(ptr+1), *(ptr+2));
    return 0;
}
e l
H e
H l
e o
Correct Answer: e l
#include<stdio.h>
void increment(int *p)
{
    (*p)++;
}
int main()
{
    int x = 5;
    increment(&x);
    printf("%d\n", x);
    return 0;
}
5
6
0
Compilation error
Correct Answer: 6
#include<stdio.h>
int main()
{
    int arr[2][2] = {{1, 2}, {3, 4}};
    int *ptr = (int *)arr;
    printf("%d %d\n", *(ptr + 2), *(ptr + 3));
    return 0;
}
3 4
1 2
2 3
3 1
Correct Answer: 3 4
NameEmailDepartmentAttemptsMCQ Marks
Rajeswari Krajii205125@gmail.comCSE1113
Amuthaamuthavenkat178@gmail.comCSE1113
Latha Rishi Mathi Srishimathi1210@gmail.comCSE1112
S SHAHANAshahana87780@gmail.comCSE2112
Benazeer Fathima M21ec016@psr.edu.inECE1111
NANDHINI Mnanthininanthini708@gmail.comCSE1111
Sathyavathi S21ec085@psr.edu.inECE1110
Raabiyathul Misria Rraabiyathulmisria2004@gmail.comCSE2110
Sudha Ssudhaganesan2003@gmail.comCSE2110
Nagajothi Rjothir239@gmail.comCSE2110
Nihariha Knihariha1824@gmail.comCSE2110
Madhumathirmadhuvenus@gmail.comCSE118
Revathi Vengatasamycsrevathiv@gmail.comCSE227
Haritha Mmharitha2604@gmail.comMorning17
What will be the output of the following program?

void main() {
  int c[] = {2.8, 3.4, 4, 6.7, 5};
  int j, *p = c, *q = c;
  for (j = 0; j < 5; j++) {
    printf(' %d ', *c);
    ++q;
  }
  for (j = 0; j < 5; j++) {
    printf(' %d ', *p);
    ++p;
  }
}
2 2 2 2 2 2 3 4 6 5
Garbage Values
2 2 2 2 2 2 2 2 2 2
2 3 4 5 6 2 3 4 5 6
Correct Answer: 2 2 2 2 2 2 3 4 6 5
What does the following declaration mean?

int (*ptr)[10];
ptr is a pointer to an array of 10 integers
ptr is a pointer to a function returning int
ptr is an array of 10 integers
ptr is a pointer to an array of pointers
Correct Answer: ptr is a pointer to an array of 10 integers
In C, if you pass an array as an argument to a function, what actually gets passed?
Address of the first element of the array
Value of the first element of the array
Address of the last element of the array
All elements of the array
Correct Answer: Address of the first element of the array
What will be the output of the following program?

void main() {
  int a[] = {10, 20, 30, 40, 50}, j, *p;
  for (j = 0; j < 5; j++) {
    printf('%d', *a);
    a++;
  }
  p = a;
  for (j = 0; j < 5; j++) {
    printf('%d ', *p);
    p++;
  }
}
10 20 30 40 50 10 20 30 40 50
10 10 10 10 10 Garbage Values
Compilation Error
Segmentation Fault
Correct Answer: Compilation Error
What will be the output of the program?

#include<stdio.h>
int main() {
  int a[5] = {5, 1, 15, 20, 25};
  int i, j, m;
  i = ++a[1];
  j = a[1]++;
  m = a[i++];
  printf('%d, %d, %d', i, j, m);
  return 0;
}
3, 2, 15
2, 2, 20
3, 3, 20
2, 3, 15
Correct Answer: 3, 2, 15
What will be the output of the program if the array begins at 65486 and each integer occupies 2 bytes?

#include<stdio.h>
int main() {
  int arr[] = {12, 14, 15, 23, 45};
  printf('%u, %u\n', arr+1, &arr+1);
  return 0;
}
65488, 65496
65488, 65498
65488, 65494
65488, 65492
Correct Answer: 65488, 65496
What will be the output of the program?

#include<stdio.h>
int main() {
  static int a[2][2] = {1, 2, 3, 4};
  int i, j;
  static int *p[] = {(int*)a, (int*)a+1, (int*)a+2};
  for (i = 0; i < 2; i++) {
    for (j = 0; j < 2; j++) {
      printf('%d, %d, %d, %d\n', *(*(p+i)+j), *(*(j+p)+i), *(*(i+p)+j), *(*(p+j)+i));
    }
  }
  return 0;
}
1, 1, 1, 1, 2, 2\n2, 3, 3, 3\n2, 3, 3, 3
1, 1, 1, 1, 2, 2, 2\n3, 4, 4, 4\n2, 3, 3, 3
1, 1, 1, 1, 2, 3, 4\n2, 3, 4, 5\n2, 3, 3, 3
1, 1, 1, 1,\n2, 2, 2, 2\n2, 2, 2, 2\n 3, 3, 3,3
Correct Answer: 1, 1, 1, 1,\n2, 2, 2, 2\n2, 2, 2, 2\n 3, 3, 3,3
What will be the output of the program?

#include<stdio.h>
int main() {
  static int arr[] = {0, 1, 2, 3, 4};
  int *p[] = {arr, arr+1, arr+2, arr+3, arr+4};
  int **ptr = p;
  ptr++;
  printf('%d, %d, %d\n', ptr-p, *ptr-arr, **ptr);
  *ptr++;
  printf('%d, %d, %d\n', ptr-p, *ptr-arr, **ptr);
  *++ptr;
  printf('%d, %d, %d\n', ptr-p, *ptr-arr, **ptr);
  ++*ptr;
  printf('%d, %d, %d\n', ptr-p, *ptr-arr, **ptr);
  return 0;
}
1, 1, 1\n2, 2, 2\n3, 3, 3\n4, 4, 4
1, 2, 2\n2, 3, 3\n3, 4, 4\n4, 5, 5
1, 2, 2\n2, 3, 3\n3, 4, 4\n2, 2, 2
1, 1, 1\n2, 2, 2\n3, 3, 3\n3, 4, 4
Correct Answer: 1, 1, 1\n2, 2, 2\n3, 3, 3\n3, 4, 4
What will be the output of the program?

#include<stdio.h>
int main() {
  int arr[1] = {100};
  printf('%d\n', 0[arr]);
  return 0;
}
100
0
Garbage Value
Compilation Error
Correct Answer: 100
What will be the output of the program?

#include<stdio.h>
int main() {
  float arr[] = {1.4, 0.3, 4.50, 6.70};
  printf('%d\n', sizeof(arr)/sizeof(arr[0]));
  return 0;
}
4
5
6
7
Correct Answer: 4
What will be the output of the program if the array begins 1200 in memory?

#include<stdio.h>
int main() {
  int a[] = {2, 3, 4, 1, 6};
  printf('%u, %u, %u\n', a, &a[0], &a);
  return 0;
}
1200, 1200, 1200
1204, 1204, 1200
1200, 1200, 1204
1204, 1208, 1208
Correct Answer: 1200, 1200, 1200
Which of the following is the correct way to define the function fun() in the below program?

#include<stdio.h>
int main() {
  int a[3][4];
  fun(a);
  return 0;
}
void fun(int *p[][4])
void fun(int *p[3][4])
void fun(int (*p)[4])
void fun(int *p[4])
Correct Answer: void fun(int (*p)[4])
Which of the following statements are correct about `6` used in the program?

int num[6];
num[6]=21;
The statement is correct; the array is of size 6.
The statement is incorrect; the array index is out of bounds.
The array element at index 6 is 21.
The array num[6] can have an element at index 6.
Correct Answer: The statement is incorrect; the array index is out of bounds.
Which of the following statements are correct about an array?
The array int num[26]; can store 26 elements.
The expression num[1] designates the very first element in the array.
It is necessary to initialize the array at the time of declaration.
All of the above.
Correct Answer: The array int num[26]; can store 26 elements.
Does mentioning the array name give the base address in all contexts?
Yes, in all contexts.
No, it depends on the context.
Only when it is passed as a parameter to a function.
Only when it is used in arithmetic operations.
Correct Answer: No, it depends on the context.
Is there any difference in the following declarations?

int f1(int arr[]);
int f1(int arr[100]);
Yes, there is a difference in memory allocation.
No, both are equivalent.
The second declaration allocates memory for 100 integers.
The first declaration does not allocate memory.
Correct Answer: No, both are equivalent.
Are the expressions `arr` and `&arr` the same for an array of 10 integers?
Yes, both give the base address.
No, `arr` is of type `int*` and `&arr` is of type `int(*)[10]`.
They are the same in pointer arithmetic.
Yes, but only when `arr` is passed to a function.
Correct Answer: No, `arr` is of type `int*` and `&arr` is of type `int(*)[10]`.
What would be the equivalent pointer expression for referring to the array element `a[i][j][k][l][m]`?
*(((*(((*((a + i) + j) + k) + l)) + m))
*(*(*(*(*(a + i) + j) + k) + l) + m)
*(a + i + j + k + l + m)
a[i][j][k][l][m]
Correct Answer: *(*(*(*(*(a + i) + j) + k) + l) + m)
What will be the output of the program?

#include<stdio.h>
int main()
{
    int arr[2][2][2] = {10, 2, 3, 4, 5, 6, 7, 8};
    int *p, *q;
    p = &arr[1][1][1];
    q = (int*) arr;
    printf("%d, %d\n", *p, *q);
    return 0;
}
8, 10
7, 10
8, 8
7, 7
Correct Answer: 8, 10
What will be the output of the program assuming that the array begins at location 1002 and the size of an integer is 4 bytes?

#include<stdio.h>
int main()
{
    int a[3][4] = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12 };
    printf("%u, %u, %u\n", a[0]+1, *(a[0]+1), *(*(a+0)+1));
    return 0;
}
1006, 2, 2
1006, 1, 1
1006, 5, 5
None of the above
Correct Answer: 1006, 2, 2

Set 1
Write a program to perform quick sort.
Write a program to find the Greatest Common Divisor (GCD) of two numbers using recursion
Set 2
Write a program to print the reverse of a given string.
Write a program to find all the permutations of a given string.
Set 3
Write a program to calculate the sum of all digits of a given number.
Write a program to find the longest substring without repeating characters in a given string.
Set 4
Write a program to find the factorial of a given number using recursion.
Write a program to generate Pascal’s Triangle up to n rows.
Set 5
Write a program to perform insertion sort.
Write a program to convert a given Roman numeral to its equivalent integer value.
Set 6
Write a program to find the maximum of three numbers entered by the user and find the sum of digits of max number.
Write a program to check if a given number is a palindrome without converting it to a string.
Set 7
Write a program to print all the prime numbers between 1 and n.
Write a program to find the first n numbers in the Fibonacci sequence that are also prime.
Set 8
Write a program to swap two numbers without using a temporary variable.
Write a program to find all Armstrong numbers in a given range [a, b].
Set 9
Write a program to perform quick sort.
Write a program to check if two given strings are anagrams of each other.
Set 10
Write a program to perform bubble sort.
Write a program to implement reverse a string.
Set 11
Write a program to reverse an integer (e.g., 1234 becomes 4321).
Write a program to perform merge sort.
Set 12
Write a program to count the frequency of each character in a given string.
Write a program to check if a given year is a leap year or not using nested if-else conditions.
Set 13
Write a program to print the sum of the first n natural numbers.
Write a program to determine if a given string can be rearranged to form a palindrome.
Set 14
Write a program to perform selection sort.
Write a program to find the intersection of two arrays and print the common elements.

Haritha Mmharitha2604@gmail.comMorning131
Rajeswari Krajii205125@gmail.comCSE1130
Sudha Ssudhaganesan2003@gmail.comCSE2130
Latha Rishi Mathi Srishimathi1210@gmail.comCSE1127
Raabiyathul Misria Rraabiyathulmisria2004@gmail.comCSE2127
Benazeer Fathima M21ec016@psr.edu.inECE1125
Madhumathirmadhuvenus@gmail.comCSE1125
Nagajothi Rjothir239@gmail.comCSE2125
Amuthaamuthavenkat178@gmail.comCSE1123
Revathi Vengatasamycsrevathiv@gmail.comCSE2123
Sathyavathi S21ec085@psr.edu.inECE1122
How will you print `\n` on the screen?
echo “\n”;
printf(‘\n’);
printf(“\n”);
printf(“\n”);
Correct Answer: printf(“\n”);
The library function used to reverse a string is:
strstr()
strreverse()
revstr()
strrev()
Correct Answer: strrev()
Which of the following functions sets the first n characters of a string to a given character?
strcset()
strset()
strnset()
strinit()
Correct Answer: strnset()
What will be the output of the following code?
```c
void main()
{
    char s[ ]="man";
    int i;
    for(i=0;s[i];i++)
        printf("\n%c%c%c%c",s[i],*(s+i),*(i+s),i[s]);
}
```
None of the above
man\nman\nman\nman
mmmm\naaaa\nnnnn
Error
Correct Answer: mmmm\naaaa\nnnnn
What will be the output of the following code?
```c
void main()
{
   char string[]="Hello World";
   display(string);
}
void display(char *string)
{
   printf("%s",string);
}
```
Compiler Error
Hello World
None of the above
H
Correct Answer: Hello World
If the two strings are identical, then `strcmp()` function returns:
True
-1
1
False
Correct Answer: False
Which of the following functions is used to find the first occurrence of a given string in another string?
strnset()
strrchr()
strstr()
strchr()
Correct Answer: strstr()
Will the following code compile?
```c
void main()
{
    static char names[5][20]="pascal","ada","cobol","fortran","perl";
    int i;
    char *t;
    t=names[3];
    names[3]=names[4];
    names[4]=t;
    for (i=0;i<=4;i++)
        printf("%s",names[i]);
}
```
No
Yes
Correct Answer: Yes
What will be the output of the following code?
```c
#include <stdio.h>
void main()
{
    char s[]={'a','b','c','\n','c','\0'};
    char *p,*str,*str1;
    p=&s[3];
    str=p;
    str1=s;
    printf("%c",++*p + ++*str1-32);
}
```
X
M
a
Error
Correct Answer: X
Which of the following functions is more appropriate for reading in a multi-word string?
fgets();
puts();
printf();
scanf();
Correct Answer: fgets();
Which of the following functions is correct for finding the length of a string?
int xstrlen(char *s) { int length=0; while(*s!=’\0′) length++; return (length); }
int xstrlen(char *s) { int length=0; while(*s!=’\0′) { length++; s++; } return (length); }
int xstrlen(char s) { int length=0; while(*s!=’\0′) length++; s++; return (length); }
int xstrlen(char *s) { int length=0; while(*s!=’\0′) s++; return (length); }
Correct Answer: int xstrlen(char *s) { int length=0; while(*s!=’\0′) { length++; s++; } return (length); }
What will be the output of the following code?
```c
#include <stdio.h>
#include <string.h>
int main()
{
    char str1[20] = "Hello", str2[20] = " World";
    printf("%s\n", strcpy(str2, strcat(str1, str2)));
    return 0;
}
```
Hello
Hello World
World
WorldHello
Correct Answer: Hello World
What will be the output of the following code?
```c
void main()
{
   char *str1="abcd";
   char str2[]="abcd";
   printf("%d %d %d",sizeof(str1),sizeof(str2),sizeof("abcd"));
}
```
4 4 4
error
2 2 2
2005-02-05 00:00:00
Correct Answer: 4 4 4
What will be the output of the program ? 
#include<stdio.h>
int main()
{
    char p[] = "%d\n";
    p[1] = 'c';
    printf(p, 65);
    return 0;
}
65
a
c
A
Correct Answer: c
What will be the output of the program ? 
#include<stdio.h>
#include<string.h>
int main()
{
    printf("%d\n", strlen("12345"));
    return 0;
}
5
2002-12-06 00:00:00
Correct Answer: 5
What will be the output of the program ? 
#include<stdio.h>
int main()
{
    printf(5+"Good Morning\n");
    return 0;
}
Good Morning
M
Morning
Good
Correct Answer: Morning
What will be the output of the program ? 
#include<stdio.h>
#include<string.h>
int main()
{
    char str[] = "Ind\0\ROCKS\0";
    printf("%s\n", str);
    return 0;
}
Ind
Ind ROCKS
ROCKS
Ind\0ROCKS
Correct Answer: Ind
What will be the output of the program If characters 'a', 'b' ,'c',’d’ ans enter are supplied as input? 
#include<stdio.h>
int main()
{
    void fun();
    fun();
    printf("\n");
    return 0;
}
void fun()
{
    char c;
    if((c = getchar())!= '\n')
        fun();
    printf("%c", c);
}
dbca
abcd abcd
dcba
Infinite loop
Correct Answer: dcba
What will be the output of the program ? 
#include<stdio.h>
int main()
{
    printf("Ind", "ROCKS\n");
    return 0;
}
Ind ROCKS
Ind
ROCKS
Error
Correct Answer: Ind
What will be the output of the program ? 
#include<stdio.h>
char *names[] = { "Suresh", "Siva", "Sona", "Baiju", "Ritu"};
int i;
char *t;
t = names[3];
names[3] = names[4];
names[4] = t;
for(i=0; i<=4; i++)
    printf("%s,", names[i]);
return 0;
Suresh, Siva, Baiju, Sona, Ritu
Suresh, Siva, Sona, Baiju, Ritu
Suresh, Siva, Ritu, Sona, Baiju
Suresh, Siva, Sona, Ritu, Baiju
Correct Answer: Suresh, Siva, Ritu, Sona, Baiju
What will be the output of the program ? 
#include<stdio.h>
#include<string.h>
int main()
{
    static char str1[] = "dills";
    static char str2[20];
    static char str3[] = "Daffo";
    int i;
    i = strcmp(strcat(str3, strcpy(str2, str1)), "Daffodills");
    printf("%d\n", i);
    return 0;
}
False
2004-01-02 00:00:00
Correct Answer: False
What will be the output of the program ? 
#include<stdio.h>
#include<string.h>
int main()
{
    static char s[] = "Hello!";
    printf("%d\n", *(s+strlen(s)));
    return 0;
}
False
error
16
8
Correct Answer: error
What will be the output of the program ? 
#include<stdio.h>
int main()
{
    static char s[25] = "The cocaine man";
    int i=0;
    char ch;
    ch = s[++i];
    printf("%c", ch);
    ch = s[i++];
    printf("%c", ch);
    ch = i++[s];
    printf("%c", ch);
    ch = ++i[s];
    printf("%c", ch);
    return 0;
}
hhe!
Hhec
The c
he c
Correct Answer: hhe!
What will be the output of the program ? 
#include<stdio.h>
int main()
{
    int i;
    char a[] = "\0";
    if(printf("%s", a))
        printf("The string is empty\n");
    else
        printf("The string is not empty\n");
    return 0;
}
The string is empty
0
No output
The string is not empty
Correct Answer: The string is empty
If char=1, int=4, and float=4 bytes size, What will be the output of the program ? 
#include<stdio.h>
int main()
{
    char ch = 'A';
    printf("%d, %d, %d", sizeof(ch), sizeof('A'), sizeof(3.14f));
    return 0;
}
1, 2, 4
2, 4, 8
1, 4, 4
2, 2, 4
Correct Answer: 1, 4, 4
If the size of pointer is 32 bits What will be the output of the program ? 
#include<stdio.h>
int main()
{
    char a[] = "Visual C++";
    char *b = "Visual C++";
    printf("%d, %d\n", sizeof(a), sizeof(b));
    printf("%d, %d", sizeof(*a), sizeof(*b));
    return 0;
}
12, 2 2, 2
10, 2 2, 2
11, 4 1, 1
10, 4 1, 2
Correct Answer: 10, 4 1, 2
What will be the output of the program ? 
#include&lt;stdio.h&gt;
int main()
{
    char str1[] = "Hello";
    char str2[10];
    char *t, *s;
    s = str1;
    t = str2;
    while(*t=*s)
        *t++ = *s++;
    printf("%s\n", str2);
    return 0;
}
No output
HelloHello
ello
Hello
Correct Answer: Hello
What will be the output of the program ? 
#include&lt;stdio.h&gt;
int main()
{
    char str[50] = "Ind Test";
    printf("%s\n", &amp;str+2);
    return 0;
}
Error
Garbage value
No output
rga Test
Correct Answer: rga Test
What will be the output of the program ? 
#include&lt;stdio.h&gt;
int main()
{
    char str = "Ind Test";
    printf("%s\n", str);
    return 0;
}
No output
Error
Ind Test
Base address of str
Correct Answer: Error
What will be the output of the program ? 
#include&lt;stdio.h&gt;
int main()
{
    char str[] = "Nagpur";
    str[0]='K';
    printf("%s, ", str);
    str = "Kanpur";
    printf("%s", str+1);
    return 0;
}
Kagpur, Kanpur
Kagpur, anpur
Nagpur, Kanpur
Error
Correct Answer: Error
What will be the output of the program ? 
#include&lt;stdio.h&gt;
#include<string.h>
int main()
{
    char sentence[80];
    int i;
    printf("Enter a line of text\n");
    fgets(sentence, 80, stdin);
    for(i=strlen(sentence)-1; i &gt;=0; i--)
        putchar(sentence[i]);
    return 0;
}
None of above
The sentence will get printed in same order as it entered
The sentence will get printed in reverse order
Half of the sentence will get printed
Correct Answer: The sentence will get printed in reverse order
What will be the output of the program ? 
#include&lt;stdio.h&gt;
void swap(char *, char *);
int main()
{
    char *pstr[2] = {"Hello", "Ind Test"};
    swap(pstr[0], pstr[1]);
    printf("%s\n%s", pstr[0], pstr[1]);
    return 0;
}
void swap(char *t1, char *t2)
{
    char *t;
    t=t1;
    t1=t2;
    t2=t;
}
Dello Hurga Test
Address of “Hello” and “Ind Test”
Hello Ind Test
Ind Test Hello
Correct Answer: Hello Ind Test
If the size of pointer is 4 bytes then What will be the output of the program ? 
#include&lt;stdio.h&gt;
int main()
{
    char *str[] = {"Frogs", "Do", "Not", "Die", "They", "Croak!"};
    printf("%d, %d", sizeof(str), strlen(str[0]));
    return 0;
}
22, 4
20, 2
25, 5
24, 5
Correct Answer: 24, 5
What will be the output of the program ? 
#include&lt;stdio.h&gt;
int main()
{
    char str1[] = "Hello";
    char str2[] = "Hello";
    if(str1 == str2)
        printf("Equal\n");
    else
        printf("Unequal\n");
    return 0;
}
Unequal
Error
None of above
Equal
Correct Answer: Unequal
What will be the output of the program ? 
#include&lt;stdio.h&gt;
int main()
{
    char *p1 = "Ind", *p2;
    p2=p1;
    p1 = "TEST";
    printf("%s %s\n", p1, p2);
    return 0;
}
Ind TEST
TEST TEST
Ind Ind
TEST Ind
Correct Answer: TEST Ind
What will be the output of the program ? 
#include&lt;stdio.h&gt;
#include<string.h>
int main()
{
    printf("%c\n", "abcdefgh"[4]);
    return 0;
}
abcdefgh
d
e
Error
Correct Answer: e
What will be the output of the program ? (Assume Hello string is stored in 65530)
#include&lt;stdio.h&gt;
int main()
{
    printf("%u %s\n", &amp;"Hello", &amp;"Hello");
    return 0;
}
65530 Hello
Error
Hello Hello
Hello 65530
Correct Answer: 65530 Hello
Which of the following statements are correct about the program below? 
#include&lt;stdio.h&gt;
int main()
{
    char str[20], *s;
    printf("Enter a string\n");
    scanf("%s", str);
    s=str;
    while(*s != '\0')
    {
        if(*s &gt;= 97 &amp;&amp; *s &lt;= 122)
            *s = *s-32;
        s++;
    }
    printf("%s",str);
    return 0;
}
The code converts lower case character to upper case
The code converts a string in to an integer
Correct Answer: The code converts lower case character to upper case
Which of the following statements are correct about the below declarations?
char *p = "Ind";
char a[] = "Ind";
1: There is no difference in the declarations and both serve the same purpose.
2: p is a non-const pointer pointing to a non-const string, whereas a is a const pointer pointing to a non-const pointer.
3: The pointer p can be modified to point to another string, whereas the individual characters within array a can be changed.
4: In both cases the '\0' will be added at the end of the string "Ind".
1, 2
2, 3
3, 4
2, 3, 4
Correct Answer: 2, 3, 4
Which of the following statement is correct?
strcmp(s1, s2) returns a number greater than 0 if s1<s2
strcmp(s1, s2) returns 1 if s1==s2
strcmp(s1, s2) returns a number less than 0 if s1>s2
strcmp(s1, s2) returns 0 if s1==s2
strcmp(s1, s2) returns a number greater than 0 if s1<s2
strcmp(s1, s2) returns 1 if s1==s2
strcmp(s1, s2) returns a number less than 0 if s1> s2
strcmp(s1, s2) returns 0 if s1==s2
Correct Answer: strcmp(s1, s2) returns 0 if s1==s2
Will the program compile successfully?
#include <stdio.h>
int main()
{
    char a[] = "Ind";
    char *p = "TEST";
    a = "TEST";
    p = "Ind";
    printf("%s %s\n", a, p);
    return 0;
}
No
Yes
Correct Answer: No
For the following statements will arr[3] and ptr[3] fetch the same character?
char arr[] = "Ind Test";
char *ptr = "Ind Test";
Yes
No
Correct Answer: Yes
What will be the output of the program?
#include <stdio.h>
int main()
{
    static char *s[] = {"black", "white", "pink", "violet"};
    char **ptr[] = {s+3, s+2, s+1, s}, ***p;
    p = ptr;
    ++p;
    printf("%s", **p+1);
    return 0;
}
ink
ite
ack
let
Correct Answer: ink
What will be the output of the program?
#include <stdio.h>
int main()
{
    char *str;
    str = "%s";
    printf(str, "K\n");
    return 0;
}
Error
No output
K
%s
Correct Answer: K
void main()
{
    char *p;
    p="Hello";
    printf("%c\n",*&*p);
}
Garbage Value
H
Error
Hello
Correct Answer: H
What will be the output of the program?
#include <stdio.h>
int main()
{
    printf("%c\n", 5["IndTest"]);
    return 0;
}
e
5
Error
Nothing will print
Correct Answer: e
What will be the output of the program?
#include <stdio.h>
int main()
{
    char *p;
    p="hell";
    printf("%s\n", *&*p);
    return 0;
}
ll
h
ell
hell
Correct Answer: hell
Which statement will you add to the following program to ensure that the program outputs "Ind Test" on execution?
#include <stdio.h>
int main()
{
    char s[] = " Ind Test ";
    char t[25];
    char *ps, *pt;
    ps = s;
    pt = t;
    while(*ps)
        *pt++ = *ps++;
    /* Add a statement here */
    printf("%s\n", t);
    return 0;
}
pt=’ ‘;
pt=’\0′;
*pt=’\0′;
*pt=”;
Correct Answer: *pt=’\0′;
What will be the output of the program?
#include <stdio.h>
int main()
{
    void fun(char*);
    char a[100];
    a[0] = 'A'; a[1] = 'B';
    a[2] = 'C'; a[3] = 'D';
    fun(&a[0]);
    return 0;
}
void fun(char *a)
{
    a++;
    printf("%c", *a);
    a++;
    printf("%c", *a);
}
No output
CD
BC
AB
Correct Answer: CD
What will be the output of the program?
#include <stdio.h>
int main()
{
    char *s;
    char *fun();
    s = fun();
    printf("%s\n", s);
    return 0;
}
char *fun()
{
    char buffer[30];
    strcpy(buffer, "RAM");
    return (buffer);
}
Error
0xffff
Garbage value
0xffee
Correct Answer: Error
What will be the output of the program?
#include <stdio.h>
int main()
{
    char str[20] = "Hello";
    char *const p=str;
    *p='M';
    printf("%s\n", str);
    return 0;
}
HMello
MHello
Hello
Mello
Correct Answer: MHello
#include <stdio.h>
void main()
{
    register i=5;
    char j[]= "hello";
    printf("%s %d",j,i);
}
none of the above
5 hello
error
hello 5
Correct Answer: error
What will be the output of the program?
#include <stdio.h>
int main()
{
    char ch;
    ch = 'A';
    printf("The letter is ");
    printf("%c\n", ch >= 'A' && ch <= 'Z' ? ch + 'a' - 'A':ch);
    printf("Now the letter is ");
    printf("%c\n", ch >= 'A' && ch <= 'Z' ? ch : ch + 'a' - 'A');
    return 0;
}
Error
None of above
The letter is A Now the letter is a
The letter is a Now the letter is A
Correct Answer: The letter is A Now the letter is a
void main()
{
    printf("\nab");
    printf("\bsi");
    printf("\rha");
}
Error
garbage value
hai
absiha
Correct Answer: hai
What will be the output of the program?
#include <stdio.h>
int main()
{
    char str[] = "C-program";
    int a = 5;
    printf(a > 1 ? "Ind Test\n" : "%s\n", str);
    return 0;
}
None of above
C-program
Ind Test
Error
Correct Answer: Ind Test
Will the following code compile?
void main()
{
    int k = 1;
    printf("%d==1 is ""%s", k, k == 1 ? "TRUE" : "FALSE");
}
Yes
No
Correct Answer: No
In the following program, how long will the for loop get executed?
#include <stdio.h>
int main()
{
    int i;
    for(; scanf("%s", &i); printf("%d\n", i));
    return 0;
}
The for loop would get executed infinite times
The for loop would get executed 5 times
The for loop would get executed only once
The for loop would not get executed at all
Correct Answer: The for loop would get executed infinite times
Which standard library function will you use to find the last occurrence of a character in a string in C?
strnchar()
strrchr()
strrchar()
strchar()
Correct Answer: strrchr()
What will be the output of the program?
#include <stdio.h>
#include <string.h>
int main()
{
    char dest[] = {98, 98, 0};
    char src[] = "bbb";
    int i;
    if((i = memcmp(dest, src, 2)) == 0)
        printf("Got it");
    else
        printf("Missed");
    return 0;
}
Missed
None of above
Got it
Error in memcmp statement
Correct Answer: Got it
It is necessary that for the string functions to work safely, the strings must be terminated with '\0'.
False
True
Correct Answer: True
The prototypes of all standard library string functions are declared in the file string.h.
No
Yes
Correct Answer: Yes
scanf() or atoi() function can be used to convert a string like "436" into an integer.
Yes
No
Correct Answer: Yes

C Programming Topics

1. Introduction to C Programming


Arithmetic and Operators

  1. Arithmetic Operators
  2. C – Tokens
  3. Declaration Rules
  4. Relational & Logical Operators

Conditional Constructs and Loops

  1. If Conditional Construct
  2. If-else Conditional Construct
  3. Conditional Operator
  4. While Loop
  5. Nested While Loops
  6. For Loop
  7. Do-While Loop
  8. Break
  9. Continue
  10. Goto
  11. Switch
  12. Increment & Decrement Operators

Number Systems and Data Types

  1. Number Systems
  2. Introduction to Data Types
  3. Signed Char
  4. Unsigned Char
  5. Signed & Unsigned Short Int
  6. Signed & Unsigned Long Int
  7. Floating Data Type
  8. Sizeof Operator

Bitwise Operators

  1. Introduction to All Bitwise Operators

Functions and Storage Classes

  1. Introduction to Functions
  2. Functions Part 1
  3. Function Declarations
  4. Introduction & Auto Storage Class
  5. Static Storage Class
  6. Extern Storage Class
  7. Compilation Process
  8. Extern Multilevel File Programming Part 1
  9. Extern Multilevel File Programming Part 2
  10. Memory Segments
  11. Register
  12. Introduction to Recursion
  13. Static & Extern Recursion
  14. Runtime Stack Mechanism

Pointers

  1. Introduction to Pointers
  2. Operations Allowed on Pointers
  3. Sizeof Pointer
  4. Little & Big Endian Architectures
  5. Void Pointer
  6. Wild, Null Pointer
  7. Call by Value & Call by Address
  8. Dangling Pointer
  9. Recursion on Pointers
  10. Pointer to Pointers

Arrays

  1. Introduction to Arrays
  2. 1D Array Declarations and Initializations
  3. 1D Array Problems
  4. Advanced Problems on 1D Arrays
  5. 2D Arrays
  6. 3D Arrays
  7. Array of Pointers
  8. Examples on Array of Pointers
  9. Pointer to an Array
  10. Passing Array to a Function
  11. Initialization Rules

Strings

  1. Introduction to Strings
  2. Special Characters
  3. Char Representation
  4. NULL Char Representation
  5. 1D Strings
  6. String vs printf
  7. 2D Strings
  8. Pointer to Strings
  9. Introduction to string.h
  10. strcpy()
  11. strlen()
  12. strrev()
  13. Check if a String is a Palindrome
  14. strtok()
  15. Scanning a String

Structures, Unions, and Enums

  1. Introduction to Structures
  2. Structure Initialization
  3. Using Pointer Member in Structure
  4. Operations on Structure Variables
  5. Containership
  6. typedef
  7. Array of Structures
  8. Global, Local Structure Declarations
  9. Nested Structures
  10. Structure Padding
  11. Bit Fields – Part 1
  12. Union
  13. Enum

Miscellaneous Concepts

  1. const
  2. volatile

Dynamic Memory Allocation

  1. malloc()
  2. free()
  3. calloc()
  4. realloc()
  5. Why Dynamic Memory Allocation?

Preprocessor and Macros

  1. Introduction to Preprocessor, Macros
  2. Macro Part 2
  3. Macro Part 3
  4. Nested Macro
  5. Conditional Compilation
  6. File Inclusion
  7. Miscellaneous Macros

Other Operators

  1. Short-Hand Assignment Operators
  2. Comma Operator

Command Line Arguments

  1. Command Line Arguments

Function Pointers

  1. Function Pointers

File Handling

  1. Introduction to Files
  2. File Operations – Part 1
  3. File Operations – Part 2

Java Programming Topics

1. Introduction to Java

  1. What is Java?
  2. History of Java
  3. Features of Java
  4. Java Development Kit (JDK)
  5. Java Runtime Environment (JRE)
  6. Java Virtual Machine (JVM)
  7. Hello World Program in Java

Java Basics

  1. Data Types in Java
  2. Variables in Java
  3. Operators in Java
  4. Java Keywords
  5. Java Identifiers
  6. Java Literals
  7. Type Casting in Java
  8. Control Statements
    • If-else Statements
    • Switch Statement
    • For Loop
    • While Loop
    • Do-while Loop
    • Break and Continue Statements

Object-Oriented Programming (OOP) Concepts

  1. Introduction to OOPs
  2. Classes and Objects
  3. Constructors in Java
  4. Inheritance in Java
  5. Polymorphism
    • Method Overloading
    • Method Overriding
  6. Abstraction
    • Abstract Classes
    • Interfaces
  7. Encapsulation
  8. Access Modifiers (Public, Private, Protected, Default)
  9. Static Keyword
  10. this Keyword
  11. super Keyword
  12. Final Keyword
  13. Nested Classes
  14. Anonymous Classes

Exception Handling

  1. Introduction to Exceptions
  2. Types of Exceptions
  3. Try-Catch Block
  4. Multiple Catch Blocks
  5. Nested Try Blocks
  6. Finally Block
  7. Throw Keyword
  8. Throws Keyword
  9. Custom Exceptions

Java Collections Framework

  1. Introduction to Collections
  2. List Interface
    • ArrayList
    • LinkedList
    • Vector
    • Stack
  3. Set Interface
    • HashSet
    • LinkedHashSet
    • TreeSet
  4. Queue Interface
    • PriorityQueue
    • Deque Interface
  5. Map Interface
    • HashMap
    • LinkedHashMap
    • TreeMap
    • Hashtable
  6. Collections Class Utility Methods

Java Strings

  1. Introduction to Strings
  2. String Methods
  3. StringBuffer Class
  4. StringBuilder Class
  5. String vs StringBuffer vs StringBuilder
  6. String Tokenizer

Multithreading in Java

  1. Introduction to Multithreading
  2. Creating Threads
    • Extending Thread Class
    • Implementing Runnable Interface
  3. Thread Life Cycle
  4. Thread Methods
  5. Thread Synchronization
  6. Inter-thread Communication
  7. Daemon Threads
  8. Thread Pooling
  1. What is the difference between ++i and i++ in C?
  2. Explain the purpose of static keyword in C.
  3. What are the different storage classes in C?
  4. How does the sizeof operator work?
  5. Write a C program to reverse a string without using library functions.
  6. What is the difference between struct and union in C?
  7. How do you handle memory allocation and deallocation in C?
  8. What is a dangling pointer and how can it be avoided?
  9. Explain the use of void pointers in C.
  10. Write a C program to find the factorial of a number using recursion.
  11. How do you pass arrays to functions in C?
  12. Explain the const keyword in C with an example.
  13. What is a segmentation fault and how can it be avoided?
  14. How do you define and use macros in C?
  15. What is pointer arithmetic? Give an example.
  16. Write a C program to implement a stack using an array.
  17. Explain the difference between strcmp and strcpy functions.
  18. What are header guards in C and why are they used?
  19. Write a C program to merge two sorted arrays into a single sorted array.
  20. What is the output of the following code?

#include <stdio.h>int main() {    int x = 10;    printf(“%d\n”, x++);    printf(“%d\n”, ++x);    return 0;}

  1. Explain how switch statements work in C.
  2. How does the return statement work in functions?
  3. Write a C program to find the sum of elements in an array.
  4. What is the difference between break and continue statements?
  5. How do you handle errors in C programs?
  6. Explain the difference between char, int, and float data types.
  7. Write a C program to check if a number is prime.
  8. What is the purpose of the enum keyword in C?
  9. How do you use fopen() and fclose() functions?
  10. What is the difference between printf and fprintf?
  11. Write a C program to implement a queue using linked list.
  12. Explain the concept of file handling in C with examples.
  13. What is a memory leak and how can it be prevented?
  14. How do you compare strings in C?
  15. Write a C program to count the number of vowels in a string.
  16. Explain the use of volatile keyword in C.
  17. What is the difference between malloc() and calloc() functions?
  18. Write a C program to find the maximum and minimum elements in an array.
  19. How does the sizeof operator work with arrays and structures?
  20. Explain how to use realloc() function in C.
  21. What is a null pointer and how is it used?
  22. Write a C program to implement binary search.
  23. What is the use of typedef in C?
  24. Explain the difference between ++i and i++ with examples.
  25. How can you avoid buffer overflow in C?
  26. What are the advantages and disadvantages of using pointers?
  27. Write a C program to print a pattern of stars.
  28. Explain the use of goto statement in C.
  29. How do you declare and initialize a multi-dimensional array?
  30. What is the purpose of static variables in functions?
  • Write a C program to find the factorial of a number using a loop.
  • Write a C program to check if a given number is a palindrome.
  • Write a C program to sort an array of integers using bubble sort.
  • Write a C program to implement matrix multiplication.
  • Write a C program to find the greatest common divisor (GCD) of two numbers using recursion.
  • Write a C program to reverse a string using pointers.
  • Write a C program to find the sum of all elements in a 2D array.
  • Write a C program to check if a given string is a valid email address.
  • Write a C program to implement a simple calculator that performs addition, subtraction, multiplication, and division.
  • Write a C program to count the frequency of each character in a given string.
  • Write a C program to find and print the second largest element in an array.
  • Write a C program to implement a circular queue using an array.
  • Write a C program to merge two sorted linked lists into a single sorted linked list.
  • Write a C program to find the longest common substring between two strings.

Scenario-Based Questions

All the answers are after question

  1. Technical Issue Resolution
    • Scenario: You are working on a critical project, and the application you’re developing suddenly starts throwing errors in production. The team is under pressure to resolve the issue quickly.
    • Question: How would you approach diagnosing and fixing the problem? What steps would you take to ensure that the issue is resolved without causing further disruptions?
  2. Project Management
    • Scenario: You are leading a team of developers on a tight deadline for a new product launch. Halfway through the project, a key team member leaves the company, and the remaining team members are stressed about the increased workload.
    • Question: How would you handle the situation to ensure the project stays on track? What strategies would you employ to manage team morale and redistribute the workload effectively?
  3. Client Requirements
    • Scenario: A client requests a feature that seems to be outside the scope of the original project requirements and might impact the project’s deadline and budget.
    • Question: How would you handle this request? What steps would you take to communicate with the client and manage their expectations while ensuring that the project remains within scope and budget?
  4. Team Conflict
    • Scenario: Two team members have a disagreement about the approach to a problem. Their disagreement is starting to affect the team’s overall productivity.
    • Question: How would you mediate the conflict and find a resolution that maintains team harmony and keeps the project on track?
  5. System Performance
    • Scenario: After deploying a new update, you notice that the system’s performance has degraded significantly, affecting user experience.
    • Question: What steps would you take to identify and resolve the performance issues? How would you ensure that similar problems do not occur in future deployments?

Situational-Based Questions

  1. Adapting to Change
    • Situation: You are given a new technology stack to work with on a project, and you have little experience with it. The project has high visibility and is critical to the company’s success.
    • Question: How would you go about learning and adapting to this new technology quickly to ensure you can contribute effectively to the project?
  2. Handling Ambiguity
    • Situation: You are assigned to a project with vague requirements and incomplete documentation. Your manager is not available for clarification.
    • Question: How would you proceed with the project? What strategies would you use to gather the necessary information and define clear requirements?
  3. Prioritizing Tasks
    • Situation: You have multiple high-priority tasks with overlapping deadlines. One task is critical for a client presentation, while another is essential for internal performance improvements.
    • Question: How would you prioritize your tasks and manage your time effectively to meet both deadlines? What factors would influence your decision-making?
  4. Feedback Implementation
    • Situation: You receive critical feedback from a peer regarding your recent work on a project. The feedback highlights several areas for improvement.
    • Question: How would you respond to this feedback? What steps would you take to address the issues and improve your work moving forward?
  5. Resource Constraints
    • Situation: Your project is running low on resources, including both budget and personnel, and you are nearing the deadline.
    • Question: How would you handle the situation? What actions would you take to complete the project successfully despite the constraints?

Behavioral-Based Questions

  1. Problem-Solving
    • Question: Can you describe a time when you faced a significant challenge in a project? How did you approach solving the problem, and what was the outcome?
  2. Leadership
    • Question: Tell me about a time when you had to lead a team through a difficult situation. How did you motivate the team and ensure the project was completed successfully?
  3. Team Collaboration
    • Question: Describe a situation where you had to work closely with a difficult team member. How did you manage the relationship and ensure effective collaboration?
  4. Time Management
    • Question: Provide an example of how you managed multiple priorities or projects simultaneously. How did you ensure that all tasks were completed on time and to a high standard?
  5. Conflict Resolution
    • Question: Can you give an example of a conflict you encountered in the workplace and how you resolved it? What was the impact of your approach on the team or project?

Scenario-Based Questions

  1. Technical Issue Resolution
    • Answer: I would start by gathering as much information as possible about the errors, including any recent changes made to the application. I would check logs and use debugging tools to identify the root cause. Next, I would communicate with the team to discuss potential solutions and apply a fix. I would test the solution in a staging environment before deploying it to production. After resolving the issue, I would conduct a post-mortem to understand what went wrong and how we can prevent similar issues in the future.
  2. Project Management
    • Answer: I would assess the impact of the team member’s departure on the project and re-evaluate the remaining team members’ strengths and workloads. I would redistribute tasks based on their expertise and availability, and potentially bring in temporary resources if necessary. I would hold a team meeting to address concerns and boost morale, ensuring open communication and support. To keep the project on track, I would adjust timelines and priorities as needed and keep stakeholders informed.
  3. Client Requirements
    • Answer: I would first discuss the new request with the client to understand their needs and explain how it might impact the project’s timeline and budget. I would evaluate the feasibility of the request with my team and propose a revised plan that includes the new feature if possible. If the request cannot be accommodated within the original scope, I would suggest alternative solutions or a phased approach. I would document any changes to the scope and adjust the project plan accordingly.
  4. Team Conflict
    • Answer: I would arrange a meeting with the conflicting team members to understand their perspectives and the root of the disagreement. I would encourage open communication and collaboration to find a compromise or a solution that aligns with the project’s goals. If necessary, I would mediate the discussion and guide the team toward a decision. I would also monitor the team’s dynamics to ensure the conflict does not reoccur and address any underlying issues.
  5. System Performance
    • Answer: I would begin by profiling the application to identify performance bottlenecks and analyze recent changes that could have affected performance. I would use performance monitoring tools to diagnose the issue and apply optimization techniques to address the problem. After implementing the fixes, I would test the system thoroughly to ensure performance improvements. I would also review the deployment process and monitoring setup to prevent similar issues in the future.

Situational-Based Questions

  1. Adapting to Change
    • Answer: I would start by researching and learning about the new technology through documentation, online resources, and tutorials. I would seek guidance from colleagues or experts who are familiar with the technology. To quickly get up to speed, I would work on small, manageable tasks or prototypes using the new technology. I would also attend any available training sessions or workshops. By focusing on practical applications and hands-on experience, I would ensure that I can contribute effectively to the project.
  2. Handling Ambiguity
    • Answer: I would start by identifying and documenting the key aspects of the project that need clarification. I would seek input from stakeholders, review existing documentation, and reach out to colleagues who might have insights. If necessary, I would create a draft plan based on available information and outline potential areas of uncertainty. I would communicate regularly with stakeholders to get feedback and make adjustments as needed. Throughout the project, I would remain flexible and adapt to new information as it becomes available.
  3. Prioritizing Tasks
    • Answer: I would assess the urgency and impact of each task and prioritize them accordingly. I would use project management tools to organize tasks and set clear deadlines. For the critical task related to the client presentation, I would allocate dedicated time and resources to ensure it is completed on time. I would also delegate or adjust the timeline for the internal performance improvement tasks as needed. Regularly reviewing progress and adjusting priorities would help manage both tasks effectively.
  4. Feedback Implementation
    • Answer: I would approach the feedback with an open mind and view it as an opportunity for improvement. I would review the feedback carefully to understand the specific areas that need attention. I would then create an action plan to address the issues, including setting goals and deadlines for making improvements. I would seek additional input from the person who provided the feedback, if necessary, to ensure I am on the right track. Finally, I would implement the changes and follow up to ensure that the improvements meet the expected standards.
  5. Resource Constraints
    • Answer: I would start by assessing the critical tasks and determining which ones are essential for project completion. I would prioritize these tasks and identify any possible ways to streamline or optimize them. I would communicate with stakeholders about the resource constraints and renegotiate deadlines or scope if necessary. I would also look for ways to increase efficiency, such as automating repetitive tasks or seeking additional support from other departments. Regular progress reviews and adjustments would help ensure the project remains on track.

Behavioral-Based Questions

  1. Problem-Solving
    • Answer: In a previous project, I faced a challenge where our application was experiencing unexpected crashes. I started by gathering data from error logs and conducting a thorough code review. I identified a memory leak as the root cause. To solve the problem, I refactored the code to manage memory more efficiently and ran extensive tests to ensure stability. The application’s performance improved significantly, and we successfully met the project deadline.
  2. Leadership
    • Answer: As a team lead, I once managed a project where we faced a tight deadline and technical challenges. I held regular team meetings to address issues and provided support and guidance. I also recognized individual contributions and kept the team motivated by celebrating small milestones. By maintaining clear communication and focusing on team strengths, we completed the project successfully and received positive feedback from the client.
  3. Team Collaboration
    • Answer: I once worked with a team member who was challenging to collaborate with due to differing opinions on project approaches. I scheduled one-on-one meetings to understand their perspective and find common ground. I encouraged open dialogue and suggested a compromise that incorporated elements from both viewpoints. This approach improved our working relationship and allowed us to complete the project more effectively.
  4. Time Management
    • Answer: In a previous role, I managed multiple projects with overlapping deadlines. I used a project management tool to create a detailed schedule and prioritized tasks based on deadlines and impact. I set aside dedicated time blocks for each project and delegated tasks where possible. Regular check-ins and adjustments helped me stay on track and meet all deadlines without compromising quality.
  5. Conflict Resolution
    • Answer: I encountered a conflict with a colleague over differing approaches to a project. I initiated a discussion to understand their viewpoint and expressed my own concerns respectfully. We agreed to collaborate on a combined solution that addressed both perspectives. By focusing on the project’s goals and maintaining open communication, we resolved the conflict and worked together effectively.