MCQGeeks
0 : 0 : 1
CBSE
JEE
NTSE
NEET
English
UK Quiz
Quiz
Driving Test
Practice
Games
Quiz
Computer Science
Programming
Quiz 1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
Q.1
Main() { char *p; p = "Hello"; printf ("%cn", *&*p); }
H
Hello
Compilation error
H E L L O
Q.2
Main() { char s[ ] = "man"; int i; for( i=s[ i ]; i++) printf( "n%c%c%c%c", s[ i ], *(s+i), *(i+s), i[s] ); }
mmmm aaaa nnnn
aaaa mmmm nnnn
nnnn aaaa mmmm
None
Q.3
What is the output of this C code? #include int main() { int a =b = switch (a) { case a*b: printf("yes "); case a-b: printf("non"); break; } }
yes
no
Compile time error
yes no
Q.4
Which of the following is not a valid escape code?
"
\
'
=
Q.5
#define clrscr()main() { clrscr(); printf( "%dn", clrscr() ); }
100
0
Compilation error
Exception occurs
Q.6
Enum colors {BLACK,BLUE,GREEN} main() { printf( "%d..%d..%d", BLACK, BLUE, GREEN ); return(1); }
1..2..3
0..1..2
1..1..1
0..0..0
Q.7
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
0 h : 0 m : 1 s
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
Report Question
×
What's an issue?
Question is wrong
Answer is wrong
Other Reason
Want to elaborate a bit more? (optional)
Support mcqgeeks.com by disabling your adblocker.
×
Please disable the adBlock and continue.
Thank you.
Reload page