Time remaining
:
:
Test Status
CRANDOMTEST
Ques 1 :
What will be the output of the following program if the base address of array is 100.
main()
{
int gyan[] = { 1,2,3,4,5 };
int i,*ptr ;
ptr = gyan;
for(i = 0; i<=4 ; i++)
{
print("\n %d", *ptr++);
}
}
(A) 1 2 3 4 5
(B) 2 3 4 5
(C) 100 101 102 103
(D) 101 102 103 104
Ques 2 :
What is the output of following program?
void main(){
int a;
a=10;
do
while(a++<10);
while(a++<=11);
printf("%d",a);
}
(A) 12
(B) 13
(C) 14
(D) nothing display on screen.
Ques 3 :
Consider the following program,
main ()
{
int i, j;
for (i=0, j=5; j >0, i < 10; i ++, j--)
printf("\nGyantonic.com");
}
How many times "Gyantonic.com" will get printed
(A) 5
(B) Compilation Error
(C) 10
(D) None of the above
Ques 4 :
what is the output of following program?
void main(){
int a;
a=1;
while(a-->=1)
while(a-->=0);
printf("%d",a);
}
(A) 3
(B) -3
(C) 0
(D) error
Ques 5 :
What will be the output
main()
{
if(1,0)
{
printf("True");
}
else
{
printf("False");
}
}
(A) True
(B) False
(C) Compilation Error
(D) Run time Error
Ques 6 :
What will be the output of the following program
main( )
{
int gyan[] = { 10, 20, 30, 40, 50 };
int i, *ptr ;
ptr = gyan;
for ( i = 0 ; i <4 ; i++ )
{
fun(ptr++);
printf ( â??\n%dâ??, *ptr ) ;
}
}
void fun(int *i)
{
*i = *i + 1;
}
(A) 11 21 31 41
(B) 20 30 40 50
(C) 21 31 41 51
(D) 10 20 30 40
Ques 7 :
What is the output of the following code?
#include "stdio.h"
extern int a=5;
main(){
void fun();
printf("\n a=%d",a);
fun();
return 0;
}
int a;
void fun(){
printf("\n in fun a=%d",a);
}
(A) a=0 in fun a=5
(B) a=5 in fun a=0
(C) a=5 in fun a=5
(D) error
Ques 8 :
What will be the output
main()
{
char *ptr = "Pskills.org";
char a =
printf("%c", ++*ptr++);
}
(A) Compilation Error
(B) Q
(C) P
(D) a
Ques 9 :
What is the output of following program?
void abc(int a){
++a;
}
void main(){
int a=10;
abc();
abc();
printf("%d",a);
}
(A) 10
(B) 11
(C) 12
(D) 13
Ques 10 :
What is the output of the following code?
#include"stdio.h"
main()
{
int i;
for(i=0;i<5;i++)
{
static int a=0;
int b=0;
a++;
b++;
printf("%d %d",a,b);
}
return 0;
}
(A) 1 1 2 1 3 1 4 1
(B) 1 1 2 1 3 1 4 1 5 1
(C) 1 0 2 0 3 1 4 1 5 1
(D) 0 1 2 0 3 1 4 1 5 1
Ques 11 :
How many times main() will get called?
main()
{
printf("\n Main Called Again");
main();
}
(A) 1
(B) 100
(C) main can not be called recursively
(D) Infinite
Ques 12 :
What is the output of the following code?
#include "stdio.h"
extern int a;
main(){
void fun();
printf("\n a= %d",a);
fun();
return 0;
}
int a;
void fun(){
printf("\n in fun a=%d",a);
}
(A) a=5 in fun a=0
(B) a=0 in fun a=5
(C) a=5 in fun a=5
(D) a=0 in fun a=0
Ques 13 :
What will be output when you will execute following code?
#include "stdio.h"
int main(){
char a=250;
int expr;
expr= a+ !a + ~a + ++a;
printf("%d",expr);
return 0;
}
(A) 249
(B) 250
(C) -6
(D) 0
Ques 14 :
what is the output of following program?
void main(){
int a=1;
void xyz(int , int);
xyz(++a,a++);
xyz(a++,++a);
printf("%d",a);
}
void xyz(int x, inty){
printf("%d%d",x,y);
}
(A) 3 1 3 4 5
(B) 3 1 4 4 5
(C) 3 1 4 4 4
(D) 3 1 4 5 5
Ques 15 :
What will be printed as the result of the operation below:
main()
{
char s1[]="Cisco"
char s2[]= "systems";
printf("%s",s1);
}
(A) system
(B) error
(C) Cisco
(D) Compilation fail
Ques 16 :
What is the output of following program?
void main(){
int i;
for(i=1;i++<=1;i++)
i++;
printf("%d",i);
}
(A) 4
(B) 5
(C) 6
(D) nothing display on screen
Ques 17 :
What will be the output of the following program
main( )
{
int pskills[] = { 10, 20, 30, 40, 50 };
int i, *ptr ;
ptr = pskills;
for ( i = 0 ; i <4 ; i++ )
{
fun(ptr++);
printf ("\n%", *ptr ) ;
}
}
void fun(int *i)
{
*i = *i + 1;
}
(A) 11 21 31 41
(B) 20 30 40 50
(C) 21 31 41 51
(D) 10 20 30 40
Ques 18 :
int testarray[3][2][2] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12};
What value does testarray[2][1][0] in the sample code above contain?
(A) 3
(B) 5
(C) 7
(D) 11
Ques 19 :
What is the output of following program?
void f1(){
static int s=5;
++s;
printf("%d",s);
}
main(){
f1();
f1();
}
(A) 5 6
(B) 6 6
(C) 6 7
(D) 5 5
Ques 20 :
What is the output of the following program?
void main(){
int a;
a=3+5*5+3;
printf("%d",a);
}
(A) 43
(B) 64
(C) 31
(D) none of these
Submit Answer
Don't Refresh the Page !! ...