Thursday, November 7, 2019

HomePage

Blinking feature using JavaScript
Click On Title To show or hide :: Ur RVS

Click Link To Follow

CTS Coding Questiond and Answers

Click Link To Follow

Wipro Coding Questiond and Answers
 
 https://drive.google.com/drive/folders/1NLFpce3ETFipVvSPHUNqdjcTPFQ-tYg5?usp=sharing
 
 TECHNICAL TRAINING TEST-I   

(1)What will be output of the following program?
#include 
int main(){
    float a=0.7;d 
    if(a<0.7){
         printf("C");
    }
    else{
         printf("C++");
    }
    return 0;
}
A)	C     B)C++    C)ERROR   D)NONE
(2)What will be output of the following program?
     
#include 
int main(){
    int I=5,j;
    j=++I + ++I + ++i;
    printf("%d %d",i,j);
    return 0;
}
A)18   B)21   C)24    D)15
(3)What will be output of the following program?
#include 
int main()
{
    int i=1;
    i=2+2*i++;
    printf("%d",i);
    return 0;
}

A)4    B) 5      C)6    D)NONE

(4)What will be output of the following program?

#include 
int main(){
    int a=2,b=7,c=10;
    c=a==b;
    printf("%d",c);
    return 0;
}

A)1   B)0   C)10   D)2

(5)What will be output of the following program?

#include 
void main(){
    int x;
    x=10,20,30;
    printf("%d",x);
    return 0;
}
A)10  B)20   C)30  D)60
(6)What will be output of the following program?
#include 
int main(){
    int a=0,b=10;
    if(a=0){
         printf("true");
    }
    else{
         printf("false");
    }
    return 0;
}
A)	true   B) false   C) syntax error   D)none
(7)What will be output of the following program?
#include 
int main(){
    int a;
    a=015 + 0x71 +5;
    printf("%d",a);
    return 0;
}
    A) 91   B)131    C)Syntax error  D)20   
 (8)What will be output of the following program?
#include 
int main(){
    printf("%d %d %d", sizeof(3.14),sizeof(3.14f),sizeof(3.14L));
    return 0;
}
A) 8  4  10   B)4  4  4   C) 8  8  4   D)4  4  10 
(9)What will be output of the following program?
#include 
int main(){
    int x=100,y=20,z=5;
    printf("%d %d %d");
    return 0;
}
A)100 20  5 B)5  20  100  C) error  D)20 100  5
(10)What will be output of the following program?
#include         
int main(){
    int a=2;
    a=a++ + ~++a;
    printf("%d",a);
    return 0;
}
A) 0   B)  1  C)-1   D) 2



(11)What will be output of the following program?

#include 
int main(){
    int a;
    a=sizeof(!5.6);
    printf("%d",a);
    return 0;
}
A) 2    B)4   C)8   D)10
12) What will be output when you will execute following c code?
#include
void main(){
     int movie=1;
     switch(movie<<2+movie){
        default:printf("3 Idiots");
        case 4: printf(" Ghajini");
        case 5: printf(" Krrish");
        case 8: printf(" Race");
     }  
}
A)3 Idiots Ghajini Krrish Race	  
B) Race

C) Krrish     D) Ghajini Krrish Race
(13)What will be output of the following program?

#include 
int main(){
     int i=7;
     int i=++i + i++ + ++i;
     printf("%d",i);
     return 0;
}
A)  27  B)28   C)21  D)24
(14)	By default a real number is treated as a
	A.Float   	B.double	
C.long double	D.far double	

  15 What will be output of the following program?
int main(){       
char f=255;
             f++;
    printf("%d",sizeof(f));
return 0;
}
 (a)1 (b)2  (c)4  (d)Compiler error
16. What will be output of the following program?
#define value 10\2
int main(){
printf("%d",value);
return 0;
}
(a)5  (b)20  (c)102 (d)Compiler error
(17) What will be output of the following program?
#define max 5
#define a max*max
#define value a\a
int main(){
    const int aa=5;
    printf("%d",value+aa);
return 0;
}

(a)5 (b)6  (c)10 (d)Compiler error
18. What will be output of the following program?
#include 
int main(){
    int a=2,b=7,c;
    c=a==b==0;
    printf("%d",c);
    return 0;
}
}
A)	0  B)  1   C) error   D) none
19. 	Which of the following are unary operators in C? 
1.	!
2.	sizeof
3.	~
4.	&&

