iNautics Previous Years Solved Sample Placement Papers
-
#define AND &&
#define OR ||
#define LE <=
#define GE >=
main( )
{
char ch = 'D';
if((ch GE 65 AND ch LE 90) OR (ch GE 97 AND ch LE 122))
printf("Alphabet");
else
printf("Not an alphabet");
}
(a) No Alphabet
(b) Alphabet (Ans)
(c) Error
(d) None
-
main( )
{
int n[25];
n[0] = 100;
n[24] = 200;
printf("%d %d", *n, *(n + 24) + *(n + 0));
}
(a) 200 100
(b) 100 300 (Ans)
(c) 100 200
(d) None
-
main( )
{
int arr[] = {0, 1, 2, 3, 4};
int i, *ptr;
for(ptr = arr + 4; ptr = arr; ptr--)
printf("%d", *ptr);
}
(a) 0 1 2 3 4
(b) 4 3 2 1 0
(c) 1 2 3 4 0
(d) None (Ans)
-
main( )
{
struct employee
{
char name[25];
int age;
float bs;
};
struct employee e;
e.name = "Hacker";
e.age = 25;
printf("%s%d", e.name, e.age);
}
(a) Hacker, 25
(b) Error message (Ans)
(c) 25 Hacker
(d) None
-
#define NULL 0
main( )
{
struct node
{
struct node *previous;
int data;
struct node *next;
};
struct node *p, *q;
p = malloc(sizeof(struct node));
q = malloc(sizeof(struct node));
p->data = 75;
q->data = 90;
p->previous = NULL;
p->next = q;
q->previous = p;
q->next = NULL;
while(p!=NULL)
{
printf("%d\n", p->data);
p = p->next;
}
}
(a) 90
(b) 75 90 (Ans)
(c) 90
(d) None
-
main( )
{
int i = 3;
i = i++;
printf("%d", i);
}
(a) 3 (Ans)
(b) 4
(c) Undefined
(d) Error
-
What error would the following function give on compilation?
f (int a, int b)
{
int a;
a = 20;
return a;
}
(a) Redeclaration error (Ans)
(b) Logical error
(c) Runtime error
(d) None
-
#define sqr(x) (x * x)
main( )
{
int a, b = 3;
a = sqr(b + 2);
printf("%d", a);
}
(a) 25 (Ans)
(b) 11
(c) Error
(d) Garbage value
-
#define str(x) #x
#define Xstr(x) str(x)
#define oper multiply
main( )
{
char *opername = Xstr(oper);
printf("%s", opername);
}
(a) oper
(b) multiply (Ans)
(c) Error
(d) None
-
main( )
{
printf("%c", "abcdefgh"[4]);
}
(a) a
(b) e (Ans)
(c) Error
(d) None