Technical Test-02 Prog in C
Technical Test-02 Prog in C
printf(“mul=%d, char=%d”,(int)((int)*arr-48),j);
6 What would be the output of the following }
code?
a) Mul=2, char=4 b) mul=4,
void main() char=2
{ c) mul=4, char=4 d) mul=2, char=2
int **i;
int *j=0; ________________________________________
i = &j;
clrscr(); 9 What would be the output of the following
code?
if( NULL != i && NULL != *i) main()
printf(“Hello”); {
getch(); FILE *fptr;
} char ch;
clrcsr();
a) error b) Hello
c) Not Determined d) No Output fptr=fopen(“myfile.txt”,’r’);
(Logically Wrong) if(fptr == NULL)
{
________________________________________ puts(“failed to open”);
exit();
7 What would be the output of the following }
code? else
void main() puts(“file opened successfully”);
{ fclose(fptr);
char *p = “UNIVERSITY’; }
clrscr();
a) Failed to open
printf(“%c”,++*(p++)); b) file opened successfully
getch(); c) No Message Displayed
} d) Error
{
puts(“failed to open”); ________________________________________
exit();
} 12 What would be the output of the following
while( (ch=getc(fp) ) != EOF) code?
putch(ch); main()
fclose(fptr); {
} char *src;
Clrscr();
a) Failed to open
b) Logical error src = (char*) malloc(printf(“ABCDEFGHI,”));
c) No Output printf(“%d”,sizeof(src));
d) Syntax error }
a) ABCDEFGHI, 10
________________________________________ b) ABCDEFGHI, 2
c) ABCDEFGHI, 9
11 What would be the output of the following d) No Output
code? ________________________________________
#include<stdio.h>
#include<conio.h> 13 What would be the output of the following
#include<string.h> code?
#include<stdio.h>
void main() #ifdef var
{ int know=0;
char string; #endif
char *n;
clrscr(); main()
{
string=”This is C Programming”; int value=0;
n= (char *) malloc(2*sizeof(char)); printf(%d,%d”,know,value);
string=”This is C Programming”; }
n = string;
a) 0,0
printf(“Original String is %s”,n); b) 0, error
strcpy(n,strrev(n)); c) Error, 0
d) Error, error
printf(“\nReversed String is %s”,n);
getch(); ________________________________________
}
14 What would be the output of the following
a) No output code?
b) Syntax error #include<stdio.h>
c) Original string is This is C programming #include<conio.h>
Reversed string is gnimmgorp C si siht
d) Logical error #define AND &&
3
4|Page TECHNICAL TEST-02 : 29 APRIL 2021
1. Syntax Error 26
2. Run Time error What is the output of this program?
3. Compile time Error
4. Some address will be printed. #include <iostream>
using namespace std;
_______________________________________ int main ()
{
24 int numbers[5];
#include int * p;
main() p = numbers; *p = 10;
{ p++; *p = 20;
char s[]={'a','b','c','\n','c','\0'}; p = &numbers[2]; *p = 30;
char *p,*str,*str1; p = numbers + 3; *p = 40;
p=&s[3]; p = numbers; *(p + 4) = 50;
str=p; for (int n = 0; n < 5; n++)
str1=s; cout << numbers[n] << ",";
printf("%d",++*p + ++*str1-32); return 0;
} }
a) 10, 20, 30, 40, 50
1. 77 b) 1020304050
2. 78 c) compile error
3. 79 d) runtime error
4. Error
_______________________________________
_______________________________________
27
25 What is the output of this program?
#include
main() #include <iostream>
{ using namespace std;
char s[]={'a','b','c','\n','c','\0'}; int main()
char *p,*str,*str1; {
p=&s[3]; int a[2][4] = {3, 6, 9, 12, 15, 18, 21, 24};
str=p; cout << *(a[1] + 2) << *(*(a + 1) + 2) <<
str1=s; 2[1[a]];
printf("%d",++*p + ++*str1-32); return 0;
} }
a) 15 18 21
1. m b) 21 21 21
2. N c) 24 24 24
3. n d) Compile time error
4. None
_______________________________________
_______________________________________
6
7|Page TECHNICAL TEST-02 : 29 APRIL 2021
if(a=3)
b++;
printf("%d %d\n",a,b++);
}
a) 10,6
b) 10,7
c) 3,6
d) 3,7
e) none
_______________________________________
29
Q10. What will be the result of the following
program ?
#include"stdio.h"
main()
{
int i=0;
for(;i++;printf("%d",i));
printf("%d",i);
}
1. 0
2. 1
3. 0 to Infinite
4. Syntax Error
_______________________________________
30
Q4. void main()
{
static int a[2][2] = {{2},{3}};
printf (“%d”,a[0][0]);
printf (“%d”, a[0][1]);
7
8|Page TECHNICAL TEST-02 : 29 APRIL 2021
https://forms.gle/6HVr9yW46EbCH3Qi6
8
9|Page TECHNICAL TEST-02 : 29 APRIL 2021