Login
Register
Dark Mode
Brightness
Profile
Edit Profile
Messages
My favorites
My Updates
Logout
Recent questions tagged tbb-programming-2
3
votes
1
answer
1
Test by Bikram | Programming | Test 2 | Question: 30
Assume that $a[4]$ is a one-dimensional array of $4$ elements, $p$ is a pointer variable and $p = a$ is performed. Now, which among these expressions is illegal? $p == a[0]$ $p == \&a[0]$ $^*p == a[0]$ $p[0] == a[0]$
Assume that $a[4]$ is a one-dimensional array of $4$ elements, $p$ is a pointer variable and $p = a$ is performed. Now, which among these expressions is illegal?$p == a[0...
Bikram
420
views
Bikram
asked
May 14, 2017
Programming in C
tbb-programming-2
+
–
0
votes
1
answer
2
Test by Bikram | Programming | Test 2 | Question: 29
Spot the error(s) in this code snippet : int n=2; // Line 1 switch(n) { case 1.5: printf( "gate"); break; case 2: printf( "overflow"); break; case 'A': printf("gateoverflow"); } // Line 12 The error(s) is in line number _____.
Spot the error(s) in this code snippet :int n=2; // Line 1 switch(n) { case 1.5: printf( "gate"); break; case 2: printf( "overflow"); break; case 'A': printf("gateoverflo...
Bikram
364
views
Bikram
asked
May 14, 2017
Programming in C
tbb-programming-2
numerical-answers
+
–
0
votes
1
answer
3
Test by Bikram | Programming | Test 2 | Question: 28
#include<stdio.h> int K = 10; int main() { foo(); foo(); return 0; } int foo() { static int k= 1; printf("%d ",k); k++; return 0; } What is the output of the above code snippet? $2,3$ $1,2$ $1,3$ $2,4$
#include<stdio.h int K = 10; int main() { foo(); foo(); return 0; } int foo() { static int k= 1; printf("%d ",k); k++; return 0; }What is the output of the above code sni...
Bikram
221
views
Bikram
asked
May 14, 2017
Programming in C
tbb-programming-2
+
–
0
votes
1
answer
4
Test by Bikram | Programming | Test 2 | Question: 27
What is the output of the following program? int fun (int z) { if( z==0 || z==1 ) return 1; else return fun(z-1) ; } int main() { int y; y=fun(8); printf(“%d”, y) ; } $1$ $36$ $8$ $40$
What is the output of the following program? int fun (int z) { if( z==0 || z==1 ) return 1; else return fun(z-1) ; } int main() { int y; y=fun(8); printf(“%d”...
Bikram
220
views
Bikram
asked
May 14, 2017
Programming in C
tbb-programming-2
+
–
2
votes
1
answer
5
Test by Bikram | Programming | Test 2 | Question: 26
What is the output of the below mentioned code snippet? #include <stdio.h> int main() { int i=10; static int x=i; if(x==i) printf("Equal"); else if(x>i) printf("Greater"); else printf("Lesser"); return 0; } Equal Greater Lesser Compilation Error
What is the output of the below mentioned code snippet?#include <stdio.h int main() { int i=10; static int x=i; if(x==i) printf("Equal"); else if(x>i) printf("Greater"); ...
Bikram
753
views
Bikram
asked
May 14, 2017
Programming in C
tbb-programming-2
+
–
1
votes
1
answer
6
Test by Bikram | Programming | Test 2 | Question: 25
Read the following program fragment: #include<stdio.h> int main() { int p = 2, q = 5; p = p^q; q = q^p; printf("%d%d",p,q); return 0; } The output is: $5 \ 2$ $2 \ 5$ $7 \ 7$ $7 \ 2$
Read the following program fragment: #include<stdio.h int main() { int p = 2, q = 5; p = p^q; q = q^p; printf("%d%d",p,q); return 0; }The output is:$5 \ 2$$2 \ 5$$7...
Bikram
420
views
Bikram
asked
May 14, 2017
Programming in C
tbb-programming-2
+
–
0
votes
0
answers
7
Test by Bikram | Programming | Test 2 | Question: 24
#include <stdio.h> int counter(int i) { static int count = 0; count = count + i; return count; } int main() { int i, j; for (i = 0; i <= 5; i++) j = counter(i); printf ("%d\n", j); return 0; } What is the output of the above program?
#include <stdio.h int counter(int i) { static int count = 0; count = count + i; return count; } int main() { int i, j; for (i = 0; i <= 5; i++) j = counter(i); printf ("%...
Bikram
209
views
Bikram
asked
May 14, 2017
Programming in C
tbb-programming-2
numerical-answers
+
–
1
votes
1
answer
8
Test by Bikram | Programming | Test 2 | Question: 23
What is the output of the following program? #include <stdio.h> int main() { int a = 0; switch(a) { default: a = 4; case 6: a--; case 5: a = a+1; case 1: a = a-1; } printf("%d \n",a); return 0; }
What is the output of the following program?#include <stdio.h int main() { int a = 0; switch(a) { default: a = 4; case 6: a ; case 5: a = a+1; case 1: a = a-1; } printf("...
Bikram
311
views
Bikram
asked
May 14, 2017
Programming in C
tbb-programming-2
numerical-answers
+
–
4
votes
3
answers
9
Test by Bikram | Programming | Test 2 | Question: 22
Read this code snippet : void main() { int i; char a[]="\0"; if(printf("%s\n",a)) printf(" GATE 2018\n"); else printf("Forget GATE\n"); } The output is : Compiler Error Forget GATE GATE $2018$ Runtime error
Read this code snippet :void main() { int i; char a[]="\0"; if(printf("%s\n",a)) printf(" GATE 2018\n"); else printf("Forget GATE\n"); }The output is :Compiler ErrorForge...
Bikram
728
views
Bikram
asked
May 14, 2017
Programming in C
tbb-programming-2
+
–
7
votes
2
answers
10
Test by Bikram | Programming | Test 2 | Question: 21
What is the output of the following code snippet? #include <stdio.h> int main() { char c=125; c=c+10; printf("%d",c); return 0; }
What is the output of the following code snippet? #include <stdio.h int main() { char c=125; c=c+10; printf("%d",c); return 0; }
Bikram
557
views
Bikram
asked
May 14, 2017
Programming in C
tbb-programming-2
numerical-answers
+
–
0
votes
1
answer
11
Test by Bikram | Programming | Test 2 | Question: 20
How many TOKENS are there in the statement answer $=(5*q-p*p)/3$; ? $13$ $12$ $15$ $14$
How many TOKENS are there in the statement answer $=(5*q-p*p)/3$; ?$13$$12$$15$$14$
Bikram
251
views
Bikram
asked
May 14, 2017
Programming in C
tbb-programming-2
+
–
2
votes
1
answer
12
Test by Bikram | Programming | Test 2 | Question: 19
The output of this code snippet is : #include <stdio.h> #define x 4+1 int main() { int i; i = x*x*x; printf("%d",i); return 0; }
The output of this code snippet is :#include <stdio.h #define x 4+1 int main() { int i; i = x*x*x; printf("%d",i); return 0; }
Bikram
206
views
Bikram
asked
May 14, 2017
Programming in C
tbb-programming-2
numerical-answers
+
–
3
votes
1
answer
13
Test by Bikram | Programming | Test 2 | Question: 18
Point out the error : #include <stdio.h> void f(int*); int main() { int i=35,*z; z=f(&i); printf("%d",z); return 0; } void f(int*m) { return(m+2); } error in function call error in return statement error in argument of f() error in pointer initialization
Point out the error : #include <stdio.h void f(int*); int main() { int i=35,*z; z=f(&i); printf("%d",z); return 0; } void f(int*m) { return(m+2); }error in function calle...
Bikram
540
views
Bikram
asked
May 14, 2017
Programming in C
tbb-programming-2
+
–
1
votes
1
answer
14
Test by Bikram | Programming | Test 2 | Question: 17
What will be the output of the below program ? #include <stdio.h> int main() { struct node { int x; int y; int z; }; struct node s = { 3, 5, 6 }; struct node *pt = &s; printf("%d\n", *((int*)pt+1)); return 0; } 5 3 7 6
What will be the output of the below program ?#include <stdio.h int main() { struct node { int x; int y; int z; }; struct node s = { 3, 5, 6 }; struct node *pt = &s; prin...
Bikram
291
views
Bikram
asked
May 14, 2017
Programming in C
tbb-programming-2
+
–
7
votes
2
answers
15
Test by Bikram | Programming | Test 2 | Question: 16
What will be the output of this program ? #define square(x) x*x main() { int z; z = 25/square(5); printf("%d",z); }
What will be the output of this program ?#define square(x) x*x main() { int z; z = 25/square(5); printf("%d",z); }
Bikram
371
views
Bikram
asked
May 14, 2017
Programming in C
tbb-programming-2
numerical-answers
+
–
3
votes
1
answer
16
Test by Bikram | Programming | Test 2 | Question: 15
Choose the correct operators to fill in the blanks: int i,j,k; i=1;j=2;k=3; printf("%d",i___5___j___2____k); Output is: $2$ + % – + * / – + + % + / * % – /
Choose the correct operators to fill in the blanks:int i,j,k; i=1;j=2;k=3; printf("%d",i___5___j___2____k);Output is: $2$ + % – +* / – ++ % + /* % – /
Bikram
318
views
Bikram
asked
May 14, 2017
Programming in C
tbb-programming-2
+
–
0
votes
1
answer
17
Test by Bikram | Programming | Test 2 | Question: 14
Read the following code fragment: #include <stdio.h> main() { int i=1,j; int k= 1__ (j ___ i) ; printf("%d%d%d\n", i,j,k); } What operators are needed in the blanks to print $1 \ 1 \ 2$? $*$ and $=$ $*$ and $+$ $+$ and $*$ $+$ and $=$
Read the following code fragment:#include <stdio.h main() { int i=1,j; int k= 1__ (j ___ i) ; printf("%d%d%d\n", i,j,k); }What operators are needed in the blanks to print...
Bikram
274
views
Bikram
asked
May 14, 2017
Programming in C
tbb-programming-2
+
–
6
votes
4
answers
18
Test by Bikram | Programming | Test 2 | Question: 13
What is the output of the code? #include <stdio.h > int main() { int a; printf("%d",scanf("%d",&a)); return 0; } $10$ $9$ $-1$ An undefined behavior
What is the output of the code? #include <stdio.h int main() { int a; printf("%d",scanf("%d",&a)); return 0; }$10$$9$$-1$An undefined behavior
Bikram
899
views
Bikram
asked
May 14, 2017
Programming in C
tbb-programming-2
+
–
3
votes
2
answers
19
Test by Bikram | Programming | Test 2 | Question: 12
What is the output of the following program? #include <stdio.h> void f(char**); int main() { char *argv[] = { "ab", "cd", "ef", "gh", "ij", "kl" }; f(argv); return 0; } void f(char **p) { char *t; t = (p += sizeof(int))[-1]; printf("%s\n", t); } ab cd ef gh
What is the output of the following program?#include <stdio.h void f(char ); int main() { char *argv[] = { "ab", "cd", "ef", "gh", "ij", "kl" }; f(argv); return 0; } void...
Bikram
721
views
Bikram
asked
May 14, 2017
Programming in C
tbb-programming-2
+
–
0
votes
1
answer
20
Test by Bikram | Programming | Test 2 | Question: 11
Which of the following will print the value $2$ for this code snippet? #include<stdio.h> int main() { int arr[10][20][30] = {0}; arr[5][2][1] = 2; __________ // missing line here return 0; } The missing line above is: printf("%d",*(( ... 5)+2)+1); printf("%d",*(*(*(arr+5)+2)+1)); printf("%d", *(*((arr+5)+2)+1);
Which of the following will print the value $2$ for this code snippet?#include<stdio.h int main() { int arr[10][20][30] = {0}; arr[5] = 2; __________ // missing line he...
Bikram
214
views
Bikram
asked
May 14, 2017
Programming in C
tbb-programming-2
+
–
0
votes
1
answer
21
Test by Bikram | Programming | Test 2 | Question: 10
Suppose the following declarations are in effect : $\text{int }a[ \: ] = \{5,15,34,54,14,2,52,72 \}$; $\text{int }*p = \&a[1] , *q = \&a[5]$; The value of $q - p$ is ________.
Suppose the following declarations are in effect :$\text{int }a[ \: ] = \{5,15,34,54,14,2,52,72 \}$;$\text{int }*p = \&a , *q = \&a[5]$;The value of $q - p$ is ________...
Bikram
398
views
Bikram
asked
May 14, 2017
Programming in C
tbb-programming-2
numerical-answers
+
–
2
votes
1
answer
22
Test by Bikram | Programming | Test 2 | Question: 9
Consider the below function: int s (int n) { if (n<=1) return 1 ; n = (n-1) * (n-1) -2 - n * n + 3*n ; s(n); printf(“%d”, n ); } What is the output if initial call is $s(6)$ ? $55555$ $11111$ $54321$ $12345$
Consider the below function:int s (int n) { if (n<=1) return 1 ; n = (n-1) * (n-1) -2 - n * n + 3*n ; s(n); printf(“%d”, n ); }What is the output if initial call is $...
Bikram
361
views
Bikram
asked
May 14, 2017
Programming in C
tbb-programming-2
identify-function
+
–
2
votes
2
answers
23
Test by Bikram | Programming | Test 2 | Question: 8
What is the output of this program? #include <stdio.h> int main() { char *ptr; char string[] = "How are you?"; ptr = string; ptr += 4; printf("%s",ptr); return 0; } How are you? are you? are error in program
What is the output of this program?#include <stdio.h int main() { char *ptr; char string[] = "How are you?"; ptr = string; ptr += 4; printf("%s",ptr); return 0; }How are ...
Bikram
438
views
Bikram
asked
May 14, 2017
Programming in C
tbb-programming-2
+
–
0
votes
1
answer
24
Test by Bikram | Programming | Test 2 | Question: 7
The value of p after execution of the following program will be: int new(int t) { static int cal=0; cal=cal+t; return(cal); } main() { int t,p; for(t=0;t<=4;t++) p= new(t); } $10$ $4$ $6$ $7$
The value of p after execution of the following program will be:int new(int t) { static int cal=0; cal=cal+t; return(cal); } main() { int t,p; for(t=0;t<=4;t++) p= new(t)...
Bikram
175
views
Bikram
asked
May 14, 2017
Programming in C
tbb-programming-2
+
–
0
votes
0
answers
25
Test by Bikram | Programming | Test 2 | Question: 6
Which among following statements is/are TRUE? & is bit-wise and && is a logical operator & returns an integer value whereas && returns a boolean value Both the above options are correct Both (A) and (B) are incorrect
Which among following statements is/are TRUE?& is bit-wise and && is a logical operator& returns an integer value whereas && returns a boolean valueBoth the above options...
Bikram
386
views
Bikram
asked
May 14, 2017
Programming in C
tbb-programming-2
binary-operation
programming-in-c
+
–
1
votes
1
answer
26
Test by Bikram | Programming | Test 2 | Question: 5
#include <stdio.h> void fun() { int p; static int x=1; p = ++x; printf("%d %d", p, x); if(p <= 2) fun(); printf(“%d %d”, p, x); } int main() { fun(); fun(); } In the above code fragment, the total number of times printf statement will be executed is _________.
#include <stdio.h void fun() { int p; static int x=1; p = ++x; printf("%d %d", p, x); if(p <= 2) fun(); printf(“%d %d”, p, x); } int main() { fun(); fun(); }In the ab...
Bikram
390
views
Bikram
asked
May 14, 2017
Programming in C
tbb-programming-2
numerical-answers
+
–
4
votes
2
answers
27
Test by Bikram | Programming | Test 2 | Question: 4
State the output in below code snippet : #include <stdio.h> int main(void) { char x[5] = { 1, 2, 3, 4, 5 }; char *ptr = (char*)(&x + 1); printf("%d %d\n", *(x + 1), *(ptr - 1)); return 0; } Compile Error $2 \ 1$ $2 \ 5$ $3 \ 4$
State the output in below code snippet :#include <stdio.h int main(void) { char x[5] = { 1, 2, 3, 4, 5 }; char *ptr = (char*)(&x + 1); printf("%d %d\n", *(x + 1), *(ptr -...
Bikram
770
views
Bikram
asked
May 14, 2017
Programming in C
tbb-programming-2
+
–
0
votes
1
answer
28
Test by Bikram | Programming | Test 2 | Question: 3
What is the output of this program? #include <stdio.h> #include <string.h> int main() { char string[] = "Hello"; printf("%lu %lu", sizeof(string), strlen(string)); return 0; } $5 \ 6$ $5 \ 5$ $6 \ 5$ $6 \ 6$
What is the output of this program?#include <stdio.h #include <string.h int main() { char string[] = "Hello"; printf("%lu %lu", sizeof(string), strlen(string)); return 0;...
Bikram
333
views
Bikram
asked
May 14, 2017
Programming in C
tbb-programming-2
+
–
2
votes
1
answer
29
Test by Bikram | Programming | Test 2 | Question: 2
Which of the following statements is/are true ? #include <stdio.h> int main() { int x=10, y=200%90, i; for( i=1;i++<=10;); if(x==y); printf("x=%dy=%d\n",x,y ); return 0; } printf() is called infinite times program will produce output x=10,y=20; The program will not produce any output The program will produce some error
Which of the following statements is/are true ?#include <stdio.h int main() { int x=10, y=200%90, i; for( i=1;i++<=10;); if(x==y); printf("x=%dy=%d\n",x,y ); return 0; }p...
Bikram
503
views
Bikram
asked
May 14, 2017
Programming in C
tbb-programming-2
programming-in-c
+
–
1
votes
1
answer
30
Test by Bikram | Programming | Test 2 | Question: 1
Consider the following C program using function : #include<stdio.h> main() { int f1(int,int); int x = 9, n=3, S; S = f1(x,n); printf(S); } int f1(int x, int n) { int y=1, i=1; for(i=1;i<=n;i++) y=y*x; return(y); } Output will be ______
Consider the following C program using function : #include<stdio.h main() { int f1(int,int); int x = 9, n=3, S; S = f1(x,n); printf(S); } int f1(int x, int n) { int y=1,...
Bikram
267
views
Bikram
asked
May 14, 2017
Programming in C
tbb-programming-2
numerical-answers
+
–
To see more, click for the
full list of questions
or
popular tags
.
Email or Username
Show
Hide
Password
I forgot my password
Remember
Log in
Register