A.1, 2        B.1,3		
C.2, 4        D.1,2,3		

20.	Which bitwise operator is suitable for checking whether a particular bit is on or off?
	A.
&& operator	B.
& operator
C.|| operator	D.
! operator


-----------------------------------------------------------------------------------------------------
TECHNICAL MCQ’s  TEST-2			
1.-*
void main()
{
 int i =0;
for( ; i<=2; )
 printf(“%d”,++i); 
}
a.0 1 2			b.0 1 2 3
c.1 2 3			d. 1 2	
2.
void main()
{
int x=6,y=3;
x/=x/y;
printf(“%d”,x);
}
a.6		b.2
c.3		d.0
3.void main()
{
  int a,b;
  a=1,3,5;
  b=(2,4,6);
  printf(“\n%d”,a+b);
}
a.3 	b.7	c.21	d. 17 
4.void main()
  {
   int a=25;
   clrscr();
   printf(“%o %x”,a,a);
  }
a.	25  25	b.025  0x25
b.	12  42 	d.31   19
5.void main(){
      int a=5,b=10,c=1;
      if(a&&b>c){
          printf("RISE");
      }
     else{
         break;  }}
a.RISE                             b)it will print nothing
c)Compilation error     d)none

6. void main(){
    int a=100;
    if(a>10)
         printf("CIVIL");
    else if(a>20)
         printf("EEE");
    else if(a>30)
           printf("CSE");
}
a.CIVIL                  	b.EEE
c.CIVIL EEE CSE   	d.CSE
7. void main(){
    int m=5,n=10,q=20;
    if(q/n*m)
         printf("William Gates");
    else
         printf(" Warren Buffet");
         printf(" Carlos Slim Helu");
}
a.William Gates	c.Runtime error
b.Warren Buffet Carlos Slim Helu d.Compilation error
e.None of the above
8.void main(){
    int a=10;
    if(printf("%d",a>=10)-10)
         for(;;)
             break;
    else;
}
Choose all that apply:
a. It will print nothing	b.0	c.1
D.Compilation error: misplaced else
9.int main()
{
    int i=5, j=-2, k=-3, m;
    m = i++ || ++j && ++k;
    printf("%d, %d, %d, %d\n", i, j, k, m);
    return 0;
}
A. 5, -2, -3, 0	B.	6, -1, -2, 0
C.6, -1, -2, 1	D.	6, - 2, -3, 1
10.int main()
{
int x=55;
printf("%d, %d, %d\n", x<=55, x=140, x>=10);
    return 0;}
A.
1, 140, 1	B.
1, 55, 1
C.
1, 55, 0	D.
0, 140, 1

11.void main()
{
  Int i=0;
  For(i=0;i<20;i++)
{
  switch(i){
default: i+=4;break;
case 0: i+=5;
case 1: i+=2;
case 5:i+=5;}
printf(“%d”,i);
}}	
a.12  17  22     b.0  5  9  13  17 c.16  21  d.5  9  13  17
12. void main()
  {
   int i=2;
   for(i=0;i++;printf(“%d”,i));
     printf(“%d”,i);
}
a.2	b.1	c.0	d.3

13.  void main()
{
int k=5^8;
printf(“%d”,k);
}
a.11	b.12	c.13	d.14
14.void main()
   {
 printf(“abcde\rABC”);
}
a.abcde		b.ABC	c.ABCde	d.abcdeABC
15.void main()
 {
int  i=20;
do{
  printf(“%d”,++i);
}while(5,4,3,2,1,0);
}
a. 20	b.21	c.21 22	d.21 22 23 24 25
16.void main()
  {
  float a=6.60,b=3.30;
 printf(“%f”,a%b);
}
a. 0	b. 2	c. error	d. none
17.void main()
{
 int i=9;
int a=5+8*6/3-2+i-- + --i;
printf(“%d”,i);
}
a.9     b.35	c.7	d.36

18. void main()
{
printf(“%d,%g,%g”,5/2,5.5/2,(float)5/2);
}
a. 2  2.75 2.5	b.2  2.75  2	c. 2  2.75  2 d.error
19.which of the following statement is wrong
1. 5+5=a;		2.ss=12.25;
3.st=’m’*’b’;		4.is=’a’+10;

