Vector India Sample paper entrance exam solution | Embedded System

23 Aug 2021 Balmiki Mandal 0 µC - µP

Vector India Sample Paper Entrance Exam Solutions

C-PROGRAMMING LANGUAGE  

 

Q. Find The output of this C Perogram

#include
 main()
{
int a=4,b=2;
a=b<>2;
printf("%d", a);
}
  1. 32       
  2. 2     
  3. 4         
  4. None

Ans-> 32

 

 

Q. Find The output of this Malloc related C Perogram 

#include
int main()
{
int *ptr=(int*)malloc(sizeof(int));
*ptr=4;
printf("%d",(*ptr)+++*ptr++);
}
  1. 7   
  2. 9
  3. Runtime error     
  4. None

Ans-> b) 9  we can consider this value as the final result 9

 

Q. Find The output of this Typedef related C Perogram 

#include
#define MAX 3
int main()
{ 
 printf("MAX = %d \n",MAX );
 #undef MAX
 #ifdef MAX
 printf("Vector Institute”);
 #endif
}
  1. MAX=3, vector Institute     
  2. MAX=3         
  3. Vector Institute         
  4. Compiler time Error

Ans-> B)MAX=3

 

Q. Find The output of this Array related C Perogram 

#include
int array[]={1,2,3,4,5,6,7,8};
#define SIZE (sizeof(array)/sizeof(int))
int main()
{ 
if(-1<=SIZE) printf("1");
else printf("2");
}
  1. 1         
  2. 8           
  3. 2               
  4. 4

Ans-> c)2

 

Q. Find The output of this Array related C Perogram 

#include
int main()
{ 
int ptr[] = {1,2,23,6,5,6};
printf("%d",&ptr[3]-&ptr[0]);
} 
  1. 1       
  2. 2            
  3. 4       
  4. none

Ans->  d)none

Note:- The output of the program is 3.

 

Q. Find The output of this Switch case related C Perogram

#include
int main()
{ 
char input[] = "SSSWILTECH1\1\1";
int i, c;
for ( i=2; (c=input[i])!='\0'; i++) {
switch(c) {
case 'a': putchar ('i'); continue;
case '1': break;
case 1: while (( c = input[++i]) != '\1' && c!= '\0');
case 'E': case 'L': continue;
default: putchar(c);continue;
}
putchar(' ');
}
putchar('\n');
}
  1. SWITCH 
  2. SSWILI      
  3. SIEH!       
  4. Compile time error

Ans-> a) SWITCH

Note: -The output of the program will be "W I T C H" (without the quotes) because it skips over the 'S', 'S', 'S', 'I', 'L', '1', '\1', and '\1' characters and prints the remaining characters with a space between them.

 

Q. Find The output of this 2D array related C Perogram

#include
int main()
{ 
int a[3][4] ={1,2,3,4,5,6,7,8,9,10,11,12} ;
int i, j , k=99 ;
for(i=0;i<3;i++)
for(j=0;j<4;j++)
if(a[i][j] < k) k = a[i][j];
printf("%d", k);
}
  1. 7   
  2. 9               
  3. 3                     
  4. 1

Ans-> d) 1

Note: The output of the program will be "1" (without the quotes) because the nested for loop iterates through each element of the "a" array in row-major order and sets "k" to the smallest value it finds, which is 1.

 

Q. Find The output of this address related C Perogram

#include
int main()
{
char p[] = "hello world!";
*p = "vector";
printf("%s",p);
}
  1. Vector   
  2. Hello World! 
  3. hello World! Vector   
  4.  none

Ans-> None

 

Q. Find The output of this Enum related C Perogram

#include
int main()
{ 
enum _tag{ left=10, right, front=100, back};
printf("%d, %d, %d, %d", left, right, front, back);
}
  1. 10,0,1,2     
  2. 10,11,100,102       
  3. 0,1,2,3         
  4. none
Ans-> b) 10 11,100,102
 

 

Q. Find The output of this Switch case related C Perogram

