NEW
Font size
WorksheetsGNIDOC ROUND 1
Total questions: 25
Worksheet time: 13mins
What will be the output of the following code snippet?
#include<stdio.h>
int main()
{
int i;
i = (printf("Welcome"), printf(" To Progeni "));
printf("%d", i);
return 0;
}
a) Welcome To Progeni , error
b) compilation error
c) Welcome To Progeni 12
d) Welcome To Progeni 19
What is the output of below program?
int main()
{
if("0")
{
cout<<"EPUDRAA";
}
else
{
cout<<" THE BOYS";
}
return 0;
}
a)EPUDRAA
b) THE BOYS
c) both a) and b)
d) none
What is the value of p in the following C++ code snippet?
#include <iostream>
using namespace std;
int main()
{
int p;
bool a = true;
bool b = false;
int x = 8;
int y = 2;
p = ((x | y) + (a + b));
cout << p;
return 0;
}
10
11
8
12
What will be the output of the following code snippet?
#include <stdio.h>
int main() {
printf("%d %d", (032), (27));
return 0;
}
032 27
32 27
26 27
026 27
By assuming size of int = 8 bytes , char = 1 byte for 64-bit compiler, find the output.
#include <iostream>
#include<string.h>
using namespace std;
int main() {
int *pr[10];
const char *ptr="varta maamey durrr";
char p[]="Eppudra";
cout<<sizeof(pr)<<" ";
cout<<sizeof(ptr)<<" ";
cout<<sizeof(p);
}
a) 80 12 7
b) 10 8 7
c) 80 8 8
d) 80 4 8
What will be the output of the following code snippet?
#include <stdio.h>
int main() {
bool ok = false;
printf(ok? "YES" : "NO");
return 0;
}
A)Yes
B)No
C)Compilation Error
D)None of the above
What is the search complexity in direct addressing?
a) O(n)
b) O(logn)
c) O(nlogn)
d) O(1)
How many times will ‘I LOVE U’ be printed in the above program?
#include <stdio.h>
int main()
{
int i = 1024;
for (; i; i >>= 1)
printf("I LOVE U");
return 0;
}
A) 3000 times
B) infinite times
C) 11 times
D) compile time error
What will be the output of the following code snippet?
#include <stdio.h>
void solve() {
int a = 3;
int res = a++ + ++a + a++ + ++a;
printf("%d", res);
}
int main() {
solve();
return 0;
}
24
20
18
12
#include <iostream>
using namespace std;
int main()
{
int a,rem;
cin>>a;
while(a!=0)
{
rem=a%10;
(rem%2==0)?cout<<'L':cout<<'a';
a/=10;
}
return 0;
}
If the input is 1123345678 what is the output?
a)LaaLaaLaLa
b)LaLaLaaLaa
c)aLaLaaLaaL
d)aaLaaLaLaL
Pick the correct statements.
(i) int array2D[2][3] = {1,2,3,4,5,6};
(ii) int array2D[][3] = {1,2,3,4,5,6};
(iii) int array2D[2][] = {1,2,3,4,5,6};
(iv) int array2D[][] = {1,2,3,4,5,6};
A) Only (i) is correct.
B) Only (i) and (ii) are correct.
C) Only (i), (ii) and (iii) are correct.
D) All (i), (ii), (iii) and (iv) are correct
What will be the output of the following code snippet?
#include <stdio.h>
#include <string.h>
int main()
{
char str[20] = "PROGENI";
int s = strlen(str);
str[3] = '\0';
s += strlen(str);
strcpy(str,"PROGEN");
s += strlen(str);
strcat(str,"PRO");
s += strlen(str);
printf("%d\n",s);
return 0;
}
23
24
25
26
What will be the output of the code snippet?
#include <stdio.h>
int main()
{
int a,b,c;
a=0x23; b=011;
c=a+b;
printf("%d",c);
return 0;
}
11
44
66
Error
Find the output of the code snippet.
#include <stdio.h>
using namespace std;
int main()
{
int num=2;
while(num==0);
{
cout<<"kelambu ";
num=num-1;
}
cout<<num;
return 0;
}
A.kelambu kelambu 0
B.kelambu kelambu 2
C.kelambu 1
D.compilation error
In C language, FILE is of which data type?
int
char*
struct
None of the above
What will be the output of following program?
#include "stdio.h"
int main()
{
char a[] = { 'A', 'B', 'C', 'D' };
char* ppp = &a[0];
*ppp++;
printf("%c %c ", ++ppp, --ppp);
}
C A
B C
B A
C B
What will be the output of the following code snippet?
#include <stdio.h>
int main() {
bool ok = false;
printf(ok? "YES" : "NO");
return 0;
}
A)Yes
B)No
C)Compilation Error
D)None of the above
Which of the following is the correct usage of conditional operators used in C?
a) a>b ? c=30 : c=40;
b) a>b ? c=30;
c) max = a>b ? a>c?a:c:b>c?b:c
d) return (a>b)?(a:b)
#include <stdio.h>
#include <string.h>
int main()
{
for(cout<<"Avengers assemble "; false; )
{
cout<<" now";
}
return 0;
}
Avengers assemble
Compilation error
Avengers assemble now
now
#include<iostream>
using namespace std;
int main()
{
char str[10];
cin>>str;
cout<<str;
return 0;
}
Input: Ennada feeling ah?!
Ennada
Ennada feeling ah?!
Ennada fe
Ennada fee
What will be the output of following code snippet?
#include <iostream>
using namespace std;
int main()
{
int x=23,y=24;
x=x++;
y=y--;
x==y?cout<<x:cout<<y;
return 0;
}
Error
23
24
None of the above
If we have a tree of n nodes, how many edges will it have?
a)1
b)(n*(n-1))/2
c)(n*(n-1))
d)n-1
Which part of the program address space is p stored in the following C code?
#include <stdio.h>
int *p;
int main()
{
int i = 0;
p = &i;
return 0;
}
a) Code/text segment
b) Data segment
c) Bss segment
d) Stack
what will be the output of the code snippet?
#include <stdio.h>
using namespace std;
int main()
{
char str1[] = { 'g', 'n', 'i', 'd', 'o' ,'c'};
char str2[] = "gnidoc";
printf("%ld,%ld", sizeof(str1), sizeof(str2));
return 0;
}
6,7
6,6
7,8
8,9
What will be the output of the following code snippet?
#include <stdio.h>
#define CUBE(x) x x x
int main() {
int ans = 256 / CUBE(4);
printf("%d", ans);
return 0;
}
8
4
1024
None of the above