a. 3,4		b.1,3,4		c.1	d.3

20.
# define N   >90
# define  M  >80
Void main()
{
int x=10,p;
p=x*5N;
p=p+90M;
printf(“%d”,p);
}
a.	0	b.90	c.80	d.1


21. Write a  Program for floyd’s triangle
	1
	2	3	
	4	5	6
	7	8	9	10
	11	12	13	14	15
-----------------------------------------------------------------------------------------------------------
 TECHNICAL TEST3   

1.#include
int main(){
    int i,j;
    i=j=2,3;
    while(--i&&j++)
         printf(" %d%d",i,j);
    return 0;
}
a)13	b)none	c)13 04 4)23

2. int main()
{
	int i=1,n;
	clrscr();
	for(i=0,n=0;i<=5;i++,n+=i);
	printf("%d",n);
}

a)15	b)21	c)garbage	d)none

3. 
main()
{
if(‘\0’);
else if(NULL)
printf(“RISE”);
else;
}
a)Misplaced else error	b)RISE
c)Nothing	d)if can’t end error

4.int main()
{
	int i,no[5]={{0},2,{0}};
	clrscr();
	for(i=0;i<=4;i++,no[i]=i)
	printf("%d  ",no[i]);

}
a.0 1 2 3 4			b. 0 3 2 3
c.Compilation error	d.1 2 3 4 5

5.int main()
{
char c=125;
do
printf("%d ",c);
while(c++);
return 0;
}
a)finite loop prints 125,126,127,128,129…	
b)infinite loop c)compilation error d)finate loop prints 125,126,….0
6.main()
 {
 int a,d;
 char b; 
float c;
printf(“Enter 3 values:”);
d=scanf(“%d%f%c”,&a,&b,&c)
printf(“%d”,d);
}
What is the d value if we enter a b c values as 12  C  34.8

a)3  b)2  c)1   d)error

7.main()
{
  int a;
   printf(“%d”,scanf(“%3d”,&a);  
  printf(“%3d,a);
getch();
}
What is out of this program if we read  a value as 8745
a)1   8745   b)2   8745   c)1   874   d)2   874


	8.What will be the output of the program ? 

#include
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  %d", i, j, m,a[1]);
    return 0;
}
a.2,1,15,2	b.1,2,5,3
c.3,2,15,3	d.2,3,20,2
9.main()
{
  char str2[20]=”CTECHTEST3”;
clrscr();
printf(“%s   %s   %s  ”,str2,str2+1,str2+5)
}
a.CTECHTEST3   CTECHTEST3  CTECHTEST3
b.CTECHTEST3   TECHTEST3    TEST3
c.CTECHTEST3    CTECHTEST   CTECH
d.ERROR

10. main()
{
  char a[]=”%d\n”;
  clrscr();
a[1]=’c’;
printf(a,68);
getch();
}
a)68  b)D  c)%c  d)%d\n  e)error

11.
main()
{
	printf(“%d”,10?0?5:1:12)
}
a) 1	b)12	c)12	d)0

12. void main()
{
int a=2;
if(a==2)
a=~a+2<<1;
printf(“%d”,a)
}

a.	It will print nothing
b.	-3
c.	-2
d.	1
13.void main()
{
int const size=5;
double  value[size]={1.0,5.0,7.0,,8.0,12.0};
exp=1|2|3|4;
printf(“%f”,value[exp]]
}
a. 12.0	b.8.0	c.error	d.none
14. #include
main()
{
  char not=EOF;
  clrscr();
  printf("\n%d",not);
}
a. 0	b.error	 c.1	d.-1
15.
 main()
{
 char not;
int i;
i=not!=2;
printf(“%d”,i,not);
}
a.0		b.2
c.-2		d.compile time error


16.What will be output of following c code?
         
#include
int main(){
    int i=2,j=2;
    while(i+1?--i:j++)
         printf("%d",i);
    return 0;
}
a.0	b)1	c)-1	d)0 1 

17.
#include
int main(){
    static int i;
    for(++i;++i;++i) {
         printf("%d ",i);
         if(i==4) break;
    }
    return 0;
}
a)24	b)error	c)01	d)04