#include
int main()
{
char as[] = "\\0\0";
int i = 0;
do{
switch( as[i++])
{
case '\\' : printf("A");
break;
case 0 : printf("B");
break;
default : printf("C");
break;
}
}
while(i<3);
}
  1. ACB   
  2. ACBC     
  3. BCA         
  4. CBAC
Ans-> a) ACB
 
 

Q. Find The output of this Switch case related C Perogram

#include
int main()
{
FILE *fs;
char c[10];
fs = fopen("source.txt", "r"); /* source.txt exists and contains “Vector Institute” */
fseek(fs,0,SEEK_END);
fseek(fs,-3L,SEEK_CUR);
fgets(c,5,fs);
puts(c);
}
  1. ute     
  2. itute       
  3. tute         
  4. none

Ans-> d) None

 

Q. Find The output of this conditional operator related C Perogram

#include
int main()
{
int a=10,b;
b=a>=5?100:200;
printf("%d\n",b);
}
  1. 10     
  2. 5     
  3. 100         
  4. 200

Ans->  c) 100

 

Q. Find The output of this Extern related C Perogram

#include
int main()
{
extern int i;
i=20;
printf("%d\n",sizeof(i));
}
  1. 2     
  2. 4     
  3. 1         
  4. none

Ans-> d) None

 

Q. Find The output of this Switch case related C Perogram

#include
int main()
{
int i = 10;
printf(" %d %d %d \n", ++i, i++, ++i);
}
  • 11 11 13   
  • 13 11 11   
  • 11 12 13       
  • 13 12 11

Ans-> b) 13 11 13

 

Q. Find The output of this do while related C Perogram

#include
int main()
{
unsigned int k = 987 , i = 0;
char trans[10];
do {
trans[i++] =(char) (k%16 > 9 ? k%16 - 10 + 'a' : '\0' );
}
while(k /= 16);
printf("%s\n", trans);
}
  1. bd     
  2. cf     
  3. eg         
  4. none

Ans-> a) bd

 

Q. Find The output of this Switch case related C Perogram

#include
int main()
{
struct test
{
char c;
int i;
char m;
}t1;
printf("%d %d\n", sizeof(t1), sizeof(t1.c));
}
  1. 4 1     
  2. 6 2     
  3. 4 2       
  4. none

Ans->  d)none

Note: real output is 12 1

 

Q. Find The output of this Switch case related C Perogram

#include
int main()
{
printf("%x",-1<<4);
}
  • FF00   
  • FFFF     
  • FFF0       
  • compiler time error

Ans-> FFF0

 

Q. Find The output of this Switch case related C Perogram

#include
int main()
{
int var1=12, var2=35;
printf("%d",max(var1,var2));
}
int max(int x, int y)
{
x>y?return x:return y;
}
  1. 12     
  2. 35     
  3. compiler time error         
  4. run time error

Ans-> D) run time error

 

Q. Find The output of this Switch case related C Perogram

#include
int main()
{ 
int x, arr[8]={11,22,33,44,55,66,77,88};
x=(arr+2)[3];
printf("%d",x);
}
  1. 33     
  2. 66     
  3. 44         
  4. 77
Ans->  b) 66

 

Q. Find The output of this Switch case related C Perogram

#include
struct tag{
auto int x;
static int y;
};
int main()
{
struct tag s;
s.x=4;
s.y=5;
printf("%d",s.x);
}
  1. 4     
  2. 5     
  3. 9       
  4. none

Ans->  d)none

Additional Resources


[ vector india entrance exam solution 2021: C-programming ]

[ vector india entrance exam solution 2021: Digital electronic ]

[ vector india  entrance exam solution 2021:Micro Processor (8085/8086) ]

[ Vector India Sample paper entrance exam solution ]

 

Further Reading:

 For further information and examples, Please visit[ C-Programming From Scratch to Advanced 2023-2024]

 

Top Resources


click here to watch videos

Note: If you encounter any issues or specific errors when running this program, please let me know and I'll be happy to help debug them!

BY: Balmiki Mandal

Related Blogs

Post Comments.

Login to Post a Comment

No comments yet, Be the first to comment.