Vector India Sample paper entrance exam solution | Embedded System
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);
}
- 32
- 2
- 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++);
}
- 7
- 9
- Runtime error
- 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
}
- MAX=3, vector Institute
- MAX=3
- Vector Institute
- 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
- 8
- 2
- 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
- 2
- 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');
}
- SWITCH
- SSWILI
- SIEH!
- 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);
}
- 7
- 9
- 3
- 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);
}
- Vector
- Hello World!
- hello World! Vector
- 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);
}
- 10,0,1,2
- 10,11,100,102
- 0,1,2,3
- 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);
}
- ACB
- ACBC
- BCA
- 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);
}
- ute
- itute
- tute
- 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);
}
- 10
- 5
- 100
- 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));
}
- 2
- 4
- 1
- 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);
}
- bd
- cf
- eg
- 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));
}
- 4 1
- 6 2
- 4 2
- 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;
}
- 12
- 35
- compiler time error
- 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);
}
- 33
- 66
- 44
- 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);
}
- 4
- 5
- 9
- 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
- Learn-C.org
- C Programming at LearnCpp.com
- GeeksforGeeks - C Programming Language
- C Programming on Tutorialspoint
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!