18.
int main()
{
int i=4;
clrscr();

do{
    printf("%d ",--i,i);

   } while(5,4,3,2,1,i);

    return 0;
}
a)41	b)40	c)error	d)3 2 1 0 e)none

19.
# include 
main ()
{
int no=1000;
while (printf ("%d ",no, no/=10)-1);
}
a) 1000100101		b)100101

c) indefinateloop	d)error

20.
# include 
main()
{
    int i=5;
    clrscr();
    while(i>=1?i--:0)
    printf("%d ",i);
                 printf("%d ",++i);
}
a)5 4 3 2 1 0  b)4 3 2 1 0 1   c)5 4 3 2 1	d)error
----------------------------------------------------------------------------------------------------------
  MCQ's ( 30q each 1 mark)

1) 
main(){
printf("%d  %d   %d",sizeof(400L),sizeof(400)
,sizeof(400.0));
a)4 2 8     b)2  2 4      c)2 2 8     3)error

2)
char ch='xy';
val of ch is?
a)y         (b)x            c)none      d)NULL

3)
main()
{
int x;
x=10,20,30;
printf("%d",x);
}
a)30   b)20    c)10   d)error;
4)
main()
{
int a=117;
printf("%x",a);
}
a)75     b)117   c)error   d)0
5)
main(){
enum    bykes{suzuki,honda=3,hero};
printf("%d",suzuki+hero);
}
a)4       b)2       c)6     d)error
6)
Main()
{
int a=3,b=7,c;
c=a==b==1;
printf("%d",c);   
}
a)1           b)0        c)3      d)7
7)
#  define max (a,b)    a/b
Main() {
Printf(“\n%d”,max(10,3));
}
a)	3   b)3.333  c)3.333333  d)error


8) .what will be the output of the program? 
#include
int main()
{
    int k, num = 30;
    k = (num < 10) ? 100 : 200;
    printf("%d\n", num);
    return 0;
}
a)200    b)30    c)100     d)500

9).what are the invalid identifiers?
a.DOUBLE
b.Int
c.Float
d.all above


10) what will be the output of the program?
void  main()
{
int x;
x=015+0x71+5;
printf(“%d”,x);
}
a.13
b.131
c. compiler error
d.9

11). float f=10.3456F; int x=f;
 what was the value of x?
A.  10.3
B.  10
C.  10.345
D.  10.346

12)
int i=5; 
int j; 
j=++i + ++i + ++i; 
printf("%d",j);
A.  21
B.  18
C.  24
D.  15

13). 
int a=0,b=1; 
if(a=0)
 { printf("\ntrue"); }
 else
 { printf("\nfalse"); }
A.  none
B.  true
C.  syntax error
D.  false
14)
printf(" %d %d %d",sizeof(3.14) , sizeof(3.14F), 
sizeof(3.14L));
A.  8 4 10
B.  4 4 4
C.  8 8 8
D.  4 4 10
9
15)which of the following are unary operators
 1. !     2. sizeof      3. ~        4. &&
A.  1,2
B.  1,3
C.  1,2,3
D.  2,4

16)char f=255; f++; printf("%d ",sizeof(f));
A.  2
B.  4
C.  compilation error
D.  1
17)
int a; a=sizeof(!5.6); printf("%d",a);
A.  2
B.  4
C.  10
D.  8
18)
void main()
{
	float x=10.2345F;
	int a;
	clrscr();
	a=x-(int)x;
	printf("\n%f",(float)a);
}
a)10.234500		b)0.000000		c)error			d)10.2345

19) 3.#include
void main()
{
	int ch=NULL || EOF+1 && EOF ;
	clrscr();
	printf("%d",ch);
}
a)0	b)1	c)-1	d)48
20)
12. #include
void main()
{
	int a=5^8;
	printf("%d",a*a);
}
a)13	b)169	c)-169	d)-13
21)
#include 
        int main()	{
		if(1)
		if(0);
		else if(1)
		printf("\nOver");
		else;
        }
a)Over	 b)syntax missing error   c)nothing d)misplaced else

22)
1.#include
int main(){
    int i,j;
    i=j=(2,3),0;
    while(--i&&j++)
         printf(" %d %d",i,j);
    return 0;
}
a)1 3	b)none	 c)13  02  d)24 25

