What will be output when you will execute following c code?#include void main() { signed int a = - unsigned int b = -1u; if(a == b) printf( "The Lord of the Rings" ); else printf( "American Beauty" );}
The Lord of the Rings
American Beauty
Compilation error: Cannot compare signed number with unsigned number
Warning: Illegal operation
Q.8.
Public abstract interface Frobnicate { public void twiddle(String s); } Which is a correct class?
public abstract class Frob implements Frobnicate { public abstract void twiddle(String s) { } }
public abstract class Frob implements Frobnicate { }
public class Frob extends Frobnicate { public void twiddle(Integer i) { } }
public class Frob implements Frobnicate { public void twiddle(Integer i) { } }
Q.9.
How many times i value is checked in the below code? #include int main() { int i = do { i++; printf( "In while loopn" ); } while (i < 3); }
2
3
4
1
Q.10.
What is the output of this C code? #include void main() { int x =z = int y = x
-2147483648
-1
Run time error
8
Q.11.
Output of the Program : main() { int i =while (i goto here; i++; } } fun() { here : printf( "PP" ); }
1
2
Compilation error
Exception occurs
Q.12.
Which Of The Following Statements Is Most Accurate For The Declaration X = Circle()?
x contains a reference to a Circle object
You can assign an int value to x
x contains an object of the Circle type
x contains an int value
Q.13.
What will be output of the following c program ? #include int main() { int max-val= int min-val= int avg-val; avg-val =( max-val + min-val ) / printf( "%d", avg-val ); return}
55
105
60
Compilation error
Q.14.
What will be output of following program ? #includeint main() { int a = 10;void *p = &a;int *ptr = p;printf("%u",*ptr);return}
10
Address
2
Compilation error
Q.15.
What is the result after execution of the following code if a isb isand c is 10?
a = 10, c = 10
a = 11, c = 10
a = 10, c = 11
a = 11, c = 11
Q.16.
What will output when you compile and run the following code?#include struct student{ int roll;int cgpa;int sgpa[8]; }; void main(){ struct student s = { 12,8,7,2,5,9 };int *ptr;ptr = (int *)&s;clrscr();printf( "%d", *(ptr+);getch(); }
8
7
2
Compiler error
Q.17.
What would be the output of the following program ? main() { const int x = int *ptrx; ptrx = &x; *ptr = printf ("%d", x); }
5
10
Error
Garbage value
Q.18.
What will be output of following program?#include int main() { void (*p)(); int (*q)(); int (*r)(); p = clrscr; q = getch; r = puts; (*p)(); (*r)("www.sawaal.com"); (*q)(); return 0;}
NULL
www.sawaal.com
Compilation error
None of above
Q.19.
If the following program (myprog) is run from the command line as myprog 1 2what would be the output? main(int argc, char *argv[]) { int i, j = for (i =i < argc ; i++) j = j + atoi ( argv[i]); printf ("%d", j); }
123
6
Error
"123"
Q.20.
What would be the output of the following program ? main() { unsigned int a = oxffff; ~a; printf ("%x", a); }
ffff
0000
00ff
None of the above
Support mcqgeeks.com by disabling your adblocker.
Please disable the adBlock and continue. Thank you.