Wednesday, August 6, 2014

Tech Test for ECE-1 RISE , GRAND TEST

GRAND TEST : RVS

1.#include<stdio.h>

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<stdio.h>

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<stdio.h>

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<stdio.h>

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<stdio.h>

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)

{

 }

main()

{

}

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 <stdio.h>

main()

{ char*str="i love java";

char*s;

while(s!=NULL)

{

puts(s);

}

}

a)i love java b)error

c)i d)i

 love

 java

19.

# include <stdio.h>

main()

{

char*str="C_lang";

printf("\n%s",strchr(str,'l'));

}

a)C_ b)l c)lang d)none

20.

# include <stdio.h>

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

{

}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;

int x;

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

Tech Test for ECE-1 RISE , TEST-3

1#include<stdio.h>

void main()

{

clrscr();

if((2==2) && printf("0") || 0)

printf("true");

else

printf("false");

}

a)true b)0true c)false d)0

----------------------------------------------------------

2.#include<stdio.h>

void main()

{

int ch='\0';

clrscr();

ch++;

while(1 && ch)

printf("%d",ch--);

}

a)NULLb)0 c)1 d)infinate loop

----------------------------------------------------------

3.#include<stdio.h>

void main()

{

int ch=NULL || EOF+1 && EOF ;

clrscr();

printf("%d",ch);

}

a)0 b)1 c)-1 d)48

----------------------------------------------------------

4.#include<stdio.h>

void main()

{ printf("a\/b=c",'%d',"%d");

}

a)a=c b)a\/b=c c)a/b=c

d)error

----------------------------------------------------------

5.#include<stdio.h>

void main()

{ clrscr();

printf("%d",1||-?('\n'==10!=0):printf("ok"));

}

a)1 b)0 c)error d)ok

6.#include<stdio.h>

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

7.#include<stdio.h>

void main()

{

clrscr();

printf("a%cb",'\\b');

}

a)a\b b)a\\b c)b d)error

8.#include<stdio.h>

void main()

{

float f=2.0;

clrscr();

printf("%d\t\t%d",a,sizeof(2.0f+2));

}

a)4 b)8 c)6 d)error

----------------------------------------------------------

9. #include<stdio.h>

void main()

{

char ch='ab';

clrscr();

do

{

}while(ch!='c'+1);}

a)abc b)ab b)abcd d)error

10. #include<stdio.h>

void main()

{

int i,no=0;

clrscr();

for(i=0;i<=5;no+=i++,i==5?

printf("%d",no):0);

}

a)15 b)10 c)100 d)150

11. #include<stdio.h>

void main()

{char ch='0a';

switch(ch)

{

case '0a':

16. #include <stdio.h>

 int main()

{

int i=10,j=9;

clrscr();

puts("\nfirst"); break;

case 48:

puts("\nsecond");break;

default:printf("wrong");

}

}

a)first b)wrong c)error d)second

12. #include<stdio.h>

void main()

{

int a=5^8;

printf("%d",a*a);

}

a)13 b)169 c)-169 d)-13

13. #include <stdio.h>

 int main()

 { int i = 0, j = 0;

 while (i < 5, j < 10)

 {

 i++; j++;

 }

 printf("%d, %d\n", i, j);

 }

a)0,0 b)5,5 c)10,10 d)error

14. #include <stdio.h>

 int main()

{ int a=7,b=2;

printf("\n%d",(int)((float)a/b-(int)a/b));

 }

a)0.5 b)0 c)0.500000 d)error

15. #include <stdio.h>

 int main() {

 }

a)1 19 b)0 18 c)1 10 d)1 19

17. #include <stdio.h>

 int main()

{

int a = 6;

int b = 12;

clrscr();

while(a<b){

printf("\n%d %d",a,b,a+=2,b-=2);

}

 }

How many loops took in the above program

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

18. #include <stdio.h>

 int main()

{ do

 }

a)a\bc b)c c)a\b d)error

if(1)

if(0);

else if(1)

printf("\nOver");

else;

 }