23)
. int main()
{
	int i=1,n;
	clrscr();
	for(i=0,n=0;i<=5;n+=i++);
	printf("%d",n);
}

a)25	b)21	c)garbage	d)15
24)
#include
main()
{
  char not=!EOF;
  clrscr();
  printf("\n%d %d",EOF,not);
}
a. 0 0	b.error	 c.-1 0	d.-1 1

25)
Int a=2;
a=a++ + ~++a;
a value is?
a)	0         b)1   c)-1   d)2

26)
 void main()
	{           while(1,2,'a',0)
		{
			printf("abc");
		}
		printf(" def");
	}

a)abc def   b)error   c) def   d)abc abc abc def
27) void main()
{
int a=4,b=6;
if(++a==--b && 1)
printf("\ntrue");
else;
printf(" false");
}
a)true   b)false   c)true false  d)error
28)
main()
{
	printf(“RISE_ONGOLE”+4);
}
a)	   RISE     b)RISE_    c)_ONGOLE   d) error

29)main()
{
enum {india,is=7,great};
printf(“%d%d”,india,great);
}
a)	7 1  b)7 8        c) 1  2    d)erro



30)  main() {
printf(“%d”,7>3>2?10:20<4?0:1);
a)	0    b) 1    c)  10      d) error
-------------------------------------------------------------------------------------------------------------
50 MCQ’S on C
1.	What would be the value of i and k?
main(){
int i,j=5,k;
i=2*j/2;
k=2*(j/2);
}
A. 5 4       B. 4 4       C. 4 5       D. 5 5      
2.	What is the output of the following program?
main(){
int i=-1;
printf(“i=%d,-i=%d”,i,-i);
}
A. i=1 -i=-1       B. i=-1 -i=-1       C. i=-1 -i=1       D. i=1 -i=1      
3.	What is the output of the following program?
main(){
int i=10,j=40;
if((j-i)%10)
printf(“True”);
else
printf(“False”);
}
A. True       B. False       C. Error       D. None      
4.	What is the output of the following program?
main(){
char ch[]={‘e’,’n’,’d’,’\0’,’p’};
printf(“%s”,ch);
}
A. 'e' 'n' 'd'       B. 'e' 'n' 'd' '\0' 'p'       C. end\0p       D. end      
5.	What is the output of the following program?
main(){
int i;
for(i=1;i<5;i++);
printf(“Hello”);
}
A. print Hello 5 times       B. Hello       C. Error       D. None  
6.	What is the output of the following program?
main(){
int x,y=2,z,a;
x=(y*=2)+(z=a=y);
printf(“%d”,x);
}
A. 2       B. 4       C. 6       D. 8      
7.	What are the values of x,y,z after executing the following statements?
int x=6,y=8,z;
y=x++;
z=++x;
A. 8 6 8       B. 6 6 6       C. 8 8 8       D. 6 8 6      
8.	What is the output of the following program?
main(){
printf("%d",printf("Hello"));
}
A. Hello5       B. Hello       C. Error       D. None      
9.	What is the output of the following program?
main(){
char x=-256;
printf(“%d”,x);
}
A. Error       B. -256       C. 256       D. 0      
10.	What is the output of the following program?
main(){
int i=4,j=20;
if(i=5||j>50)
printf(“Hello”);
else
printf(“Hi”);
}
A. Hello       B. Hi       C. Error       D. None
11.	What is the output of following program?
#include
double i;
int main(){
(int)(float)(char) i;
printf("%d", sizeof((int)(float)(char)i));
}
A. 1       B. 4       C. Compiler Error       D. None      
12.	What is the output of following program?
#include
#define X a##b
int main(){
int a=2,b=3,ab=5;
printf("%d", a+b+X);
}
A. Compiler Error       B. 2       C. 3       D. 10      
13.	What is the output of following program?
#include
#define square(x) x*x
int main(){
printf("%d", square(2+3));
}
A. 11       B. 25       C. 4       D. 9      
14.	What is the output of following program?
#include
static int i=5;
int main(){
int i=2,j,k;
j=i++;
k=++i;
printf("%d,%d,%d",i,j,k);
}
A. 7 5 7       B. 7,5,7       C. 4,2,4       D. 4 2 4      
15.	What is the output of following program?
#include
int main(){
int k=1;
printf("%d == 1 is" "%s\n", k, k==1?"True":"False");
}
A. 1 == 1 is True       B. 1 == 1 is False       C. Compiler Error       D. None    
16.	What is the output of following program?
#include
int main(){
int i;
printf("%d\n", scanf("%d", &i));
}
A. 0       B. 1       C. 2       D. 4      
17.	What is the output of following program?
#include
int main(){
printf(6-2+"RISE_KRISHNA_SAI");
}
A. RISE_KRISHNA_SAI       B. _KRISHNA_SAI       C. Compiler Error       D. None      
18.	What is the output of following program?
#include
#include
int main(){
char clg1[5]="rpra",clg2[5]="rgan";
printf("%d",strcmp(clg1,clg2));
}
A. -1       B. 0       C. 1       D. None      
19.	What is the output of following program?
#include
int main(){
char name=255;
printf("%d",name);
}
A. 0       B. 1       C. -1       D. None      
20.	What is the output of following program?
#include
int main(){
int i=1;
for(;i<10;i++);
printf("%d",--i);
}
A. 10       B. 9       C. Compiler Error       D. None 
21.	operating system designed using C programming language.
A. DOS       B. Windows       C. UNIX       D. Mac      
22.	Which of the following variable cannot be used by switch-case statement?
A. char       B. int       C. float       D. double      
23.	The prototype of a function can be used to
A. Define a function       B. Declare a function   C. Erase a function       D. None of the above      
24.	To print a double value which format specifier can be used?
A. %L       B. %lf       C. %LF       D. None      
25.	Which of the following is a logical operator?
A. !       B. &&       C. ||       D. All the above  
26.	Which of the following is used in mode string to open the file in binary mode?
A. a       B. b       C. B       D. bin      
27.	Which of these is an invalid dataname?
A. wd-count       B. wd_count       C. w4count       D. wdcountabcd      
28.	Which of the following is the correct usage of conditional operators used in C?
A. a>b ? c=30 : c=40;	B. a>b ? c=30;	C. max = a>b ? a>c?a:c:b>c?b:c  D. return (a>b)?(a:b)      
29.	Which of the following data type uses %e format specifier?
A. int       B. float       C. char       D. double      
30.	Which of the following format specifier is used for unsigned char?
A. %c       B. %u       C. %uc       D. None
31.	What will be the output of the program?
main(){
  if(1,0) printf("RISE");
}
A. RISE       B. No Output       C. Compile Error       D. Runtime Error      
32.	What will be the output of the program?
int main(){
  int a=9,b=7,c=5;
  printf("%d %d %d");
}
A. 9 7 5       B. 0 0 0       C. Garbage Value       D. Compile Error      
33.	What will be the output of the program?
int main(){
  float a;
  (int)a= 88;
  printf("%d",a);
}
A. 88       B. 88.00       C. 0       D. Compile Error      
34.	What will be the output of the program?
int main(){
  int a;
  a=sizeof(!3.14);
  printf("%d",a);
}
A. 0       B. 1       C. 4       D. 8      
35.	What will be the output of the program?
int main(){
  int x=10,y;
  y=(x++, printf("%d ",x),++x,printf("%d ",x),x++);
  printf("%d ",y);
  printf("%d",x);
}
A. 10 11 12 13       B. 10 11 11 12       C. 11 12 12 13       D. Error      
36.	What will be the output of the program?
int main(){
  int a=2,b=2,c=10;
  c=c!=a==b;
  printf("%d",c);
}
A. 10       B. 0       C. 1       D. Error      
37.	What will be the output of the program?
int main(){
  int i=2;
  switch(i){
  case 1:printf("RISE");
  break;
  case 2:continue;
  printf("Code");
  case 3:printf("Test");
  break;
  }
}
A. RISE       B. Code       C. Test       D. Compile Error      
38.	What will be the output of the program?
int main(){
  int i=5;
  printf("%d" "%d" "%d",i,i<<=2,i>>=2);
}
A. 000       B. 555       C. 444       D. Compile Error      
39.	What will be the output of the program?
int main(){
  int i=3;
  int l=i/-2;
  int k=i%-2;
  printf("%d %d",l,k);
}
A. 1 -1       B. -1 1       C. 1 1       D. -1 -1      
40.	What will be the output of the program?
int main(){
  int x=1,y=0,z=3;
  x>y?printf("%d",z):return z;
}
A. 0       B. 1       C. 3       D. Compile Error
41.	What is the output of the following program?
#include
main(){
  int i = 1;
  while(++i <= 5)
  printf("%d ",i++);
}
A. 1 3 5       B. 2 4       C. 2 4 6       D. 2      
42.	What is the output of the below code snippet?
#include   
main(){
  int a = 5, b = 3, c = 4;
  printf("a = %d, b = %d", a, b, c);
}
A. a=5, b=3       B. a=5, b=3, c=0       C. a=5, b=3, 0       D. Compile Error      
43.	What is the output of the following code snippet?
#include
main(){
  short unsigned int i = 0;
  printf("%u", --i);
}
A. 0       B. -1       C. 65535       D. 32767      
44.	What is the output of the following program?
#include
main(){
  char *p = NULL;
  printf("%c", *p);
}
A. NULL       B. 0       C. Compiler Error       D. Runtime Error      
45.	What is the outpout of the following program?
#include
main(){
  enum { india, is=7, GREAT };
  printf("%d %d", india, GREAT);
}
A. 0 1       B. 0 2       C. 0 8       D. Compiler Error      
46.	What is the output of the following program?
#include
void f(int a[]){
  int i;
  for(i=0; i<3; i++)
  a[i]++;
}
main(){
  int i,a[] = {10, 20, 30};
  f(a);   for(i=0; i<3; ++i)
  printf("%d ",a[i]);
}
A. 10 20 30       B. 11 21 31       C. Compiler Error       D. Runtime Error      
47.	What is the output of the below code snippet?
#include
main(){
  char s[]="hello", t[]="hello";
  if(s==t) printf("eqaul strings");
}
A. equal strings       B. unequal strings       C. No output       D. Compiler Error      
48.	What will be the output of the program?
#include
int main(){
  int y=128;
  const int x=y;
  printf("%d", ++x);
}
A. 128       B. Garbage value       C. Error       D. 0      
49.	What will be the output of the program?
#include
  int main(){
  printf("%d",125/20&&30%5);
}
A. 0       B. 1       C. Garbage Value       D. Compile Error      
50.	What will be the output of the program?
#include
  int i=0;
  int main(){
  printf("%d",5+7&&i<<10?12:i*10);
}
A. Compile Error       B. Garbage Value       C. 12       D. 0

