TUTORIALS
Videos
MCQ's
E-books
Videos
Videos
Java | Instance Variable
Embedded Systems Programming: Working Professional’s Career Path (View their success stories)
Embedded systems: Placed Students Career Success Stories – Cranes Varsity
Local Variable in JAVA | Cranes Varsity
Matrix Manipulation
MCQ's
MCQ
What will be the output of the C program?
#include
int main()
{
printf(“”%d “”,sizeof(2.5));
printf(“”%d “”,sizeof(2));
printf(“”%d””,sizeof(‘A’));
return 0;
}
- 8 4 4
- 8 4 1
- 4 4 1
- 2.5 2 A
View Answer
8 4 4
What will be the output of the C program?
#include
int main()
{
float x = 3.14;
double y = 3.14;
printf(“”%f %ff””,x, y);
return 0;
}
- Runtime error
- Compilation error
- 3.140000 3.140000
- 3.140000 3.140000f
View Answer
3.140000 3.140000f
What will be the output of the C program?
#include
int main()
{
int x = 2;
(x & 1) ? printf(“”true””) : printf(“”false””);
return 0;
}
- Compilation error
- TRUE
- FALSE
- Runtime error
View Answer
FALSE
What will be the output of the C program?
#include
int main()
{
char num = ‘\010’;
printf(“”%d””, num);
return 0;
}
- 10
- 8
- 10
- 8
View Answer
8
What will be the output of the C program?
#include
#define x =
int main()
{
int a;
a x 5;
printf(“”%d””,a);
return 0;
}
- Compilation error
- Runtime error
- 5
- program incomplete
View Answer
5
What will be the output of the C program?
#include
int main(){
int i = -1;
do
{
printf(“”HiDoWhile “”);
}while(i++);
return 0;
}
- Compilation Error
- HiDoWhile
- HiDoWhileHiDoWhie
- HiDoWhile
View Answer
HiDoWhile HiDoWhile
What will be the output of the C program?
#include
int main(){
while(printf(“”%d””, 5) < 4)
printf(“”Loop “”);
return 0;
}
- Prints Nothing
- 5Loop 5Loop 5Loop 5Loop 5Loop
- 5Loop
- Infinite iterations or Infinite Loop
View Answer
Infinite iterations or Infinite Loop
What will be the output of the C program?
#include
#define FALSE -1
#define NULL 0
#define TRUE 1
int main(){
if(NULL)
printf(“”NULL””);
else if(FALSE)
printf(“”TRUE””);
else
printf(“”FALSE””);
return 0;
}
- FALSE
- TRUE
- NULL
- Compilation Error
View Answer
TRUE
What will be the output of the C program?
#include
int main(){
int i = 0, j = 0;
if(i++ == j++)
printf(“”%d %d””, i–, j–);
else
printf(“”%d %d””, i, j);
return 0;
}
- 0 0
- 0 1
- 1 0
- 1 1
View Answer
1 1
What will be the output of the C program?
#include
#define loop for(;;)
int main()
{
printf(“”DONE””);
loop;
return 0;
}
- Compilation error
- Done
- Program never ends
- None of the above
View Answer
Program never ends
What will be the output of the C program?
#include
int main()
{
char i = 0;
for(;i>=0;i++);
printf(“”%d””, i);
return 0;
}
- Compilation error
- -128
- 0
- 1
View Answer
-128
What will be the output of the C program?
#include
int main()
{
int i;
if(scanf(“”%d””,&i)) //if we give input as 0
printf(“”inside if block””);
else
printf(“”inside else block””);
return 0;
}
- Runtime error
- Compilation error
- inside else block
- inside if block
View Answer
inside if block
What will be the output of the C program?
#include
int main(){
int i = 3, j = 4;
switch(i | j)
{
case 1:
printf(“”inside case 1″”);
break;
case 3:
printf(“”inside case 3″”);
break;
case 4:
printf(“”inside case 4″”);
break;
case 7:
printf(“”inside case 7″”);
break;
}
return 0;
}
- inside case 1
- inside case 3
- inside case 7
- inside case 4
View Answer
inside case 7
What will be the output of the C program?
#include
#define preprocessor(n) printf (“”macro”” #n “” = %d””, macro##n)
int main(void) {
int macro25 = 47;
preprocessor(25);
return 0;
}
- Compilation error
- macro25 = 47
- macro47 = 25
- Runtime error
View Answer
macro25 = 47
What is the output of following program?
# include
int main()
{
char str1[] = “”GeeksQuiz””;
char str2[] = {‘G’, ‘e’, ‘e’, ‘k’, ‘s’, ‘Q’, ‘u’, ‘i’, ‘z’};
int n1 = sizeof(str1)/sizeof(str1[0]);
int n2 = sizeof(str2)/sizeof(str2[0]);
printf(“”n1 = %d, n2 = %d””, n1, n2);
return 0;
}
- n1 = 10, n2 = 9
- n1 = 10, n2 = 10
- n1 = 9, n2 = 9
- n1 = 9, n2 = 10
View Answer
n1 = 10, n2 = 9
In below program, what would you put in place of “?” to print “”Cranesvarsity”?
#include
int main()
{
char arr[] = “”Cranesvarsity””;
printf(“”%s””, ?);
return 0;
}
- arr
- (arr+5)
- (arr+4)
- Not possible
View Answer
arr
What will be the output of the program?
#include
int addmult(int ii, int jj)
{
int kk, ll;
kk = ii + jj;
ll = ii * jj;
return (kk, ll);
}
int main()
{
int i=3, j=4, k, l;
k = addmult(i, j);
l = addmult(i, j);
printf(“”%d %d””, k, l);
return 0;
}
- 12 12
- No error, No output
- Error: Compile error
- None of above
View Answer
12 12
What will be the output of the program?
#include
int fun(int i)
{
i++;
return i;
}
int main()
{
int fun(int);
int i=3;
fun(i=fun(fun(i)));
printf(“”%d””, i);
return 0;
}
- 5
- 4
- error
- Garbage value
View Answer
5
#include
int fun()
{
static int num = 16;
return num–;
}
int main()
{
for(fun(); fun(); fun())
printf(“”%d “”, fun());
return 0;
}
- Infinite loop
- 13 10 7 4 1
- 14 11 8 5 2
- 15 12 8 5 2
View Answer
14 11 8 5 2
#include
int main()
{
int x = 10;
static int y = x;
if(x == y)
printf(“”Equal””);
else if(x > y)
printf(“”Greater””);
else
printf(“”Less””);
return 0;
}
- compiler error
- equal
- greater
- less
View Answer
compiler error
Which of the following statement are correct?
(I) The maximum value a variable can hold depends upon its storage class.
(II) By default all variables enjoy a static storage class.
- Only I is correct
- Only II is correct
- Both I & II are correct
- Both I & II are incorrect
View Answer
Both I & II are incorrect
What will be the output of the following program?
#include
int main()
{
register int i = 2;
static char ch = ‘A’;
auto float j;
int k;
k = ++ch && i;
k = ++ch;
j = i– + ++k * 2;
printf(“%d %f”, k , j);
return 0;
}
- B 3
- 65 138.000000
- 68 138.000000
- A 138
View Answer
68 138.000000
What will be the output of the following code?
#include< stdio.h>
int main()
{
extern int a=0;
static char j = ‘E’;
printf(“%c %d”, ++j, ++a);
return 0;
}
- E 1
- F 1
- F Garbage
- Compler error
View Answer
compiler error
What will be the output of the program if the array begins at 65472 and each integer occupies 2 bytes?
#include
int main()
{
int a[3][4]={1,2,3,4,4,3,2,1,7,8,9,0};
printf(“%u,%u”,a+1,&a+1);
}
- 65474, 65488
- 65480, 65488
- 65480, 65496
- 65474, 65476
View Answer
65480, 65496
Predict output of following program
int main()
{
int i;
int arr[5] = {1};
for (i = 0; i < 5; i++)
printf(“”%d “”, arr[i]);
return 0;
}
- 1 followed by four garbage values
- 1 0 0 0 0
- 1 1 1 1 1
- 0 0 0 0 0
View Answer
1 0 0 0 0
Predict output of following program
#include
int main()
{
char p;
char buf[10] = {1, 2, 3, 4, 5, 6, 9, 8};
p = (buf + 1)[5];
printf(“”%d””, p);
return 0;
}
- 5
- 6
- 9
- None of the above
View Answer
9
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””, i, j, m);
return 0;
}
- 2 1 15
- 1 2 5
- 3 2 15
- 2 3 20
View Answer
3 2 15
What will be the output of the program?
#include
int main()
{
int arr[5], i=0;
while(i<5)
arr[i]=++i;
for(i=0; i<5; i++)
printf(“”%d, “”, arr[i]);
return 0;
}
- 1 , 2, 3, 4, 5
- Garbage value, 1, 2, 3, 4
- 0, 1, 2, 3, 4
- 2, 3, 4, 5, 6
View Answer
Garbage value, 1, 2, 3, 4
What will be the output of the C program?
#include
int function();
main()
{
int i;
i = function();
printf(“”%d””, i);
return 0;
}
function()
{
int a;
a = 250;
return 0;
}
- Runtime error
- 0
- 250
- no output
View Answer
0
What will be the output of the program ?
#include
int main()
{
int arr[1]={10};
printf(“”%d””, 0[arr]);
return 0;
}
- 1
- 10
- 0
- 6
View Answer
10
#include
int main()
{
while((printf(“”Hello “”))<4)
{
printf(“”The control is inside the while loop””);
}
printf(“”The control is outside the while loop\n””);
return 0;
}
What will be the output of the program ?
- Hello
- Hello The control is outside the while loop
- The control is outside the while loop
- Compliler Error
View Answer
Hello The control is outside the while loop
int main()
{
int x = 10;
{
int x = 0;
printf(“”%d””,x);
}
return 0;
}
- 10
- Compilation Error
- 0
- Undefined
View Answer
0
Which programming language is more faster among these?
- Java
- PHP
- C
- Visual Basic
View Answer
C
int main()
{
int a = printf (“”hello””);
printf(“”%d””, a);
return 0;
} After executing the above program the value of a is:
- 0
- 1
- 5
- Garbage value
View Answer
5
#include
int main()
{
int n;
for(n = 7; n!=0; n–)
printf(“”n = %d””, n–);
getchar();
return 0;
}
- 7 6 5 4 3 2 1
- 7 5 3 1
- 6 4 2
- Infinite loop
View Answer
Infinite loop
#include
int main()
{
printf(“”%x””, -1<<1);
getchar();
return 0;
}
- 0x01
- 0x05
- ffffe
- fffffffe
View Answer
ffffffe
#include
#include
enum {false, true};
int main()
{
int i = 1;
do
{
printf(“”%d\\n””, i);
i++;
if (i < 15)
continue;
} while (false);
return 0;
}
- 1\n
- 1
- Error
- Infinite Loop
View Answer
1\n
#include
int main()
{
static int i=5;
if(–i){
main();
printf(“”%d “”,i);
}
}
- 5 4 3 2 1
- 4 3 2 1 0
- 0 0 0 0
- Compile time error
View Answer
0 0 0 0 0
#include
int main()
{
int x;
printf(“”%d””,scanf(“”%d””,&x));
return 1;
}
- 0
- 2
- 3
- 1
View Answer
1
#include
int main()
{
int i=0;
for(i=0; i<20; i++)
{
switch(i)
{
case 0:
i+=5;
case 1:
i+=2;
case 5:
i+=5;
default:
i+=4;
break;
}
printf(“”%d “”, i);
}
getchar();
return 0;
}
- 14 24
- 10 22
- 16 21
- Compile time error
View Answer
16 21
#include
int main()
{
printf(“”%p””, main);
getchar();
return 0;
}
- Compile time error
- Run time error
- Address of main
- No output
View Answer
Address of main
#include
# include
void fun(int *a)
{
a = (int*)malloc(sizeof(int));
}
int main()
{
int *p;
fun(p);
*p = 6;
printf(“”%d\\n””,*p);
return(0);
}
- 6
- Run time error
- Syntatical error
- No output
View Answer
No output
What will be the output of following?
void main()
{
int const* p = 5;
printf(“”%d””, ++(*p));
}
- 6
- 5
- Garbage Value
- Compiler Error
View Answer
Compiler Error
What will be the output of following?
#include
int main()
{
int i=0;
i=printf(“”Where there is a will there is way “”);
printf(“”%d\n””,i);
return 0;
}
- Where there is a will there is way 9
- Where there is a will there is way 35
- Where there is a will there is way 34
- Compiler Error
View Answer
Where there is a will there is way 35
What will be the output of following?
void main()
{
int m, i = 0, j = 1, k = 2;
m = i++ || j++ || k++;
printf(“”%d %d %d %d””, m, i, j, k);
}
- 1 1 2 3
- 1 1 2 2
- 0 1 2 2
- 0 1 2 3
View Answer
1 1 2 2
What will be the output of following?
void main()
{
int i = 0;
printf(“”%d %d””, i, i++);
}
- 1 0
- 0 1
- 0 0
- 1 1
View Answer
1 0
What will be the output of following?
#include
#include
void main()
{
printf(“”%d %d””, sizeof(“”program””), strlen(“”program””));
}
- 7 7
- 8 8
- 8 7
- 7 8
View Answer
8 7
What will be the output of following?
#include
int main()
{
int array[] = {[1] = 1, [0] = 2, [2] = 3 };
printf(“”%d %d %d””, array[0], array[1], array[2]);
return 0;
}
2 1 3
1 3 2
1 0 2
Error
View Answer
2 1 3
What will be the output of following?
#include
char A()
{
char c = ‘B’;
return c;
}
int main()
{
printf(“”%lu””, sizeof(A()));
return 0;
}
- 0
- Error
- 2
- 1
View Answer
1
#include
int main()
{
int i=0;
for (;;);
printf(“”INDIA\n””);
return 0;
}
What will be the output for the above program?
- The string “INDIA” is printed one time
- Compilation Error
- The string “INDIA” is printed infiite times
- The string” INDIA” will never be printed
View Answer
The string” INDIA” will never be printed
What does the following fragment of C-program print?
char c[] = “”GATE2011″”;
char *p =c;
printf(“”%s””, p + p[3] – p[1]) ;
- GATE2011
- E2011
- 11
- 2011
View Answer
2011
#include
main()
{
int x = 5;
if(x=5)
{
if(x=5) break;
printf(“”Hello””);
}
printf(“”Hi””);
}
- 1
- 1 2
- No output
- Compile error
View Answer
compiler error
#include
int main()
{
int i,j,return_val=0;
for(i=0,j=4; i < 5 && j < 10 ;i++,j–)
{
printf(“”%d%d “”,i,j);
}
}
- 04 13 22 31 40
- 04 13 22 31 40 5-1 6-2 7-3 8-4 9-5
- 04 13 22 31 40 5-1 6-2 7-3 8-4
- Compliler Error
View Answer
04 13 22 31 40
#include
int main()
{
int i=0,*s=NULL;
int *ptr = &i;
char str[] = “”Welcome””;
s = str;
while(*s)
printf(“”%c””, *s++);
return 0;
}
- Welcome
- 0
- Wel
- Wo
View Answer
Wo
If S is an array of 80 characters, then the value assigned to S through the statement scanf(“%s”,S) with input 12345 would be
- “12345”
- nothing since 12345 is an integer
- S is an illegal name for string
- %s cannot be used for reading in values of S
View Answer
“12345”
A one dimensional array A has indices 1….75.Each element is a string and takes up three memory words. The array is stored starting at location 1120 decimal. The starting address of A[49] is
- 1167
- 1164
- 1264
- 1169
View Answer
1264
#include
int main()
{
int a=0,b=0,c=0,d=0,e=a,f=b,g=c;
a=b=c=d=5;//e=f=g=5;
printf(“” %d %d %d %d %d %d %d””,a,b,c,d,e,f,g);
return 0;
}
- 5 5 5 5 0 0 0
- 0 0 0 5 0 0 0
- Compilation error
- 5 5 5 5 5 5 5
View Answer
5 5 5 5 0 0 0
#include
int main()
{
int num=0x12345678;
printf(“”%x\n””,num=num>>1);
return 0;
}
- 91a2b3c
- 1234567
- 2345678
- None of these
View Answer
91a2b3c
#include
int main()
{
int num=0x82345678;
printf(“”%x\n””,num=num>>1);
return 0;
} What will be the output?
- c11a2b3c
- 411a2b3c
- 8234567
- None of the above
View Answer
c11a2b3c
#include
void main()
{
char str1[10]=””abyz””;
int i;
for(i=0; i<4; i++)
{
printf(“”%c””,str1[i] – 32);
}
}
- AB
- zyba
- abyz
- ABYZ
View Answer
ABYZ
E-books
If you’re someone that believes in accomplishing your goals through perseverance? Then this is the place for you. Connect with our professional trainers by filling the form with your details and get on board!