a)Over b)syntax missing error c)nothing d)

misplaced else

19.write a program to print

54321012345 (use only one for)

20. print

0

1 0

0 1 0

1 0 1 0

0 1 0 1 0

Tech Test for ECE-1 RISE , TEST-2

#include<stdio.h>

void main()

{

clrscr();

if((2==2) && printf("0") || 0)

printf("true");

else

printf("false");

}

a)true b)0true c)false d)0

-----------------------------------------------------------------------------------------------------------------------------

#include<stdio.h>

void main()

{

int ch='\0';

clrscr();

ch++;

while(1 && ch)

printf("%d",ch--);

}

a)NULLb)0 c)1 d)infinate loop

-----------------------------------------------------------------------------------------------------------------------------

#include<stdio.h>

void main()

{

int ch=NULL || EOF+1 && EOF ;

clrscr();

printf("%d",ch);

}

a)0 b)1 c)-1 d)48

----------------------------------------------------------------------------------------------------------------------------

#include<stdio.h>

void main()

{

printf("a\/b=c",'%d',"%d");

}

a)a=c b)a\/b=c c)a/b=c d)error

---------------------------------------------------------------------------------------------------------------------------

#include<stdio.h>

void main()

{

clrscr();

printf("%d",1||-1?('\n'==10!=0):printf("ok"));

}

a)1 b)0 c)error d)ok

#include<stdio.h>

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

#include<stdio.h>

void main()

{

clrscr();

printf("a%cb",'\\b');

}

a)a\b b)a\\b c)b d)error

#include<stdio.h>

void main()

{

float f=2.0;

clrscr();

printf("%d\t\t%d",a,sizeof(2.0f+2));

}

a)4 b)8 c)6 d)error

Tech Test for ECE-1 RISE , TEST-1

1.Which of the following is not a valid variable name declaration?

a) int __a3;

b) int __3a;

c) int __A3;

d) None of the mentioned

2. C99 standard guarantess uniqueness of _____ characters for external names.

a) 31

b) 6

c) 12

d) 14

3What is the output of this C code?

• #include <stdio.h>

• int main()

• {

• char chr;

• chr = 128;

• printf("%d\n", chr);

• return 0;

• }

a) 128

b) -128

c) Depends on the compiler

d) None of the mentioned

Answer:b

Explanation:signed char will be a negative number.

4. #include <stdio.h>

 int main()

 {

 enum {ORANGE = 5, MANGO, BANANA = 4, PEACH};

 printf("PEACH = %d\n", PEACH);

 }

a) PEACH = 3

b) PEACH = 4

c) PEACH = 5

d) PEACH = 6

5. # define X(a,b,c) a>b&&a>c?a:b>c?b:c; this macro is used to perform _____________________

6. char ch=’97’ the value of ch is ______________

7. #include <stdio.h>

 int main()

 {

 int i = 3;

 int l = i / -2;

 int k = i % -2;

 printf("%d %d\n", l, k);

 return 0;

 }

-1 , 1

8. Evaluate int x = 5 * 9 / 3 + 9;

24

• Evaluate 4*8/2+3*2/2

(19)

10. int n1=10;

 Int n2=n1+++++n1+--n1;

What is the value of n2? ________________________

11. #include <stdio.h>

 void main()

 {

 int x = 1, y = 0, z = 5;

 int a = x && y || z++;

 printf("%d", z);

 }

What it produces out put6

12. • int x = 1, y = 0, z = 3;

• x > y ? printf("%d", z) : return z;

 What is the out put ________________

13. #include <stdio.h>

 int main()

 {

 int i = 0, j = 0;

 if (i && (j = i + 10))

 //do something

 ;

 }

0

14.

int i = 0, j = 0;

if (i && (j = i + 10))

//do something

;

The value of j is 0

15.

int a = 1, b = 1, d = 1;

printf("%d, %d, %d", ++a + ++a+a++, a++ + ++b, ++d + d++ + a++);

o/p is 15,4,5

16. int a = !0;

printf("\n.....%d",a);

ans : 1