-----------------------------------------------------------------------
TEST : RVS   (25 questions)

1.#include
int main(){
	int no[2][2]={{0},{1,2}};
	clrscr();
	printf(‘%d’,no[0][0]);
}
a)0	b)nothing	c)error	d)1

2.#include
int main()
{
	int no[][3]={{0},{1,{2},3}};
	clrscr();
	printf("%d",no[0][0]);
}
a)error	b)nothing	c)0	d)3
3.#include
int main()
{
	int i=10;
	int no[2][4]={1,0,2};
	clrscr();
	printf("%d",sizeof(no));

}
a)6	b)8	c)2	d)16
4.#include
int main()
{
	int i=-1;
	int no[3][3]={{1,2,3},{4,5,6},{7,8,9}};
	clrscr();
	for(i++;i<=2;i++)
	printf("%d,",0[no[i]]);

}a)1,2,3	b)1,5,9	c)1,4,7	  d)
5.#include
int main()
{
	int i=-1;
	int no[3][3]={{1,2,3},{4,5,6},{7,8,9}};
	clrscr();
	for(i++;i<=2;i++)
	printf("%d,",1[0[no]]);
}
a)2,2,2   b)4,5,6    c)5,5,5     d)4,4,4
6.
main(){
 char*str=”I love java”;
str=str+3;
printf(“%s”,str);
}
a.i love java	b)error   c)ove java    d)ve java
7.
main(){
char*s[3]={”I love java”,”C++”,”MySQL”};
char**str;
str[0]=s[0];
printf(“%s”,s[0]);
}
a)error   b)i love java   c)I     d)null
8.void main()
{
char *s="\123\n";
printf("%d",sizeof(s));
}
a)4   b)2    c)6     d)error
9.void main()
{
int i;
clrscr();
for(i=1;i<4;i++)
switch(i)
{
switch(i+1)
case 1: printf("%d",i);break;
{
case 2:printf("%d",i);break;
case 3:printf("%d",i);break;
}
switch(i);
}
}
a)23   b)error     c)123    d)234
10.
struct student
{
	Intsno;
	Float fee;
	floatwt;
}
main()
{
	Structstudent  s={100,2000.50};
Printf(“\n%d\t%f\t%f”,s.sno,s.fee,s.wt);
}
a)error     b)100 2000.50 0.000000  c)100 2000.50     d)none
11.
union un
{
	int no;
	char name[20];
};
main()
{
	Union  un  u;
	u.no=100;
	strcpy(u.name,”xxxx”);
printf(“%d%s”,u.no,u.name);
}
a)100  xxxx   b)100  garbage    c)error
d)garbage xxxx
12.
Intsquare(int x)
{
	return x*x;
}
Which function pointer points  statement is correct to point above function.
a)	Int (*fptr)(int)     b)int (fptr*)
c)int (fptr)(int*)    e)none
13.
typedef  char   names[20];
which statement is correct
a)	Typedef names n;    b)names n
c)names:n     d)none

14.
update(int*p)
{
	*p+=10;
}
main()
{
	Int x=10;
	update(&x);
printf(“%d”,x);
}
a)10    b)ref error     c)20    d)20
15.
struct  test
{
	Int x;
Int y;
};

main()
{
	struct test t[2];
	test[0].x=test[0].y=10;
	test[1]=test[0];
	printf(“%d\t%d”,test[1].x,test[1].y);
}
a)error    b)10 10    c)garbage values    d)none

16.  max2(inta,intb,charch)
	{
		If(ch==’b’)
		return a>b?b:a;
		return (int)ch;
               }
main()
{
	Printf(“%d”,max2(10,20,’a’))
}
a)10     b)20    c)a      d)97   
	17. enum color{RED,GREEN=3,BLUE};
main()
{
struct bfield
{
	unsigned type:3;
};

	struct bfield b;
	b.type=BLUE;
	printf("\n%d",b.type);
}a)4     b)3        c)5     d)error

18.# include 
main()
{	char*str="i  love java";
	char*s;
	while(s!=NULL)
	{
		s=strtok(str," ");
		str=str+strlen(s)+1;
		puts(s);
	} 
}
a)i love java     b)error
c)i		d)i
   love
   java
19.
# include 
main()
{
	char*str="C_lang";
	printf("\n%s",strchr(str,'l'));
}
a)C_	b)l    c)lang      d)none
20.
# include 
main()
{
	char*str="C_lang";
	printf("\n%s",memset(str,'x',4));
}
a)ng      b)xxxxng      c)0000ng     d)x0ffng
21. struct a
{	struct b
	{
		int x;
	}B;
int x;
};
main()
{
	struct a A={100};
	A.B.x=A.x=10;
	a.x=111;
	printf("\n%d",A.B.x);
}
a)100   b)10   c)error    d)111
22.
main()
{
	const  int y=111;
	int*x;
	x=y;
	printf("%d ",*x);
	x=&y;
	*x+=1;
	printf("%d",*x);
}
a)111  112  b)address   112   c)error     d)none
23.
main()
{
	struct a
	{	int x,y;
	}z={10,20};
	fun1(z);
}
fun1(struct   a  B)
{
	B.x=100;
	printf("%d",B.x);
}
a)100   b)10    c)error     d)none
24.
main()
{
	char *s[]={"ongole","chennaai","ooty"};
	printf("\n%d",*(*(s+2)+1));
}
a)c      b)99     c)error    d)111
25.
main()
{
	char *s1="c";
	char*s2="c++";
	clrscr();
	printf("%c",*s1+*s2-76);
}
a)y        b)z      c)error     d)z


Click Link To Follow

First Yr R19 C Lab
First Yr C Sample Questions Theory

1 comment:

  1. Java Vogue is a good resource for learning java online.There you can learn java , java8 , android , spring , spring boot , hibernate , react , angular , mysql etc.. with simple examples
    Java Vogue
    Java Tutorials
    Java8 Tutorials
    Spring boot tutorials
    Spring tutorials
    Hibernate tutorials
    ReactJs Tutorials
    Interview Question
    Collection In Java
    Top Program for interview

    ReplyDelete