Question:
What will be the output of the following C code?
    #include <stdio.h>    int main()    {        char *str = "hello, world\n";        printf("%d", strlen(str));     }

Choices:
- Compilation error
- Undefined behaviour
- 13
- 11


Question:
What will be the output of the following C code?
    #include <stdio.h>    int main()    {        char str[11] = "hello";        char *str1 = "world";        strcat(str, str1);        printf("%s %d", str, str[10]);    }

Choices:
- helloworld 0
- helloworld anyvalue
- worldhello 0
- Segmentation fault/code crash


Question:
What will be the output of the following C code?
    #include <stdio.h>    int main()    {        char str[10] = "hello";        char *str1 = "world";        strncat(str, str1, 9);        printf("%s", str);    }

Choices:
- helloworld
- Undefined behaviour
- helloworl
- hellowor


Question:
What will be the value of var for the following C statement?
var = strcmp("Hello", "World");

Choices:
- -1
- 0
- 1
- strcmp has void return-type


Question:
What will be the output of the following C code?
    #include <stdio.h>    int main()    {        char str[10] = "hello";        char *p = strrchr(str, 'l');        printf("%c\n", *(++p));    }

Choices:
- l
- o
- e
- Compilation error


Question:
The following C expression can be substituted for?
 if (isalpha(c) && isdigit(c))

Choices:
- if (isalnum(c))
- if (isalphanum(c))
- if (isalphanumeric(c))
- none of the mentioned


Question:
What will be the output of the following C code?
    #include <stdio.h>    #include <ctype.h>    int main()    {        char i = 9;        if (isdigit(i))            printf("digit\n");        else            printf("not digit\n");            return 0;    }

Choices:
- digit
- not digit
- Depends on the compiler
- None of the mentioned


Question:
What will be the output of the following C code?
    #include <stdio.h>    #include <ctype.h>    int main()    {        int i = 9;        if (isdigit(i))            printf("digit\n");        else            printf("not digit\n");            return 0;    }

Choices:
- digit
- not digit
- Depends on the compiler
- None of the mentioned


Question:
What will be the output of the following C code?
    #include <stdio.h>    int main()    {        char i = '9';        if (isdigit(i))            printf("digit\n");        else            printf("not digit\n");            return 0;    }

Choices:
- digit
- not digit
- Depends on the compiler
- None of the mentioned


Question:
What will be the output of the following C code?
    #include <stdio.h>    #include <ctype.h>    int main()    {        int i = 0;        if (isspace(i))            printf("space\n");        else            printf("not space\n");            return 0;    }

Choices:
- Compile time error
- space
- not space
- None of the mentioned


Question:
What will be the output of the following C code?
    #include <stdio.h>    #include <ctype.h>    int main()    {        int i = 32;        if (isspace(i))            printf("space\n");        else            printf("not space\n");            return 0;    }

Choices:
- Compile time error
- space
- not space
- None of the mentioned


Question:
Which is true about isaplpha(c), where c is an int that can be represented as an unsigned?
char or EOF.isalpha(c) returns

Choices:
- Non-zero if c is alphabetic
- 0 if c is not alphabetic
- Both Non-zero if c is alphabetic & 0 if c is not alphabetic
- None of the mentioned


Question:
Which is true about isupper(c), where c is an int that can be represented as an unsigned?
char or EOF.isupper(c) returns

Choices:
- Non-zero if c is upper case
- 0 if c is not upper case
- Nothing
- Both Non-zero if c is upper case & 0 if c is not upper case


Question:
Which is true about isalnum(c), where c is an int that can be represented as an unsigned?
 char or EOF.isalnum(c) returns

Choices:
- Non-zero if isalpha(c) or isdigit(c)
- 0 if not isalpha(c) or not isdigit(c)
- Both Non-zero if isalpha(c) or isdigit(c) & 0 if not isalpha(c) or not isdigit(c)
- None of the mentioned


Question:
What will be the output of the following C code?
    #include <stdio.h>    #include <ctype.h>    int main()    {        char c = 't';        printf("%d\n", isspace(c));    }

Choices:
- Non-zero number
- Nothing
- Error
- t


Question:
What will be the output of the following C code?
    #include <stdio.h>    #include <ctype.h>    int main()    {        char c = 't';        printf("is :%c\n", tolower('A'));    }

Choices:
- A
- a
- Non-zero number
- Zero


Question:
What will be the output of the following C code?
    #include <stdio.h>    int main()    {        int n;        scanf("%d", &n);        ungetc(n, stdin);        scanf("%d", &n);        printf("%d\n", n);        return 0;    }

Choices:
- Compile time error
- Whatever is typed by the user first time
- Whatever is typed by the user second time
- Undefined behaviour


Question:
What will be the output of the following C code?
    #include <stdio.h>    int main()    {        char n[20];        fgets(n, 19, stdin);        ungetc(n[0], stdin);        scanf("%s", n);        printf("%s\n", n);        return 0;    }

Choices:
- Compile time error
- Whatever string user types second time
- Whatever string user types first time
- First character of whatever user types first time and whatever user types second time


Question:
What will be the output of the following C code considering user typed jkl?
    #include <stdio.h>    int main()    {        char n[20];        fgets(n, 19, stdin);        ungetc(n[0], stdin);        printf("%s\n", n);        return 0;    }

Choices:
- jkl
- kl
- Undefined behaviour
- jk


Question:
Which of the following is the correct syntax for calling function ungetc?
Assume int c and FILE *fp

Choices:
- ungetc(c,*fp);
- ungetc(c, fp);
- ungetc(fp, c);
- ungetc(*fp,c);


Question:
What does the ungetc function return for the following C expression?
ungetc(c, fp);//where declarations are int c and FILE *fp

Choices:
- It returns character c
- It returns EOF for an error
- Both returns character c and returns EOF for an error
- Either returns character c or returns EOF for an error


Question:
What will be the output of the following C statement?
int ungetc(int c, FILE *fp)

Choices:
- Either c or EOF for an error
- Nothing
- fp
- None of the mentioned


Question:
What will be the output of the following C code?
    #include <stdio.h>    void main()    {        char *p = calloc(100, 1);        p = "welcome";        printf("%s\n", p);    }

Choices:
- Segmentation fault
- Garbage
- Error
- welcome


Question:
Why do we write (int *) before malloc?
int *ip = (int *)malloc(sizeof(int));

Choices:
- It is for the syntax correctness
- It is for the type-casting
- It is to inform malloc function about the data-type expected
- None of the mentioned


Question:
What will be the output of the following C code?
    #include <stdio.h>    struct p    {        struct p *next;        int x;    };    int main()    {        struct p *p1 = calloc(1, sizeof(struct p));        p1->x = 1;        p1->next = calloc(1, sizeof(struct p));        printf("%d\n", p1->next->x);        return 0;    }

Choices:
- Compile time error
- 1
- Somegarbage value
- 0


Question:
What will be the output of the following C code?
     #include <stdio.h>    struct p    {        struct p *next;        int x;    };    int main()    {        struct p* p1 = malloc(sizeof(struct p));        p1->x = 1;        p1->next = malloc(sizeof(struct p));        printf("%d\n", p1->next->x);        return 0;    }

Choices:
- Compile time error
- 1
- Somegarbage value
- 0


Question:
What if size is zero in the following C statement?
realloc(ptr, size)

Choices:
- Allocate a memory location with zero length
- Free the memory pointed to by ptr
- Undefined behaviour
- Doesn’t do any reallocation of ptr i.e. no operation


Question:
What will be the output of the following C code?
    #include <stdio.h>    #include <math.h>    int main()    {        int i = 90;        printf("%f\n", sin(i));        return 0;    }

Choices:
- Compile time error
- Undefined behaviour
- 0.893997
- 1.000000


Question:
What will be the output of the following C code?
    #include <stdio.h>    #include <math.h>    int main()    {        unsigned int i = -1;        printf("%f\n", fabs(i));        return 0;    }

Choices:
- Compile time error
- 1
- -1
- None of the mentioned


Question:
What will be the output of the following C code?
    #include <stdio.h>    #include <math.h>    int main()    {        int i = 10;        printf("%f\n", log10(i));        return 0;    }

Choices:
- Compile time error
- 1.000000
- 2.302585
- None of the mentioned


Question:
What will be the output of the following C code?
    #include <stdio.h>    #include <math.h>    void main()    {        int k = pow(2, 3);        printf("%d\n", k);    }

Choices:
- 9
- 8
- -1
- 6


Question:
What will be the output of the following C code?
    #include <stdio.h>    #include <math.h>    void main()    {        int k = fabs(-87);        printf("%d\n", k);    }

Choices:
- -87
- 87
- 78
- error


Question:
What will be the output of the following C code?
    #include <stdio.h>    #include <math.h>    void main()    {        int k = sqrt(-4);        printf("%d\n", k);    }

Choices:
- -2
- 2
- Compile time error
- NaN


Question:
What will be the output of the following C code?
    #include <stdio.h>    #include <stdlib.h>    int main()    {        printf("%d\n", rand() % 1000);        return 0;    }

Choices:
- Compile time error
- An integer between 0-1000
- An integer between 0-999 including 0 and 999
- An integer between 0-1000 including 1000


Question:
What will be the output of the following C code?
    #include <stdio.h>    #include <stdlib.h>    int main()    {        srand(9000);        printf("%d\n", rand());        return 0;    }

Choices:
- Compile time error
- An integer in the range 0 to RAND_MAX
- A double in the range 0 to 1
- A float in the range 0 to 1


Question:
What will be the output of the following C code?
    #include <stdio.h>    int main()    {        printf("%d\n", srand(9000));        return 0;    }

Choices:
- Compile time error
- An integer in the range 0 to 9000
- A float in the range 0 to 1
- A double in the range 0 to 9000


Question:
What will be the output of the following C code?
    #include <stdio.h>    int main()    {        srand(time(NULL));        printf("%d\n", rand());        return 0;    }

Choices:
- Compile time error
- An integer in the range 0 to RAND_MAX
- A double in the range 0 to 1
- A float in the range 0 to 1


Question:
In the below C program, every time program is run different numbers are generated.
    #include <stdio.h>    #include <stdlib.h>    int main()    {        printf("%d\n", rand());        return 0;    }

Choices:
- True
- False
- Depends on the platform
- Depends on the compiler


Question:
In the following C program, every time program is run different numbers are generated.
    #include <stdio.h>    int main()    {        srand(time(NULL));        printf("%d\n", rand());        return 0;    }

Choices:
- True
- False
- Depends on the platform
- Depends on the compiler


Question:
Select the right explanation to the given code.
printf(“%*. *f”, 5,4,5700);

Choices:
- the minimum field width has to be 4, the precision is given to be 5, and the value to be displayed is 5700
- the minimum field width is 5, the precision is 4, and the value to be displayed is 5700
- compile error
- run-time error


Question:
What will be the output of the following C code?
char str[] = "Hello Nancy“;
printf(“\n %.7s”, str) ;

Choices:
- Hello Nan
- Hello
- Hello N
- Hello Nancy


Question:
What will be the output of the following C code?
char str[] =”Too Good”;
printf(“\n %7s”,str);

Choices:
- Too Good
- Too G
- Too Go
- Too


Question:
What will be the output of the following C code?
printf(“\n Output: %5d \t %x \t %#x”, 234,234,234);

Choices:
- Output:234EA0xEA
- Output:00234 EA 0xEA
- Output:    234 EA 0xEA
- ERROR


Question:
What will be the output of the following C code?
char str[] =”Good”;
scanf(“%s”, str);

Choices:
- compile error
- run-time error
- good
- logical error


Question:
What will be the output of the following C code?
scanf(“ %d %d %d”,&n1,&n2);

Choices:
- read data for two
- generate error
- read data for three
- nothing can be said


Question:
What form the data must be entered for the given C code?
scanf(“%d / %d”, &n1,&n2);

Choices:
- 6  9
- 6/9
- compile error
- run-time error


Question:
If the user enters 1 3.2 s, what value will be returned by the scanf()?
scanf("%d %f %c", &s1, &s2, &s3);

Choices:
- 1
- 2
- 3
- No return value


Question:
If the user enters 1 s 3.2, what value will be returned by the scanf()?
scanf("%d %f %c", &a, &b, &c);

Choices:
- 1
- 2
- 3
- no return value


Question:
What does the C statement given below says?
scanf("%7s",ch);

Choices:
- read string with minimum 7 characters.
- read string with maximum 7 characters
- read string exactly to 7 characters
- read string with any number of characters


Question:
What is the meaning of the following C statement?
scanf("%[^\n]s", ch);

Choices:
- read all character except new line
- read all characters
- read only new line character
- syntax error


Question:
What does the following C code snippet mean?
char *gets(char *s)

Choices:
- reads the next input line into the array s
- writes the line into the array s
- reads the next input character into the array s
- write a character into the array


Question:
Select the right explanation for the following C code snippet.
int fgetpos(FILE *stream, fpos_t *s)

Choices:
- records the current position in stream in *s
- sets the file position for stream in *s
- positions stream at the position recorded in *s
- reads from stream into the array ptr


Question:
What does the following C code snippet mean?
int ungetc(int c, FILE *stream)

Choices:
- pushes c back onto a stream
- deletes c from the stream
- reads frequency of c in stream
- no action is taken by the command


Question:
In the following C code, the union size is decided by?
    union temp    {        char a;        int b;        float c;    };

Choices:
- char
- int
- float
- both int and float


Question:
What will be the output of the following C code?
    #include <stdio.h>
    printf("%.0f", 2.89);

Choices:
- 2.890000
- 2.89
- 2
- 3


Question:
What will be the output of the following C code?
    #include <stdio.h>    int main()    {        float a = 2.455555555555;        printf("%f", a);    }

Choices:
- 2.455555
- 2.455556
- 2.456
- 2.46


Question:
What will be the output of the following C code?
    #include <stdio.h>
    printf("%d", sizeof('a'));

Choices:
- 1
- 2
- 4
- None of the mentioned


Question:
What will be the output of the following C code?
    #include <stdio.h>    union temp    {        char a;        char b;        int c;    }t;    int main()    {        printf("%d", sizeof(t));        return 0;    }

Choices:
- 1
- 2
- 4
- 6


Question:
What will be the size of the following C structure?
    #include <stdio.h>    struct temp    {        int a[10];        char p;    };

Choices:
- 5
- 11
- 41
- 44


Question:
What will be the output of the following C code?
    #include <stdio.h>    main()    {        int a = 1;        printf("size of a is %d, ", sizeof(++a));        printf("value of a is %d", a);    };

Choices:
- size of a is 4, value of a is 1
- size of a is 4, value of a is 2
- size of a is 2, value of a is 2
- size of a is 2, value of a is 2


Question:
What will be the output of the following C code?
    #include <stdio.h>    printf("%d", sizeof(strlen("HELLOWORLD")));

Choices:
- Output, 4
- Output, 10
- Output, 16
- Error, sizeof cannot evaluate size of a function


Question:
What will be the output of the following C code?
    #include <stdio.h>    (sizeof double = 8, float = 4, void = 1)    #define PI 3.14    int main()    {        printf("%d", sizeof(PI));    }

Choices:
- Output is 8
- Output is 4
- Output is 1
- Error, we can’t use sizeof on macro-definitions


Question:
What will be the output of the following C code?
#include<stdio.h>
enum colour
{
    blue, red, yellow
};
main()
{
    enum colour c;
    c=yellow;
    printf("%d",c);
}

Choices:
- 1
- 2
- 0
- Error


Question:
Point out the error (if any) in the following C code?
#include<stdio.h>
enum hello
{
    a,b,c;
};
main()
{
    enum hello m;
    printf("%d",m);
}

Choices:
- No error
- Error in the statement: a,b,c;
- Error in the statement: enum hello m;
- Error in the statement: printf(“%d”,m);


Question:
What will be the output of the following C code?
#include<stdio.h>
enum sanfoundry
{
    a=2,b=3.56
};
enum sanfoundry s;
main()
{
    printf("%d%d",a,b);
}

Choices:
- 2	3
- 0	1
- 2	3.56
- Error


Question:
What will be the output of the following C code?
#include<stdio.h>
enum class
{
    a,b,c
};
enum class m;
main()
{
    printf("%d",sizeof(m));
}

Choices:
- 3
- Same as the size of an integer
- 3 times the size of an integer
- Error


Question:
What will be the output of the following C code?
#include<stdio.h>
enum hi{a,b,c};
enum hello{c,d,e};
main()
{
    enum hi h;
    h=b;
    printf("%d",h);
    return 0;
}

Choices:
- 2
- 1
- Error
- 0


Question:
What will be the output of the following C code?
#include<stdio.h>
enum sanfoundry
{
    a,b,c=5
};
enum sanfoundry s;
main()
{
    c++;
    printf("%d",c);
}

Choices:
- Error
- 5
- 6
- 2


Question:
What will be the output of the following C code?
main()
{
    enum resut {pass, fail};
    enum result s1,s2;
    s1=pass;
    s2=fail;
    printf("%d",s1);
}

Choices:
- error
- pass
- fail
- 0


Question:
What will be the output of the following C code?
#include <stdio.h>
enum example {a = 1, b, c};
enum example example1 = 2;
enum example answer()
{
    return example1;
}

int main()
{
   (answer() == a)? printf("yes"): printf("no");
   return 0;
}

Choices:
- yes
- no
- 2
- error


Question:
What will be the output of the following C code?
#include<stdio.h>
#define MAX 4
enum sanfoundry
{
    a,b=3,c
};
main()
{
    if(MAX!=c)
        printtf("hello");
    else
        printf("welcome");
}

Choices:
- error
- hello
- welcome
- 2


Question:
Point out the error( if any) in the following code.
#include<stdio.h>
enum sanfoundry
{
    a,b,c
};
enum sanfoundry g;
main()
{
    g++;
    printf("%d",g);
}

Choices:
- Error in the statement: a,b,c
- Error in the statement: enum sanfoundry g;
- Error in the statement: g++
- No error


Question:
What will be the output of the following C code if input given is 2?
#include<stdio.h>
enum day
{
    a,b,c=5,d,e
};
main()
{
    printf("Enter the value for a");
    scanf("%d",a);
    printf("%d",a);
}

Choices:
- 2
- 0
- 3
- Error


Question:
What will be the output of the following C code if the code is executed on a 32 bit platform?
#include <stdio.h>
enum sanfoundry
 {
    c = 0,
    d = 10,
    h = 20,
    s = 3
} a;

int main()
{
        a = c;
	printf("Size of enum variable = %d bytes", sizeof(a));
	return 0;
}

Choices:
- Error
- Size of enum variable = 2 bytes
- Size of enum variable = 4 bytes
- Size of enum variables = 8 bytes


Question:
What will be the output of the following C code?
#include<stdio.h>
enum sanfoundry
{
    a=1,b,c,d,e
};
int main()
{
    printf("%d",b*c+e-d);
}

Choices:
- Error
- 7
- 2
- 4


Question:
What will be the output of the following C code?
#include<stdio.h>
enum sanfoundry
{
    a,b,c=5
};
int main()
{
    enum sanfoundry s;
    b=10;
    printf("%d",b);
}

Choices:
- Error
- 10
- 1
- 4


Question:
What will be the output of the following C code?
#include<stdio.h>
enum sanfoundry
{
    a=1,b
};
enum sanfoundry1
{
    c,d
};
int main()
{
    enum sanfoundry1 s1=c;
    enum sanfoundry1 s=a;
    enum sanfoundry s2=d;
    printf("%d",s);
    printf("%d",s1);
    printf("%d",s2);
}

Choices:
- Error
- 011
- 110
- 101


Question:
What will be the output of the following C code?
#include<stdio.h>
main()
{
    typedef int a;
    a b=2, c=8, d;
    d=(b*2)/2+8;
    printf("%d",d);
}

Choices:
- 10
- 16
- 8
- error


Question:
WWhat will be the output of the following C code? (If the name entered is: Sanfoundry)
#include<stdio.h>
#include<string.h>
typedef struct employee
{
    char  name[50];
    int   salary;
} e1;
void main( )
{
    printf("Enter Employee name");
    scanf("%s",e1.name);
    printf("\n%s",e1.name);
}

Choices:
- Sanfoundry.name
- nSanfoundry
- Sanfoundry
- Error


Question:
What is the size of myArray in the code shown below? (Assume that 1 character occupies 1 byte)
typedef char x[10];
x myArray[5];

Choices:
- 5 bytes
- 10 bytes
- 40 bytes
- 50 bytes


Question:
What will be the output of the following C code?
#include<stdio.h>
int main()
{
    typedef union a
    {
        int i;
        char ch[2];
    }hello;
    hello u;
    u.ch[0] = 3;
    u.ch[1] = 2;
    printf("%d, %d", u.ch[0], u.ch[1]);
    return 0;
}

Choices:
- 2, 3
- 3, 2
- 32
- error


Question:
What will be the output of the following C code?
const char pla[] = "string1";
const char src[] = "string2";
printf("Before memmove place= %s, src = %s\n", pla, src);
memmove(pla, src, 7);
printf("After memmove place = %s, src = %s\n", pla, src);

Choices:
- Before memmove place= string1, src = string2 After memmove place = string2, src = string2
- Before memmove place = string2, src = string2 After memmove place= string1, src = string2
- Before memmove place = string2, src = string1 After memmove place= string2, src =string2
- Before memmove place= string1, src = string2 After memmove place=string1, src = string1


Question:
What will be the output of the following C code?
const char str1[]="ABCDEF1234567";
const char str2[] = "269";
len = strcspn(str1, str2);
printf("First matching character is at %d\n", len + 1);

Choices:
- First matching character is at 8
- First matching character is at 7
- First matching character is at 9
- First matching character is at 12


Question:
What will be the output of the following C code?
const char str1[] = "abcdef";
const char str2[] = "fgha";
char *mat;
mat= strpbrk(str1, str2);
if(mat)
printf("First matching character: %c\n", *mat);
else
printf("Character not found");

Choices:
- g
- a
- h
- f


Question:
What will be the output of the following C code?
char str1[] = "Helloworld ";
char str2[] = "Hello";
len = strspn(str1, str2);
printf("Length of initial segment matching %d\n", len );

Choices:
- 6
- 5
- 4
- no match


Question:
What will be returned in the following C code?
size- t strlen(const char *s)
const char *sc;
for(sc = s; *sc!= ' \ O ' ; ++sc)
return(sc - s) ;

Choices:
- number of characters equal in sc
- length of string s
- doesn’t return any value
- displays string s


Question:
What will the following C code do?
char * strrchr(const char *s, int c )
char ch = c;
char *sc;
for(sc = NULL; ; ++s)
if(*s == ch)
SC = 9;
i f (*s =='\O' )
return (( char *) s);

Choices:
- find last occurrence of c in char s[ ].
- find first occurrence of c in char s[ ].
- find the current location of c in char s[ ].
- There is error in the given code


Question:
What will be the output of the following C code?
char str1[15];
char str2[15];
int mat;
strcpy(str1, "abcdef");
strcpy(str2, "ABCDEF");
mat= strncmp(str1, str2, 4);
if(mat< 0)
printf("str1 is not greater than str2");
else if(mat> 0)
printf("str2 is is not greater than str1");
else
printf("both are equal");

Choices:
- str1 is not greater than str2
- str2 is not greater than str1
- both are equal
- error in given code


Question:
What will be the output of the following C code?
void *memset(void *c, int c, size-t n)
unsigned char ch = c;
unsigned char *su;
for (su = s; 0 < n; ++su, --n)

*su = ch;

Choices:
- store c throughout unsigned char s[n]
- store c throughout signed char s[n]
- find first occurrence of c in s[n]
- find last occurrence of c in s[n]


Question:
What will be the output of the following C code?
const char str1[10]="Helloworld";
const char str2[10] = "world";
char *mat;
mat = strstr(str1, str2);
printf("The substring is:%s\n", mat);

Choices:
- The substring is:world
- The substring is:Hello
- The substring is:Helloworld
- error in the code


Question:
What will the given C code do?
int memcmp(const void *str1, const void *str2, size_t n)

Choices:
- compares the first n bytes of str1 and str2
- copies the first n bytes of str1 to str2
- copies the first n bytes of str2 to str1
- invalid function


Question:
What does the following C code do?
int iscntrl( int c);

Choices:
- checks if character is upper case
- checks if character is lower case
- tests for any control character
- no function as such


Question:
What do the following C function do?
int isgraph(int c);

Choices:
- tests for only space character
- tests for only digit
- tests for only lower case
- tests for any printing character


Question:
What will be the output of the following C code?
int ch= ' ';
if(isgraph(ch))
printf("ch = %c can be printed \n",ch);
else
printf("ch=%c cannot be printed \n",ch);

Choices:
- ch = ‘ ‘ can be printed
- ch = ‘ ‘ cannot be printed
- compile error
- run-time error


Question:
What will be the output of the following C code?
char ch[ ] = "0xC";
if(isxdigit(ch[ ]))
printf("ch = %s is hexadecimal character \n",ch);
else
printf("ch = %s is not hexadecimal character \n",ch);

Choices:
- ch = 0xC is hexadecimal character
- ch = 0xC is not hexadecimal character
- compile error
- run-time error


Question:
What will be the output of the following C code?
int i = 0;
char c;
char str[ ] = "Little Star";
while(str[i])
{
putchar (toupper(str[i]));
i++;
}

Choices:
- little star
- lITTLE sTAR
- LITTLE STAR
- Little Star


Question:
What will be the output of the following C code?
int ch = '\t';
if(isprint(ch))
printf("ch = |%c| printable  \n", ch);
else
printf("ch= |%c| not printable \n",ch);

Choices:
- ch = |\t| printable
- ch = |\t| not printable
- ch = |    | printable
- ch = |    | not printable


Question:
What will be the output of the following C code?
errno = 0;
y = sqrt(2);
if(errno == EDOM)
printf("Invalid value\n");
else
printf("Valid value\n");

Choices:
- Invalid value
- Valid value
- No output
- Compile error


Question:
What will be the output of the following C code?
errno = 0;
y = sqrt(-10);
if(errno == EDOM)
printf("Invalid value \n");
else
printf("Valid value\n");

Choices:
- Invalid value
- Valid value
- No output
- Compile error


Question:
What will be the output of the following C code?
double x, deg, rad;
x = 1.0;
val = 180.0 / 3.14;
deg = atan (x) * val;
printf("The arc tangent of %lf is %lf degrees", x, deg);

Choices:
- The arc tangent of 1.000000 is 45.000000 degrees
- The arc tangent of 1.000 is 45.000degrees
- The arc tangent of 1 is 45 degrees
- The arc tangent of 1.0000is 45.0000degrees


Question:
What does the given C code do?
double atan2 (double y, double x);

Choices:
- The atan2 function returns the arc tangent of x/y
- The atan2 function returns the arc tangent of x
- The atan2 function returns the arc tangent of y/x
- The atan2 function returns the arc tangent of y


Question:
What will be the output of the following C code?
double log (double -x);

Choices:
- returns natural logarithm of x
- range error
- domain error
- returns natural logarithm of -x


Question:
Which of the following statement is correct?
    double x, y, z;
    x = 5.123456;
    z= modf(x, *y);

Choices:
- y stores integer part of x, z returns fractional part of x
- y stores integer part of x, z returns integer part of x
- y stores fractional part of x, z returns integer part of x
- y stores fractional part of x, z returns fractional part of x


Question:
What will be the output of the following C code?
    double x=1.2
    printf("%.1lf", ceil(x));

Choices:
- 1
- 2
- 1.0
- 2.0


Question:
What will be the output of the following C code?
    double x=3,y= - 6;
    printf("%lf %lf", fabs(x), fabs(y));

Choices:
- 3  6
- -3  6
- 3.0  6.0
- 3.000000  6.000000


Question:
What will be the output of the following C code?
double x=1.8;
printf("%.2lf",floor(x));

Choices:
- 2.0
- 2.00
- 1.0
- 1.00


Question:
Which of the given C function can be used instead of the apparent identity pointed to by y?
int x=1;
double y= 0.5 * (exp (x) + exp (-x));

Choices:
- cos(x)
- cosh(x)
- fmod(x)
- modf(x)


Question:
What will be the output of the following C code?
char str[20];
str= "123546"; res= atof(str);
printf("String value = %s, Float value = %f\n", str, res);

Choices:
- String value = 123546, Float value = 123546.0
- String value = 123546 , Float value = 123546.000000
- String value = 123546 , Float value = 0.000000
- String value = 123546 , Float value = 123546.000


Question:
What will be the output of the following C code?
char str[];
strcpy(str, "Hello");
res = atof(str);
printf("String value = %s, Float value = %f\n", str, res);

Choices:
- String value = Hello, Float value = 0.000000
- String value = Hello, Float value = 0
- String value = “Hello” , Float value = 0.000000
- String value = “Hello” , Float value = 0


Question:
What will be the output of the following C code?
char str[20];
strcpy(str, "123456");
res = atoi(str);
printf("%s  %d\n", str, res);

Choices:
- 123456  0
- 123456  0.0
- 123456  123456
- 123456 123456.0


Question:
What will be the output of the following C code?
char str[] ;
strcpy(str, "Hello");
res = atoi(str);
printf(" %s  %d\n", str, res);

Choices:
- Hello  0.000000
- “Hello”  0.000000
- Hello   0
- “Hello” 0


Question:
What will be the output of the following C code?
char word[20 ] = "1.234555 WELCOME";
char *w; double dis;
dis= strtod(word, &w);
printf("The number is %lf\n", dis);
printf("String  is |%s|", w);

Choices:
- The number is 1.234555 String  is |WELCOME|
- The number is 1.2345550 String  is |WELCOME|
- The number is 1.234555 String  is |1.234555 WELCOME|
- Errror


Question:
Which statement is correct work reference to endptr?
double strtod(const char *nptr, char **endptr);

Choices:
- A pointer to the starting string is stored in the object pointed to by endptr, provided that endptr is a null pointer
- A pointer to the ﬁnal string is stored in the object pointed to by endptr, provided that endptr is not a null pointer
- A pointer to the final string is stored in the object pointed to by endptr, provided that endptr is a null pointer
- A pointer to the starting string is stored in the object pointed to by endptr, provided that endptr is not a null pointer


Question:
What will be the output of the following C code?
int main(void)
{
    int rc;
    rc = system("time");
    exit(0);
}

Choices:
- produces error
- no value is returned
- returns the time
- nothing can be said


Question:
What will the given C code do?
#include <stdlib.h>
_Mbsave_Mbxlen={0};
int (mblen)(const char *s ,size_t n)
{
return(_Mbtowc(NULL s,n,&_Mbxlen));
}

Choices:
- determine length of next multibyte code
- determine next multibyte code
- translate multibyte string to wide char string
- translate wide character to multibyte string


Question:
What is the purpose of the given C code?
#include <stdlib.h>
_Mbsave _Mbxtowc = {0};
int (mbtowc) (wchar_t *pwc, const char *a, size_t n)
{
return (-Mbtowc (pwc, s, n, &-Mbxtowc) ) ;
}

Choices:
- determine length of next multibyte code
- translates multibyte character to wide character
- translate multibyte string to wide char string
- translate wide character to multibyte string


Question:
What is “a” in the given C code?
size_t wcstombs(char *s, const wchar_t *a, size_t n)

Choices:
- “a” is wide character string to be converted
- “a” is pointer to an array of char elements
- “a” is pointer to the first byte of a multi-byte character
- “a” C multibyte character string to be interpreted


Question:
What will the following C code do on compilation?
void main ()
{
   char com[50];
   strcpy( com, "dir" );
   system(com);
}

Choices:
- error
- lists down all the files and directories in the current directory under windows machine
- terminates the calling process immediately
- calls specified function and terminates it at the end of the program


Question:
Which line from the given code is the passive form?
#undef assert
#ifdef NDEBUG
#define assert (test) ( (void) 0)
#else
#define assert (test)
#endif

Choices:
- #define assert(test)
- #define assert(test) ((void)0)
- #ifdef NDEBUG
- #undef assert


Question:
What will be the output of the following C code?
#include <assert. h>
#include <stdio . h>
 #include <stdlib.h>
void -Assert (char *mesg)
{
   fputs (mesg, stderr);
   fputs (" -- assertion failed\n" , stderr);
   abort () ;
}

Choices:
- prints only assertion message
- program is just aborted
- prints assertion message and aborts
- no action takes place


Question:
What is the role of the given C function?
void va_end(va_list ap)

Choices:
- allows a function with variable arguments which used the va_start macro to return
- retrieves the next argument in the parameter list
- initializes ap variable to be used with the va_arg and va_start macros
- returns the next additional argument as an expression


Question:
What will the following C statement do?
#include < setjmp.h >
int setjmp(jmp_buf env);

Choices:
- save the current state of the registers into env
- resets the registers to the values saved in env
- provides a definition for env structure
- accept variable(env) argument lists to be written


Question:
What will be the output of the following C code?
#include <stddef.h>
int main(void)
{
    int num[10];
    int *p1=&num[14], *p2=&num[19];
    ptrdiff_t a = p1-p2;
    printf("%d", a);
}

Choices:
- 5
- -5
- error
- 10


Question:
What will be the output of the following C code?
#include <stddef.h>
int main(void)
{
    int num[15];
    int *p1=&num['a'], *p2=&num['A'];
    ptrdiff_t d = p1-p2;
    printf("%d", d);
}

Choices:
- 15
- -32
- 32
- error


Question:
Point out the error (if any) in the following C code?
#include <stdlib.h>
#include <stdio.h>
int main(void)
{
    int* p = NULL;
    struct S *s = NULL;
    void(*f)(int, double) = NULL;
    char *ptr = malloc(15);
    if (ptr == NULL) printf("Out of memory");
    free(ptr);
}

Choices:
- Error in the statement: void(*f)(int, double) = NULL;
- Error in the statement: char *ptr = malloc(15);
- Error in the statement: struct S*s = NULL;
- No error


Question:
What will be the output of the following C code? (By date we mean: date, month and year)
#include<stdio.h>
#include<stdlib.h>
#include<time.h>
int main()
{
    time_t ct;
    time(&ct);
    printf("%s\n",ctime(&ct));
}

Choices:
- only current date
- only current date and current time
- current date, current time and the day of the week
- only current time


Question:
What will be the output of the following C code if the current system date is 6/22/2017?
#include<stdio.h>
#include<stdlib.h>
#include<time.h>
int main()
{
    time_t ct;
    time(&ct);
    struct tm *mt=localtime(&ct);
    printf("%d\n",mt-> tm_mon+2);
}

Choices:
- 8
- 7
- 5
- 6


Question:
What will be the output of the following C code if the current system date is 6/22/2017?
#include<stdio.h>
#include<stdlib.h>
#include<time.h>
typedef struct tm tm;
int main()
{
    time_t ct;
    time(&ct);
    tm *mt=localtime(&ct);
    printf("%d\n",mt-> tm_year);
}

Choices:
- 17
- 2017
- error
- 117


Question:
What will be the output of the following C code if the current system date is 6/22/2017?
#include<stdio.h>
#include<stdlib.h>
#include<time.h>
int main()
{
    time_t ct;
    time(&ct);
    struct tm *mt=localtime(&ct);
    printf("%d\n",mt-> tm_date);
}

Choices:
- 22
- 6
- 22/6
- error


Question:
What will be the output of the following C code?
#include<time.h>
int main (void)
{
    float n = time(NULL);
    printf("%.2f\n" , n);
}

Choices:
- time in seconds from 1 January, 1970
- time in minutes from 1 January, 1970
- time in seconds from 1 January, 1980
- time in minutes from 1 January, 1980


Question:
What will be the output of the following C code if the system date is 6/2/2017(Friday)?
#include<stdio.h>
#include<time.h>
int main()
{
    struct tm *local, *gm;
    time_t t;
    t=time(NULL);
    local=localtime(&t);
    printf("%d",local->tm_wday);
    return 0;
}

Choices:
- 6
- 5
- error
- 0


Question:
What will be the output of the following C code if it is executed on 2nd January, 2017 (system date)?
#include<stdio.h>
#include<time.h>
int main()
{
    struct tm *local, *gm;
    time_t t;
    t=time(NULL);
    local=localtime(&t);
    printf("%d",local->tm_yday);
    return 0;
}

Choices:
- 0
- 1
- 2
- Error


Question:
What will be the output of the following C code if the system time is 4:27 PM?
#include<stdio.h>
#include<time.h>
int main()
{
    struct tm *ptr;
    time_t t;
    char str[100];
    t = time(NULL);
    ptr = localtime(&t);
    strftime(str,100,"%H %p %M minutes",ptr);
    puts(str);
    return 0;
}

Choices:
- 16 27 minutes
- 4 27 minutes
- 16 PM 27 minutes
- 4 PM 27 minutes


Question:
What will be the output of the following C code if the system date is 8/22/2016?
#include<stdio.h>
#include<time.h>
int main()
{
    struct tm *ptr;
    time_t t;
    char str[100];
    t = time(NULL);
    ptr = localtime(&t);
    strftime(str,100,"%B",ptr);
    puts(str);
    return 0;
}

Choices:
- 9
- August
- Aug
- Error


Question:
What will be the output of the following C code  if the system date is 6/2/2017 (Friday)?
#include<stdio.h>
#include<time.h>
int main()
{
    struct tm *ptr;
    time_t t;
    char str[100];
    t = time(NULL);
    ptr = localtime(&t);
    strftime(str,100,"%A",ptr);
    puts(str);
    return 0;
}

Choices:
- Error
- Fri
- Friday
- 6


Question:
What will be the output of the following C code?
#include<stdio.h>
#include<time.h>
main()
{
    struct tm t;
    time_t tc;
    t.tm_year=2017-1900;
    t.tm_mday=25;
    t.tm_mon=5;
    t.tm_hour=1;
    t.tm_min=30;
    t.tm_sec=0;
    t.tm_isdst=0;
    tc=mktime(&t);
    printf(ctime(&tc));
}

Choices:
- Sun Jun 25 01:30:00 2017
- Sun June 25 1:30 2017
- Sun Jun 25 1:30 117
- Sun June 25 1:30:00 117


Question:
What will be the output of the following C code if the name entered is “TOM” and time taken to enter this name is 2 seconds?
#include <stdio.h>
#include <time.h>
int main ()
{
	time_t time1,time2;
	char get_input [256];
	double dif_sec;
	time (&time1);
	printf ("Please enter the name of your pet: ");
	gets (get_input);
	time (&time2);
	dif_sec = difftime (time2,time1);
	printf ("%.2f\n", dif_sec );
	return 0;
}

Choices:
- Error
- 2
- 2.0
- 2.00


Question:
What will be the output of the following C code, if the system date is 6/23/2017?
#include<stdio.h>
#include<time.h>
int main()
{
    struct tm *local;
    time_t t;
    t=time(NULL);
    local=localtime(&t);
    printf("%d",local->tm_mday);
    return 0;
}

Choices:
- 6
- 22
- 23
- error


Question:
What will be the output of the following C code, if the system date is 6/24/2017?
#include<stdio.h>
#include<stdlib.h>
#include<time.h>
int main()
{
    time_t ct;
    time(&ct);
    printf("%s\n",(&ct));
}

Choices:
- Error
- Junk value
- 6
- June


Question:
What is the meaning of the following C code if output is 0?
#include<stdio.h>
#include<time.h>
int main()
{
    struct tm *local;
    time_t t;
    t=time(NULL);
    local=localtime(&t);
    printf("%d",local->tm_isdst);
    return 0;
}

Choices:
- DST is in effect
- DST status is unknown
- DST is not in effect
- DST is corresponding with local time


Question:
What will be the output of the following C code if the system time is 1:52 PM (Sunday)?
#include<stdio.h>
#include<time.h>
int main()
{
    struct tm *ptr;
    time_t t;
    char str[100];
    t = time(NULL);
    ptr = localtime(&t);
    strftime(str,100,"%I",ptr);
    puts(str);
    return 0;
}

Choices:
- 13
- 01
- 1
- error


Question:
What will be the output of the following C code?
#include <stdio.h>
#include <time.h>
int main ()
{
	double d;
	d = difftime (5,17);
	printf ("%.2f\n", d );
	return 0;
}

Choices:
- 12.00
- -12.00
- Error
- 12


Question:
What will be the output of the following C code?
#include <stdio.h>
#include <limits.h>
int main()
{
    printf("The minimum value of LONG = %lf\n", LONG_MIN);
    return 0;
}

Choices:
- -2147483648 (The minimum value of LONG)
- 0.000000
- 0
- error


Question:
What will be the output of the following C code?
#include<stdio.h>
#include<limits.h>
main()
{
    printf("%f",FLT_MIN);
}

Choices:
- Minimum negative value of float
- Maximum positive value of float
- Error
- Minimum positive value of float


Question:
What will be the output of the following C code, given that the maximum value of signed char is 127 and that of unsigned char is 255.
#include<stdio.h>
#include<limits.h>
#define SCHAR_MAX
main()
{
    printf("%d",SCHAR_MAX+1);
}

Choices:
- 256
- Error
- 1
- 128


Question:
What will be the output of the following C code?
#include<stdio.h>
#include<limits.h>
main()
{
    if(UCHAR_MAX<=SCHAR_MAX)
        printf("hello");
    else
        printf("good");
}

Choices:
- error
- hello
- good
- hellogood


Question:
Given that the value of SHRT_MAX is equal to 32767 and that of SHRT_MIN is equal to -32768, What will be the output of the following C code?
#include<stdio.h>
#include<limits.h>
main()
{
    int d;
    d=SHRT_MAX + SHRT_MIN+1;
    printf("%d",d);
}

Choices:
- -1
- error
- 1
- 0


Question:
What will be the output of the following C code?
#include<stdio.h>
#include<limits.h>
main()
{
    int d;
    d=CHAR_MIN;
    printf("%d",d);
}

Choices:
- 0
- -128
- error
- -1


Question:
What will be the output of the following C code?
Maximum value of int  =  1000
Maximum value of float = 5000
Maximum value of short int = 327
Minimum value of short int = -328
#include<stdio.h>
#include<limits.h>
#include<float.h>
main()
{
    short int d;
    d=INT_MAX + FLT_MAX;
    printf("%d",d);
}

Choices:
- error
- 6000
- 327
- -328


Question:
What will be the output of the following C code if the value of UCHAR_MAX is 127?
#include<stdio.h>
#include<limits.h>
int main()
{
    int d;
    d=CHAR_MAX;
    printf("%c",d);
}

Choices:
- Error
- 127
- Alphabet corresponding to the value 127
- Junk value


Question:
What will be the output of the following C code if the input entered as first and second number is 5 and 6 respectively?
#include<stdio.h>
#include<stdlib.h>
main()
{
    int *p;
    p=(int*)calloc(3*sizeof(int));
    printf("Enter first number\n");
    scanf("%d",p);
    printf("Enter second number\n");
    scanf("%d",p+2);
    printf("%d%d",*p,*(p+2));
    free(p);
}

Choices:
- 56
- Address of the locations where the two numbers are stored
- 57
- Error


Question:
What will happens if the statement free(a) is removed in the following C code?
#include<stdio.h>
#include<stdlib.h>
main()
{
    int *a;
    a=(int*)malloc(sizeof(int));
    *a=100;
    printf("*a%d",*a);
    free(a);
    a=(int*)malloc(sizeof(int));
    *a=200;
    printf("a%p",a);
    *a=200;
    printf("a%d",*a);
}

Choices:
- Error
- Memory leak
- Dangling pointer arises
- 200 is printed as output


Question:
What will be the output of the following C code?
#include<stdio.h>
#include<stdlib.h>
void main()
{
    char *p = calloc(100, 1);
    p = "welcome";
    printf("%s\n", p);
}

Choices:
- error
- welcome
- memory location stored by the pointer
- junk value


Question:
The following C code is an example of __________
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
main()
{
    char *p,*q;
    p=(char*)malloc(3*sizeof(char));
    q=p;
    strcpy(p,"hello");
    printf("p=%s",p);
    printf("q=%s",q);
    free(q);
    q=NULL;
    gets(p);
    gets(q);
    printf("%s",p);
    printf(“%s”,q);
}

Choices:
- Memory leak
- Dangling pointer
- Static memory allocation
- Linked list


Question:
What will be the output of the following C code if it is executed on a 32 bit processor?
#include<stdio.h>
#include<stdlib.h>
int main()
{
    int *p;
    p = (int *)malloc(20);
    printf("%d\n", sizeof(p));
    free(p);
    return 0;
}

Choices:
- 2
- 4
- 8
- Junk value


Question:
What will be the error (if any) in the following C code?
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
int main()
{
    char *p;
    *p = (char)calloc(10);
    strcpy(p, "HELLO");
    printf("%s", p);
    free(p);
    return 0;
}

Choices:
- No error
- Error in the statement: strcpy(p,”HELLO”);
- Error in the statement: *p=(char)calloc(10);
- Error in the statement: free(p);


Question:
What will be the output of the following C code, if it is run on a 32 bit platform?
#include<stdio.h>
#pragma(1)
struct test
{
    int i;
    char j;
};
main()
{
    printf("%d",sizeof(struct test));
}

Choices:
- Error
- 1
- 4
- 8


Question:
What will be the output of the following C code?
#include<stdio.h>
#pragma GCC poison printf
main()
{
    printf("sanfoundry");
    return 0;
}

Choices:
- error is thrown
- sanfoundry is printed
- warning but no error
- yrdnoufnas is printed


Question:
What will be the output of the following C code?
#define sanfoundry(s,n) #s #n
main()
{
    printf(sanfoundry(hello,world));
}

Choices:
- sanfoundry(hello,world)
- sanfoundry
- hello,world
- helloworld


Question:
What will be the output of the following C code?
#define display(text) printf(#text "@")
main()
{
    display(hello.);
    display(good morning!);
}

Choices:
- [email protected] morning!
- error
- hello.good [email protected]
- [email protected] [email protected]


Question:
What will be the output of the following C code?
#define display(a) #a
main()
{
    printf(display("56#7"));
}

Choices:
- Error
- “56#7”
- 56#7
- 567


Question:
What will be the output of the following C code?
#define HELLO(a) #a
main()
{
    printf(HELLO(good        morning));
}

Choices:
- good        morning
- goodmorning
- good morning
- error


Question:
What will be the output of the following C code?
#include <stdio.h>
#define sanfoundry(x)  #x
int main()
{
    int marks=100;
    printf("value of %s is = %d\n",sanfoundry(marks),marks);
    return 0;
}

Choices:
- error
- value of marks=100
- value of=100
- 100


Question:
What will be the output of the following C code?
#define hello(c) #c
main()
{
    printf(hello(i,am));
}

Choices:
- i,am
- iam
- i am
- error


Question:
What will be the output of the following C code?
#define hello(c,d) #c #d
main()
{
    printf(hello(i,"am"));
}

Choices:
- iam
- i“am”
- am
- “am”


Question:
What will be the output of the following C code?
#define F abc
#define B def
#define FB(arg) #arg
#define FB1(arg) FB(arg)
main()
{
    printf(FB(F B));
    FB1(F B);
}

Choices:
- F B
- Error
- FB
- “FB”


Question:
What will be the output of the following C code?
#define display(text) "$" #text
main()
{
    printf(display(hello	   world));
}

Choices:
- hello world
- $helloworld
- $hello world
- error


Question:
What will be the output of the following C code?
#include<stdio.h>
#define max 100
main()
{
    #ifdef max
    printf("hello");
}

Choices:
- 100
- hello
- “hello”
- error


Question:
What will be the output of the following C code?
#include<stdio.h>
void main()
{
    #ifndef max
    printf("hello");
    #endif
    printf("hi");
}

Choices:
- hello
- hellohi
- error
- hi


Question:
What will be the output of the following C code?
#include<stdio.h>
#define san 557
main()
{
    #ifndef san
    printf("yes");
    #endif
    printf("no");
}

Choices:
- error
- yes
- no
- yesno


Question:
What will be the output of the following C code?
#include<stdio.h>
#define max 100
void main()
{
    #if(max%10)
    printf("san");
    #endif
    printf("foundry");
}

Choices:
- error
- san
- foundry
- sanfoundry


Question:
What will be the output of the following C code?
#include<stdio.h>
#define hello 10
void main()
{
    printf("%d",hello);
    #undef hello
    printf("%d",hello);
}

Choices:
- 10
- hello
- error
- 1010


Question:
What will be the output of the following C code?
#include <stdio.h>
#define a 2
main()
{
    int r;
    #define a 5
    r=a*2;
    printf("%d",r);
}

Choices:
- 10
- 4
- 2
- 5


Question:
What will be the output of the following C code if the value of ‘p’ is 10 and that of ‘q’ is 15?
#include<stdio.h>
int main()
{
    int p,q;
    printf("Enter two numbers\n");
    scanf("%d",&p);
    scanf("%d",&q);
    #if(4<2)
    printf("%d",p);
    #elif(2>-1)
    printf("%d",q);
    #else
    printf("bye");
    #endif
}

Choices:
- 10
- 15
- bye
- error


Question:
What will be the output of the following C code?
#include<stdio.h>
#define san 10
main()
{
    #ifdef san
    #define san 20
    #endif
    printf("%d",san);
}

Choices:
- 10
- 20
- Error
- 1020


Question:
What will be the output of the following C code?
#include<stdio.h>
#define hello
main()
{
    #ifdef hello
    #define hi 4
    #else
    #define hi 5
    #endif
    printf("%d",hi);

}

Choices:
- 4
- 5
- 45
- error


Question:
What will be the output of the following C code?
#include<stdio.h>
#define max 20
main()
{
    #ifndef max
    #define min 10
    #else
    #define min 30
    #endif
    printf("%d",min);
}

Choices:
- 10
- 20
- 30
- error


Question:
What will be the output of the following C code?
#include<stdio.h>
#define hello 10
main()
{
    #ifdef hello
    #undef hello
    #define hello 100
    #else
    #define hello 200
    #endif
    printf("%d",hello);
}

Choices:
- Error
- 10
- 100
- 200


Question:
What will be the output of the following C code?
#include<stdio.h>
#define sf 10
main()
{
    if(sf==100)
        printf("good");
    else
    {
        printf("bad");
        sf=100;
    }
    printf("%d",sf);
}

Choices:
- 100
- bad
- 10
- error


Question:
What will be the output of the following C code?
#include<stdio.h>
void f()
{
    #define sf 100
    printf("%d",sf);
}
int main()
{
    #define sf 99;
    f();
    printf("%d",sf);
}

Choices:
- error
- 100
- 99
- 10099


Question:
What will be the output of the following C code?
#include<stdio.h>
#define INDIA 1
#define US 2
#define CC US
main()
{
    #if CC==INDIA
    printf("Rupee");
    #elif CC==US
    printf("Dollar");
    #else
    printf("Euro");
    #endif
}

Choices:
- Euro
- Rupee
- Dollar
- Error


Question:
What will be the output of the following C code?
#define sqr(x) x*x
main()
{
    int a1;
    a1=25/sqr(5);
    printf("%d",a1);
}

Choices:
- 25
- 1
- 5
- error


Question:
What will be the output of the following C code?
#include <stdio.h>
#define p( n ) printf( "t" #n " = %d", t##n )
int t3=10;
int main()
{
   p(3);
}

Choices:
- t=10
- t3=10
- t10=3
- t=3


Question:
What will be the output of the following C code?
#include <stdio.h>
#define p( n,m ) printf( "%d", m##n )
int main()
{
   p(3,4);
}

Choices:
- Error
- Junk value
- 34
- 43


Question:
What will be the output of the following C code?
#include <stdio.h>
#define p( n,m ) printf( "%d", m##n )
#define q(a,b) printf("%d",a##b)
main()
{
   p(3,4);
   q(5,5);
}

Choices:
- 4356
- 3456
- 4365
- 3465


Question:
What will be the output of the following C code?
#include <stdio.h>
#define display( n ) printf( "a" #n " = %d", a##n )
int main()
{
   display(3);
}

Choices:
- a3
- 31
- a 3
- error


Question:
What will be the output of the following C code?
#include <stdio.h>
#define hello( n ) a##n
int a3;
int main()
{
    int x;
    x=hello(3);
    if(x!=0)
        printf("hi");
    else
        printf("good");
}

Choices:
- error
- a3
- good
- hi


Question:
What will be the output of the following C code?
#include <stdio.h>
#define hello( n ) printf( "a" #n "= %d", a##n )
int a3=3;
int main()
{
    #ifdef a3
       hello(3);
   #else
       printf("sorry");
   #endif
}

Choices:
- a3=3
- error
- a=3
- sorry


Question:
What will be the output of the following C code?
#include <stdio.h>
#define p( n ) printf( "t*" #n " = %s", t##n )
char tsan[]="tsan";
int main()
{
    int x;
    x=p(san);
}

Choices:
- error
- tsan=tsan
- t*san=t*san
- t*san=tsan


Question:
What will be the error (if any) in the following C code?
#include <stdio.h>
void inline func1(float b)
{
    printf ("%lf\n",b*2);
}
int main()
{
     inline func1(2.2);
     return 0;
}

Choices:
- No error
- Error in statement: void inline func1(float b)
- Error in statement: printf(“%lf\n”,b*2);
- Error in statement: inline func1(2.2);


Question:
What will be the output of the following C code?
#include <stdio.h>
void inline f1(char b)
{
    printf ("%d\n",b);
}
int main()
{
    f1('a');
    return 0;
}

Choices:
- a
- 65
- error
- 97


Question:
What will be the output of the following C code?
#include <stdio.h>
void inline func1(char b[10])
{
    printf ("%c\n",b[2]);
}
int main()
{
     func1("sanfoundry");
     return 0;
}

Choices:
- s
- n
- a
- error


Question:
What will be the output of the following C code?
#include<stdio.h>
static inline int max(int a, int b)
{
  return a > b ? a : b;
}
main()
{
    int m;
    m=max(-6,-5);
    printf("%d",m);
}

Choices:
- -6
- -5
- Junk value
- Error


Question:
What will be the output of the following C code?
#include<stdio.h>
#define inline
inline f(char a)
    {
        #ifdef inline
        printf("%c",a);
        #endif
    }
main()
{
    f('a');
}

Choices:
- Error
- a
- No error but nothing will be printed as output
- 97


Question:
What will be the output of the following C code?
#include<stdio.h>
extern inline int min(int a, int b)
{
  return a < b ? a : b;
}
main()
{
    int m;
    m=min(3,-5);
    printf("%d",m);
}

Choices:
- Error
- 3
- -5
- Junk value


Question:
If the output of the following C code is “Big endian”, then what will be the value of *a is?
#include <stdio.h>
int main()
{
   unsigned int i = 1;
   char *a = (char*)&i;
   if (*a)
       printf("Little endian");
   else
       printf("Big endian");
   getchar();
   return 0;
}

Choices:
- -1
- 0
- 1
- 2


Question:
If the code shown below is executed on a little endian machine, then what will be the output of the following C code?
#include<stdio.h>
main()
{
    int y=1;
    printf("%d", (*(char*)&y));
}

Choices:
- 1
- 1000
- 9999
- 0


Question:
What will be the output of the following C code?
#include<stdio.h>
main()
{
    int n;
    n=f1(4);
    printf("%d",n);
}
f1(int x)
{
    int b;
    if(x==1)
        return 1;
    else
        b=x*f1(x-1);
        return b;
}

Choices:
- 24
- 4
- 12
- 10


Question:
What will be the output of the following C code?
#include<stdio.h>
main()
{
    int n,i;
    n=f(6);
    printf("%d",n);
}
f(int x)
{
    if(x==2)
            return 2;
    else
    {
        printf("+");
        f(x-1);
    }
}

Choices:
- ++++2
- +++++2
- 2


Question:
How many times is ‘a’ printed when the following C code is executed?
#include<stdio.h>
main()
{
    int a;
    a=f1(10);
    printf("%d",a);
}
f1(int b)
{
    if(b==0)
        return 0;
    else
    {
        printf("a");
        f1(b--);
    }
}

Choices:
- 9 times
- 10 times
- 0 times
- Infinite number of times


Question:
What will be the output of the following C code?
#include<stdio.h>
main()
{
    int n=10;
    int f(int n);
    printf("%d",f(n));
}
int f(int n)
{
    if(n>0)
        return(n+f(n-2));
}

Choices:
- 10
- 80
- 30
- Error


Question:
What will be the output of the following C code?
#include<stdio.h>
int main()
{
    printf("Hello");
    main();
    return 0;
}

Choices:
- Hello is printed once
- Hello infinite number of times
- Hello is not printed at all
- 0 is returned


Question:
What will be the output of the following C code if the input given to the code shown below is “sanfoundry”?
#include<stdio.h>
#define NL '\n'
main()
{
    void f(void);
    printf("enter the word\n");
    f();
}
void f(void)
{
    char c;
    if((c=getchar())!=NL)
{
f();
    printf("%c",c);
}
return;
}

Choices:
- sanfoundry
- infinite loop
- yrdnuofnas
- fnasyrdnuo


Question:
What will be the output of the following C code?
#include<stdio.h>
int main()
{
    signed char ch= ‘a’;
    printf(“%u”,ch);
    return 0;
}

Choices:
- -65
- 65
- -97
- 97


Question:
What will be the output of the following C code?
#include<stdio.h>
main()
{
    signed char a[]= “BAT”;
    printf(“%c”, a[1]);
    return 0;
}

Choices:
- -A
- BAT
- A
- 65


Question:
What will be the error in the following C code?
main()
{
    long float a=-25.373e22;
    printf("%lf",a);
}

Choices:
- Negative number cannot be assigned to float data type
- Long and float cannot be used together
- Does not result in error
- Logical error


Question:
What will be the output of the following C code?
main()
{
    unsigned a=10;
    long unsigned b=5l;
    printf(“%lu%u”,a,b);
}

Choices:
- 105
- 510
- 10
- error


Question:
What will be the error in the following C# code?
 Static Void Main(String[] args) {     const int m = 100;     int n = 10;     const int k = n / 5 * 100 * n ;     Console.WriteLine(m * k);     Console.ReadLine(); }

Choices:
- ‘k’ should not be declared constant
- Expression assigned to ‘k’ should be constant in nature
- Expression (m * k) is invalid
- ‘m ‘ is declared  in invalid format


Question:
What will be the output of the following C# code?
 static void Main(string[] args) {     float a = 10.553f;     long b = 12L;     int  c;     c = Convert.ToInt32(a + b);     Console.WriteLine(c); }

Choices:
- 23.453
- 22
- 23
- 22.453


Question:
d)
   double a = (float) 12.502f;   float  b = 12.80f;   float  c;   c = a + b;   Console.WriteLine(c);   Console.ReadLine();

Choices:
- i
- i, iii
- i, ii, iii
- ii, iii


Question:
Why does a float variable stop incrementing  at number ‘16777216’ in the following C# code?
 float a = 0 ; while (true) {     a++;     if (a > 16777216)     break; }

Choices:
- Sign and Exponent for ‘16777217’ is same as for ‘16777216’
- Mantissa is different for ‘16777216’ and ‘16777217’
- Sign and Exponent for ‘16777217’ is different from ‘16777216’
- None of the mentioned


Question:
What will be the output of the following C# code?
static void Main(string[] args){    int x = 1;    float y = 2. 4f;    short z = 1;    Console. WriteLine((float) x + y * z - (x + = (short) y) );    Console. ReadLine();}

Choices:
- 0.4000004
- 0.4000023
- 0.0400021
- 0.4000001


Question:
What will be the output of the following C# code?
 public static void Main(string[] args) {     double ZERO = 0;     Console.WriteLine("RESULT OF DIVISION BY ZERO IS :{0}",  (0 / ZERO));     Console.ReadLine(); }

Choices:
- 1
- exception argument is thrown
- NaN
- 0


Question:
What will be the output of the following C# code?
 static void Main(string[] args) {     char c = 'g';     string s = c.ToString();     string s1 = "I am a human being" + c;     Console.WriteLine(s1);     Console.ReadLine(); }

Choices:
- I am a human bein c
- I am a human being
- I am a human being c
- I am a human bein


Question:
Given is the code of days(example:”MTWTFSS”) which I need to split and hence create a list of days of week in strings( example:”Monday”, “Tuesday”, “Wednesday”, “Thursday”, “Friday”, “Saturday”, “Sunday”). A set of code is given for this purpose but there is the error occurring in that set of code related to the conversion of char to strings. Hence, Select a C# code to solve the given error.
static void Main(string[] args){    var days = "MTWTFSS";    var daysArray = days.ToCharArray().Cast<string>().ToArray();    for (var i = 0; i < daysArray.Length; i++)    {        switch (daysArray[i])        {        case "M":            daysArray[i] = "Monday";            break;        case "T":            daysArray[i] = "Tuesday";            break;        case "W":            daysArray[i] = "Wednesday";            break;        case "R":            daysArray[i] = "Thursday";            break;        case "F":            daysArray[i] = "Friday";            break;        case "S":            daysArray[i] = "Saturday";            break;        case "U":            daysArray[i] = "Sunday";            break;        }    }    daysArray[daysArray.Length - 1] = "and " + daysArray[daysArray.Length - 1];    Console.WriteLine(string.Join(", ", daysArray));}

Choices:
- var daysArray = new List<String>();
- var daysArray = days.Select(c =>dayMapping[c]).ToArray();
- var daysArray = days.ToCharArray().Select(c =>c.Tostring()).ToArray();
- var daysArray = days.Select<String>();


Question:
What will be the output of the following C# code?
static void Main(string[] args){    string s1 = "Delhi";    string s2;    s2 = s1.Insert (6, "Jaipur");    Console.WriteLine(s2);}

Choices:
- DelhJaipuri
- Delhi Jaipur
- Delhi
- DelhiJaipur


Question:
What will be the output of the following C# string? (Enter a String : BOMBAY).
static void Main(string[] args){    string Str,  Revstr = " ";     int Length;    Console.Write("Enter A String : ");    Str = Console.ReadLine();    Length = Str.Length - 1;    while (Length >= 0)    {        Revstr = Revstr + Str[Length];        Length --;    }    Console.WriteLine("Reverse  String  Is  {0}",  Revstr);    Console.ReadLine();}

Choices:
- BOMBA
- YABMOB
- BOMAYB
- YABMO


Question:
What will be the output of the following C# code?
   string s1 = " I AM BEST ";   string s2;   s2 = s1.substring (5, 4);   Console.WriteLine (s2);

Choices:
- AM BEST
- I AM BES
- BEST
- I AM


Question:
What will be the output of the following C# code?
 static void Main(string[] args) {     int a = 5;     int b = 10;     int c;     Console.WriteLine(c = ++ a + b ++);     Console.WriteLine(b);     Console.ReadLine(); }

Choices:
- 11, 10
- 16, 10
- 16, 11
- 15, 11


Question:
The following C# codes are?
 1. Myclass class;    Myclass class2 = null;

Choices:
- True for (1);False for (2)
- True for (2);False for (1)
- Both (1) and (2) are equivalents
- Both (1) and (2) are not equivalents


Question:
What will be the output of the following C# code?
 2. int i;    int j = 0;

Choices:
- b = 10, a = 5
- b = 15, a = 5
- a = 15, b = 10
- a = 10, b = 10


Question:
What will be the output of the following C# code conversion?
  int a,b;  a = (b = 10) + 5;

Choices:
- 1, 97
- 65, 97
- 65, 97
- 97, 1


Question:
What will be the output of the following C# code?
 static void Main(string[] args) {     char a = 'A';     string b = "a";     Console.WriteLine(Convert.ToInt32(a));     Console.WriteLine(Convert.ToInt32(Convert.Tochar(b)));     Console.ReadLine(); }

Choices:
- Dr.Gupta
- Good Morning
- Good Morning Dr.Gupta
- Good Morning name


Question:
What will be the output of the following C# code?
static void Main(string[] args){    String name = "Dr.Gupta";    Console.WriteLine("Good Morning" + name);}

Choices:
- -7, 10
- -5, 11
- -6, 11
- 15, 11


Question:
What will be the output of the following C# code?
 static void Main(string[] args) {     int a = 5;     int b = 10;     int c;     Console.WriteLine(c = a-- - ++b);     Console.WriteLine(b);     Console.ReadLine(); }

Choices:
- 600, 720
- Compile time error
- 25, 30
- 5, 6


Question:
What will be the output of the following C# code?
 static void Main(string[] args) {     const int a = 5;     const int b = 6;     for (int i = 1; i <= 5; i++)     {         a = a * i;         b = b * i;     }     Console.WriteLine(a);     Console.WriteLine(b);     Console.ReadLine(); }

Choices:
- He is playing in a grou
- .ground  a in playing is He
- .dnuorg a ni gniyalp si eH
- He  playing a


Question:
Choose the correct type of variable scope for the following C# defined variables.
  class ABC  {      static int m;      int n;      void fun (int x , ref int y, out int z, int[] a)      {         int j = 10;      }  }

Choices:
- m = static variable, n = local variable, x = output parameter, y = reference parameter, j = instance variable, z = output parameter, a[0] = array element
- m = static variable, n = instance variable, x = value parameter, y = reference parameter, j = local variable, z = output parameter , a[0] = array element
- m = static variable, n = instance variable, x = reference parameter, y = value parameter, j = local variable, z = output parameter, a[0] = array element
- m = local variable, n = instance variable, x = reference parameter, y = value parameter, j = static variable, z = output parameter, a[0] = array element


Question:
What will be the output of the following C# code?
class Program{    static void Main(string[] args)    {        int  i ;        for (i = 0; i < 5; i++)        {            Console.WriteLine(i);        }        Console.ReadLine();    }}

Choices:
- 0, 1, 2, 3, 4, 5
- 0, 1, 2, 3
- 0, 1, 2, 3, 4
- 0, 0, 0, 0, 0


Question:
What will be the output of the following C# code?
 class Program {     static void Main(string[] args)     {         int i;         for ( i = 0; i < 5; i++)         {          }         Console. WriteLine(i);         Console. ReadLine();     }}

Choices:
- 0, 1, 2, 3, 4, 5
- 0, 1, 2, 3, 4
- 5
- 4


Question:
What will be the output of the following C# code?
 class Program {     static void Main(string[] args)     {         int i ;         for ( i = 0; i < 5; i++)         {             int j = 0;             j += i;              Console. WriteLine(j);         }         Console. WriteLine(i);         Console. ReadLine();     } }

Choices:
- 0, 1, 2, 3, 4, 5, 6
- 0, 1, 2, 3, 4, 5
- 0, 1, 2, 3, 4
- 0, 1, 2, 3


Question:
What will be the output of the following C# code?
  static void Main(string[] args)  {      int i ;      for (i = 0; i < 5; i++)      {          int j = 0;          j += i;           Console. WriteLine(j);      }      Console. WriteLine( i * j);      Console. ReadLine();  }

Choices:
- 0, 1, 6, 18, 40
- 0, 1, 5, 20, 30
- Compile time error
- 0, 1, 2, 3, 4, 5


Question:
What will be the output of the following C# code?
 class Program {     public static void Main(string[] args)     {         int i = 100;         for (a = 0; a < 5; a++)         {             int i = 200;             Console. WriteLine(a * i);         }         Console. ReadLine();     } }

Choices:
- 5, 10, 15, 20
- 0, 5, 10, 20
- Compile time error
- 0, 1, 2, 3, 4


Question:
What will be the output of the following C# code?
 class Program {     public static void Main(string[] args)     {         int i, j;         i = (j = 5) + 10;         Console. WriteLine(i);         Console. WriteLine(j);         Console. ReadLine();     } }

Choices:
- 15, 15
- 10, 5
- 15, 5
- 10, 15


Question:
What will be the output of the following C# code?
    public static void Main(string[] args)    {        int i = 123;        object o = i;        i = 456;        System. Console. WriteLine("The value-type value = {0}", i);        System. Console. WriteLine("The object-type value = {0}", o);        Console. ReadLine();    }

Choices:
- 123, 123
- 456, 123
- 456, 456
- 123, 456


Question:
What will be the output of the following C# code?
  public static void Main(string[] args)  {      int i = 546;      object o = i;      int n =(int) o;      o = 70;      System. Console. WriteLine("The value-type value = {0}", n);      System. Console. WriteLine("The object-type value = {0}", o);      Console. ReadLine();  }

Choices:
- 546, 0
- 546, 546
- 546, 70
- 70, 546


Question:
For the following C# code select the relevant solution for conversion of data type.
 static void Main(string[] args) {     int num1 = 20000;     int num2 = 50000;     long total;     total = num1 + num2;     Console.WriteLine("Total is : " +total);     Console.ReadLine(); }

Choices:
- Compiler will generate runtime error
- Conversion is implicit type, no error generation
- Specifying data type for conversion externally will solve the problem
- None of the mentioned


Question:
For the given set of C# code, is conversion possible?
 static void Main(string[] args) {     int a = 76;     char b;     b = (char)a;     Console.WriteLine(b);     Console.ReadLine(); }

Choices:
- Compiler will generate runtime error
- Conversion is explicit type
- Compiler will urge for conversion from ‘integer’ to ‘character’ data type
- None of the mentioned


Question:
What will be the output of the following C# code?
static void Main(string[] args){    float sum;    int i;    sum = 0.0F;    for (i = 1; i <= 10; i++)    {        sum = sum + 1 /(float)i;    }    Console.WriteLine("sum =" +sum);    Console.ReadLine();}

Choices:
- 2.000
- 2.910
- 2.928
- 3.000


Question:
Which of the conversions are valid for the following C# code?
 static void Main(string[] args) {     int a = 22;     long b = 44;     double c = 1.406;     b = a;     c = a;     a = b;     b = c; }

Choices:
- c = a, b = c
- a = c, b = a
- b = a, c = a
- All of the mentioned


Question:
What will be the output of the following C# code?
 static void Main(string[] args) {     float a = 16.4f;     int b = 12;     float c;     c =  a * ( b + a) / (a - b) ;     Console.WriteLine("result is :" +c);     Console.ReadLine(); }

Choices:
- 106
- 104.789
- 105.8546
- 103.45


Question:
What will be the output of the following C# code?
  static void Main(string[] args)  {      int a, b, c, x;      a = 90;      b = 15;      c = 3;      x = a - b / 3 + c * 2 - 1;      Console.WriteLine(x);      Console.ReadLine();  }

Choices:
- 92
- 89
- 90
- 88


Question:
What will be the output of the following C# code?
  static void Main(string[] args)  {      int a, b, c, x;      a = 80;      b = 15;      c = 2;      x = a - b / (3 * c) * ( a + c);      Console.WriteLine(x);      Console.ReadLine();  }

Choices:
- 78
- -84
- 80
- 98


Question:
What will be the output of the following C# code?
    int i, j = 1, k;    for (i = 0; i < 3; i++)    {        k = j++ - ++j;        Console.Write(k + " ");    }

Choices:
- -4 -3 -2
- -6 -4 -1
- -2 -2 -2
- -4 -4 -4


Question:
What will be the output of the following C# code?
  static void Main(string[] args)  {      int b= 11;      int c = 7;      int r = 5;      int e = 2;      int l;      int v = 109;      int k;      int z,t,p;      z = b * c;      t = b * b;      p = b * r * 2;      l = (b * c) + (r * e) + 10;      k = v - 8;      Console.WriteLine(Convert.ToString(Convert.ToChar(z)) + " " + Convert.ToString(Convert.ToChar(t)) + Convert.ToString(Convert.ToChar(p)) +   Convert.ToString(Convert.ToChar(l)) + Convert.ToString(Convert.ToChar(v)) + Convert.ToString(Convert.ToChar(k)));                      Console.ReadLine();  }

Choices:
- My Name
- My nAme
- My name
- Myname


Question:
What will be the output of the following C# code?
Output:  A
         BC
         DEF
         GHIJ
         KLMNO

Choices:
- They have same value
- Parentheses changes values
- Since both have equal values, no conclusion
- None of the mentioned


Question:
What will be the output of the following C# code?
    m = 5;
    int y;
    1. y = m++;
    2. y = ++m;

Choices:
- y = 5, m = 6 ; y = 5, m = 5
- y = 6, m = 6; y = 7, m = 6
- y = 5, m = 6; y = 7, m = 7
- y = 5, m = 6; y = 7, m = 8


Question:
What will be the output of the following C# code?
  static void Main(string[] args)  {      int a = 3, b = 5, c = 1;      int z = ++b;      int y = ++c;      b = Convert.ToInt32((Convert.ToBoolean(z)) && (Convert.ToBoolean(y))        || Convert.ToBoolean(Convert.ToInt32(!(++a == b))));      a = Convert.ToInt32(Convert.ToBoolean(c) || Convert.ToBoolean(a--));      Console.WriteLine(++a);      Console.WriteLine(++b);      Console.WriteLine(c);  }

Choices:
- 2, 2, 1
- 2, 3, 2
- 2, 2, 2
- 2, 0, 9


Question:
What will be the output of the following C# code?
 static void Main(string[] args) {     int a = 4, b = 5, c = 7, u = 9;     int h;     h = (Convert.ToInt32(u < b)) + (a + b--) + 2;     Console.WriteLine(h);     Console.WriteLine(b);     Console.WriteLine(u < b); }

Choices:
- 12, 5, 0
- 11, 4, False
- 11, 5, 0
- 12, 4, False


Question:
What will be the output of the following C# code?
 static void Main(string[] args) {     int m = 10, n = 5, p = 20;     bool b1 =  m * p / n <= p * n / m ;     int l = p - 2 * m;     bool b2 = l == 0;     int z = Convert.ToInt32(b2);     int k = Convert.ToInt32(b1);     Console.WriteLine(k);     Console.WriteLine(z); }

Choices:
- 0 0
- 1 0
- 0 1
- 1 1


Question:
What will be the output of the following C# code?
 class method1 {     public int fun(int m)     {         return( m++ % 10);     } } class Program {     static void Main(string[] args)     {         int a = 23, b = 0, c;         method1 z = new method1();         c = z.fun (++b * --a % 2);         int d = (z.fun (c-- + --a));         Console.WriteLine(c);         Console.WriteLine(a++);         Console.WriteLine(d);         Console.ReadLine();     } }

Choices:
- -1, 22, 0
- -1, 21, 1
- 0, 22, 1
- 0, 22, 0


Question:
What will be the output of the following C# code?
  static void Main(string[] args)  {      int a = 8, b = 6, c = 10;      int d = a * c * 2 / Convert.ToInt32(Math.Pow ((c - b), 2));      if (d == (c = Convert.ToInt32(Math.Sqrt (a * a + b * b))) && c == 10)      {          Console.WriteLine("figure is hypotenuse");      }      else      {         Console.WriteLine("figure is square");      }  }

Choices:
- Figure is square
- Figure is hypotenuse
- False
- None of the mentioned


Question:
What will be the output of the following C# code?
 static void Main(string[] args) {     byte varA = 10;     byte varB = 20;     long result = varA & varB;     Console.WriteLine("{0}  AND  {1} Result :{2}", varA, varB, result);     varA = 10;     varB = 10;     result = varA & varB;     Console.WriteLine("{0}  AND  {1} Result : {2}", varA, varB, result);     Console.ReadLine(); }

Choices:
- 0, 20
- 10, 10
- 0, 10
- 0, 0


Question:
What will be the output of the following C# code?
 public static void Main()  {     byte varA = 10;     byte varB = 20;     long result = varA | varB;      Console.WriteLine("{0}  OR  {1} Result :{2}", varA, varB, result);     varA = 10;     varB = 10;     result = varA | varB;       Console.WriteLine("{0}  OR  {1} Result : {2}", varA, varB, result); }

Choices:
- 20, 10
- 30, 10
- 10, 20
- 10, 10


Question:
What will be the output of the following C# code?
 static void Main(string[] args) {     byte b1 = 0 * AB;     byte b2 = 0 * 99;     byte temp;     temp = (byte) ~b2;     Console.Write( temp + " ");     temp = (byte) (b1 << b2);     Console.Write(temp + " ");     temp = (byte)(b2  >> 2);     Console.WriteLine(temp);     Console.ReadLine(); }

Choices:
- 101 0 34
- 103 2 38
- 102 0 38
- 101 1 35


Question:
What will be the output of the following C# code?
  bool a = true;  bool b = false;  a |= b;  Console.WriteLine(a);  Console.ReadLine();

Choices:
- 0
- 1
- True
- False


Question:
Select the relevant C# code set to fill up the blank for the following C# program?
  static void Main(string[] args)  {      int x = 10, y = 20;      int res;      /*_______________*/       Console.WriteLine(res);  }

Choices:
- x % y == 0 ? (x == y ? (x += 2):(y = x + y)):y = y*10;
- x % y == 0 ? y += 10:(x += 10);
- x % y == 0 ? return(x) : return (y);
- All of the mentioned


Question:
What will be the output of the following C# code?
 static void Main(string[] args) {     int y = 5;     int x;     int k = (!(Convert.ToInt32(y) > 10))?  x = y + 3 : x = y + 10;     Console.WriteLine(x);     Console.WriteLine(y);     Console.ReadLine(); }

Choices:
- 5, 8
- 10, 4
- 8, 5
- 11, 8


Question:
Arrange the operators in the increasing order as defined in C#.
    !=,   ?:,   &,   ++,  &&


Question:
What will be the output of the following C# code?
 static void Main(string[] args) {     int i;     int b = 8, a = 32;     for (i = 0; i <= 10; i++)     {         if ((a / b * 2)== 2)         {             Console.WriteLine( i + " ");             continue;         }         else if (i != 4)             Console.Write(i + " ");         else             break;    }    Console.ReadLine(); }

Choices:
- 1 2 3 4 5 6 7 8 9
- 0 1 2 3 4 5 6 7 8
- 0 1 2 3
- 0 1 2 3 4


Question:
Which of the following conditions are true in the following C# code?
 static void Main(string[] args) {     Console.WriteLine("Enter a letter:");     char c = (char)Console.Read();     if (Char.IsDigit(c) == true)         Console.WriteLine("A number");     else if (char.IsLower(c) == true)         Console.WriteLine("A lowercase letter");     else if (char.IsUpper(c) == true)         Console.WriteLine("An uppercase letter");     Console.ReadLine(); } a. Enter a letter :    a    An uppercase letter b. Enter a letter :    A    An uppercase letter c. Enter a letter :    2    A number d. Enter a letter :    2    A lowercase letter.

Choices:
- a, b, c
- b, c, d
- a, d, b
- b, c


Question:
What will be the output of the following C# code?
 static void Main(string[] args) {     int a = 15, b = 10, c = 1;     if (Convert.ToBoolean(a) && (b > c))     {         Console.WriteLine("cquestionbank");     }     else     {         break;     } }

Choices:
- cquestionbank
- It will print nothing
- Compile time error
- Run time error


Question:
What will be the output of the following C# code?
  static void Main(string[] args)  {        int a = 5;      if (Convert.ToBoolean((.002f) -(0.1f)))      Console.WriteLine("Sachin Tendulkar");      else if (a == 5)      Console.WriteLine("Rahul Dravid");      else      Console.WriteLine("Ms Dhoni");      Console.ReadLine();  }

Choices:
- Rahul Dravid
- Sachin Tendulkar
- Ms Dhoni
- Warning : Unreachable Code


Question:
What will be the output of the following C# code?
  static void Main(string[] args)  {         int a = -1;      int b = -1;      if (Convert.ToBoolean (++a = ++b))      Console.WriteLine("a");      else      Console.WriteLine("b");      Console.ReadLine();  }

Choices:
- a
- b
- Compile time error
- Code execute successfully with no output


Question:
What will be the output of the following C# code?
  static void Main(string[] args)  {      int a = 5, b = 10;      if (Convert.ToBoolean(Convert.ToInt32(0xB)))      if (Convert.ToBoolean(Convert.ToInt32(022)))      if (Convert.ToBoolean(Convert.ToInt32('\xeb')))      Console.WriteLine("java");      else ;      else ;      else ;  }

Choices:
- Compile time error: Misplaced else
- Compile time error: Undefined symbol
- java
- Warning: Condition is always true


Question:
What will be the output of the following C# code?
 static void Main(string[] args) {     int a = 5, b = 10;     if (Convert.ToBoolean(Convert.ToInt32(++a)) || Convert.ToBoolean(Convert.ToInt32(++b)))     {         Console.WriteLine(a + "\n" + b);     }     else     Console.WriteLine(" C# "); }

Choices:
- 6 11
- 6 16
- 6 12
- 6 10


Question:
What will be the output of the following C# code?
  static void Main(string[] args)  {      int movie = 1;      switch (movie << 2 + movie)      {      default:           Console.WriteLine("3 Idiots");          break;      case 4:           Console.WriteLine("Ghazini");          break;      case 5:           Console.WriteLine("Krishh");          break;      case 8:           Console.WriteLine("Race");          break;      }      Console.ReadLine();  }

Choices:
- 3 Idiots
- Ghazini
- Race
- Krishh


Question:
What will be the output of the following C# code?
  static void Main(string[] args)  {      int i = 2, j = 4;      switch (i + j * 2)      {      case 1 :      case 2 :          Console.WriteLine("1 and 2");          break;      case 3 to 10:          Console.WriteLine("3 to 10");          break;      }      Console.ReadLine();  }

Choices:
- 3 to 10 will be printed
- 1 and 2 will be printed
- The code reports an error as missing ; before :
- The code gives output as 3 to 10


Question:
What will be the output of the following C# code?
 static void Main(string[] args) {     int i = 2, k = 3;     switch (i - k)     {     case -1:         ++i;         ++k;         break;     case 2:         --i;         ++k;         break;     default:         i += 3;         k += i;         break;     }     Console.WriteLine(i + "\n" + k);     Console.ReadLine(); }

Choices:
- 2 3 3
- 3 2 3
- 3 4 4
- 5 10 10


Question:
What will be the output of the following C# code?
   static void Main(string[] args)   {       int const p = 0;       switch (3 * 5 / 6)       {       case p:            Console.WriteLine("A");           break;       case p * 1:           Console.WriteLine("B");           break;       case p - 2:           Console.WriteLine("C");           break;       default:            Console.WriteLine("D");       }  }

Choices:
- A
- B
- C
- Compile time error


Question:
What will be the output of the following C# code?
 static void Main(string[] args) {     int i = 2, j = 3, k = 4;     switch (i + j - k)     {     case 0: case 2: case 4:         ++i;         k += j;         break;     case 1: case 3: case 5 :         --i;         k -= j;         break;     default:         i += j;         break;     }     Console.WriteLine(i + "\n" + j + "\n" + k);     Console.ReadLine(); }

Choices:
- 1 3 1
- 2 3 4
- 5 3 4
- Compile time error


Question:
What will be the output of the following C# code?
  static void Main(string[] args)  {      int  i = 9 , j = 7;      switch (i - j + 3)      {      case 9: 7:          j += 6;          break;      case 5:          i -= 4;          break;      }      Console.WriteLine(i + "\n" + j);      Console.ReadLine();  }

Choices:
- 5 7
- 9 13
- Compile time error
- 9 7


Question:
What will be the output of the following C# code?
  static void Main(string[] args)  {      switch (5)      {      case 5.0f:           Console.WriteLine("harsh");          break;      case 5:           Console.WriteLine("amish");          break;      case 5.0L:           Console.WriteLine("ANKIT");          break;      default:          Console.WriteLine("ashish");      }      Console.ReadLine();   }

Choices:
- amish
- ANKIT
- harsh
- Compile time error


Question:
What will be the output of the following C# code?
  static void Main(string[] args)  {      int i;      int j = 1;      int []ar = {21, 22, 13, 4};      switch (ar[j])      {      case 1:          i++;          break;      case 2:          i += 2;          j = 3;          continue;      case 3:          i %= 2;         j = 4;         continue;      default:          --i;      }      Console.WriteLine(i);      Console.ReadLine();  }

Choices:
- 23
- 15
- Compile time error
- 12


Question:
What will be the output of the following C# code?
 static void Main(string[] args) {     char ch = Convert.ToChar('a' | 'b' | 'c');     switch (ch)     {     case 'A':     case 'a':         Console.WriteLine("case A|case a");         break;     case 'B':     case 'b':         Console.WriteLine("case B|case b");         break;     case 'C':     case 'c':     case 'D':     case 'd':         Console.WriteLine("case D|case d");         break;     }     Console.ReadLine(); }

Choices:
- Compile time error
- case A|case a
- case B|case b
- case D|case d


Question:
What will be the output of the following C# code?
  static void Main(string[] args)  {      char ch = 'p';      switch (ch)      {      case 'p':          Console.WriteLine("coco" + "\t" + Convert.ToInt32(ch));          break;      default:          Console.WriteLine("default");          break;      }     Console.WriteLine("main");  }

Choices:
- coco main
- coco 112
- coco 112 main
- compile time error


Question:
What will be the output of the following C# code?
 static void Main(string[] args) {     int i;     for (i = 0;  ; )     {         Console.WriteLine("hello");     }     Console.ReadLine(); }

Choices:
- No output
- hello
- hello printed infinite times
- Code will give error as expression syntax


Question:
What will be the output of the following C# code?
  static void Main(string[] args)  {      float f;      for (f = 0.1f; f <= 0.5; f += 1)      Console.WriteLine( ++f );      Console.ReadLine();  }

Choices:
- 1.1
- 0.1
- 0.1 0.2 0.3 0.4 0.5
- None of the mentioned


Question:
What will be the output of the following C# code?
 static void Main(string[] args) {     int I, X;     for (I = 1; I <= (9 % 2 + I); I++)     {         X = (I * 3 + I * 2) / I;         Console.WriteLine(X);     }     Console.ReadLine(); }

Choices:
- Output of code is 5 10
- Output is 5 5 5 5
- Print 5 infinite times
- None of the mentioned


Question:
What will be the output of the following C# code?
 static void Main(string[] args) {     int I, J = 0;     for (I = 1; I < 10; ) ;     {         J = J + I;         I += 2;     }     Console.WriteLine("Sum of first 10 even numbers is:"+J);     Console.ReadLine(); }

Choices:
- 1 2 3 4 5 6 7 8 9
- 25
- 1
- Run time error


Question:
What will be the output of the following C# code?
  static void Main(string[] args)  {      int i = 5;      for (; Convert.ToBoolean(Convert.ToInt32(i)); Console.WriteLine(i--)) ;      Console.ReadLine();  }

Choices:
- 4 3 2 1
- 3 2 1
- 5 4 3 2 1
- 2 1


Question:
What will be the output of the following C# code?
 static void Main(string[] args) {     int i, s = 0;     for (i = 1; i <= 10; s = s + i, i++);     {         Console.WriteLine(s);     }     Console.ReadLine(); }

Choices:
- Code report error
- Code runs in infinite loop condition
- Code gives output as 0 1 3 6 10 15 21 28 36 45
- Code give output as 55


Question:
What will be the output of the following C# code?
  {      int i;      Console.WriteLine("Hi");      for (i = 1; i <= 10; i++)          Program.Main(args);      Console.ReadLine();  }

Choices:
- Prints ‘Hi’ for one time
- Prints ‘Hi’ for infinite times
- Stack overflow exception Condition generated
- None of the mentioned


Question:
What will be the output of the following C# code?
   static void Main(string[] args)   {       int i;       for (i =-3; i <= 3; i++)       {           switch (i)           {           case 0:               Console.WriteLine("zero");               break;           }           if (i > 0)               Console.WriteLine("A");           else if (i < 0)               Console.WriteLine("B");       }       Console.ReadLine();   }

Choices:
- B B zero A A A
- B zero A A A
- B B B zero A A A
- A A A zero B B B


Question:
What will be the output of the following C# code?
  static void Main(string[] args)  {      int i, j;      for (i = 1, j = i; i <= 3 && j >= 0; i++, j--)      {          if (i == j)              continue;          else              Console.WriteLine(j);      }      Console.ReadLine();  }

Choices:
- i = 0, j = 1;
- i = 1, j = 0;
- j = 0;
- None of the mentioned


Question:
What will be the output of the following C# code?
 static void Main(string[] args) {     int i = -10;     for ( ;Convert.ToBoolean(Convert.ToInt32(i)) ;Console.WriteLine(i++)) ;     Console.ReadLine(); }

Choices:
- -9 -8 -7 -6 -5 -4 -3 -2 -1
- -10 -9 -8 -7 -6 -5 -4 -3 -2
- -10 -9 -8 -7 -6 -5 -4 -3 -2 -1
- -8 -7 -6 -5 -4 -3 -2 -1


Question:
What will be the output of the following C# code?
 static void Main(string[] args) {     int i, j;     for (i = 1; i <= 3; i++)     {         j = 1;         while (i % j == 2)         {             j++;         }         Console.WriteLine(i + " " + j);     }     Console.ReadLine(); }

Choices:
- 11 21 31
- 1 12 13 1
- 11 21 31
- 1 1 2 1 3 1


Question:
What will be the output of the following C# code?
 static void Main(string[] args) {     float s = 0.1f;     while (s <= 0.5f)     {         ++s;         Console.WriteLine(s);     }     Console.ReadLine(); }

Choices:
- 0.1
- 1.1
- 0.1 0.2 0.3 0.4 0.5
- No output


Question:
What will be the output of the following C# code?
  static void Main(string[] args)  {      int n, r;      n = Convert.ToInt32(Console.ReadLine());      while (n > 0)      {          r = n % 10;          n = n / 10;          Console.WriteLine(+r);      }      Console.ReadLine();  } for n = 5432.

Choices:
- 3245
- 2354
- 2345
- 5423


Question:
What will be the output of the following C# code?
  static void Main(string[] args)  {      float i = 1.0f,  j = 0.05f;      while (i  < 2.0f  &&  j  <= 2.0f)      {          Console.WriteLine(i++ - ++j);      }      Console.ReadLine();  }

Choices:
- 0.05f
- 1.50f
- -0.04999995f
- 1.50f


Question:
What will be the output of the following C# code?
 static void Main(string[] args) {     int i = 0;     while (i <= 50)     {         if (i % 10 == 0)         continue;         else         break;         i += 10;         Console.WriteLine(i % 10);    }}

Choices:
- code prints output as 0 0 0 0 0
- code prints output as 10 20 30 40 50
- infinite loop but doesn’t print anything
- Code generate error


Question:
What will be the output of the following C# code?
  static void Main(string[] args)  {      int i = 1, j = 1;      while (++i <= 10)      {          j++;      }      Console.WriteLine(i+ "  " +j);      Console.ReadLine();  }

Choices:
- 12 11
- 10 11
- 11 10
- 11 12


Question:
What will be the output of the following C# code?
   static void Main(string[] args)   {       int i = 1;       while (i <= 1)       {           if ('A' < 'a')           {               Console.WriteLine("Hello...");           }           else           {              Console.WriteLine("Hi...");           }              i++;       }       Console.ReadLine();   }

Choices:
- Hi…
- Hello….
- Hi…infinite times
- Hello infinite times


Question:
What will be the output of the following C# code?
  static void Main(string[] args)  {      int i = 0;      while (i++ != 0) ;      Console.WriteLine(i);      Console.ReadLine();  }

Choices:
- -127 to +127
- 0 to 127
- 1
- Infinite loop condition


Question:
What will be the output of the following C# code?
 static void Main(string[] args) {     int i = 1, j = 2, k = 3;     do     {         Console.WriteLine((Convert.ToBoolean(Convert.ToInt32(i++)))          && (Convert.ToBoolean(Convert.ToInt32(++j))));     }while (i <= 3);     Console.ReadLine(); }

Choices:
- 0 0 0
- True True True
- 1 1 1
- False False False


Question:
What will be the output of the following C# code?
static void Main(string[] args){    float i = 1.0f, j = 0.05f;    do    {        Console.WriteLine(i++ - ++j);    }while (i < 2.0f && j <= 2.0f);    Console.ReadLine();}

Choices:
- 0.05
- -0.05
- 0.95
- -0.04999995


Question:
What will be the output of the following C# code?
static void Main(string[] args){    int i = 1, j = 5;    do    {        Console.WriteLine(i = i++ * j);    }while (i <= 10);    Console.ReadLine();}

Choices:
- 5 10 15 20 25 30 35 40 45 50
- 5 25
- 5 11 16 21 26 31 36 41 46 51
- 5 30


Question:
What will be the output of the following C# code?
 static void Main(string[] args) {     long  x;     x = Convert.ToInt32(Console.ReadLine());     do     {         Console.WriteLine(x % 10);     }while ((x = x / 10) != 0);     Console.ReadLine(); } enter x = 1234.

Choices:
- number of digits present in x
- prints ‘1’
- prints reverse of x
- prints sum of digits of ‘x’


Question:
What will be the output of the following C# code?
 static void Main(string[] args) {     int i, s = 0, a = 1, d;     i = Convert.ToInt32(Console.ReadLine());     do     {         d = i % (2 * 4);         s = s + d * a;     }while ((Convert.ToInt32(i = i / (2 * 4))) != 0       && (Convert.ToBoolean(Convert.ToInt32((a) = (a * 10)))));     Console.WriteLine(s);     Console.ReadLine(); }enter i = 342.

Choices:
- It finds binary equivalent of i
- It finds octal equivalent of i
- It finds sum of digits of i
- It finds reverse of i


Question:
What will be the output of the following C# code?
static void Main(string[] args){    int x = 10;    do    {        Console.WriteLine( x++);    }    while(Convert.ToBoolean(5) && Convert.ToBoolean(4) && Convert.ToBoolean(3)     && Convert.ToBoolean(2) && Convert.ToBoolean(1) && Convert.ToBoolean(0));        Console.ReadLine();}

Choices:
- 13
- 15
- 11
- 10


Question:
What will be the output of the following C# code?
static void Main(string[] args){    int x;    for (x = 10; x <= 15; x++)    while (Convert.ToBoolean(Convert.ToInt32(x)))    {        do        {            Console.WriteLine(1);            if (Convert.ToBoolean(x >> 1))            continue;        }while (Convert.ToBoolean(0));        break;    }    Console.ReadLine();}

Choices:
- 0 0 0….infinite times
- 1 1 1….infinite times
- 1 1 1 1 1 1
- System outofflow exception error


Question:
What will be the output of the following C# code?
static void Main(string[] args){    int x = 0;    do    {        x++;        if (x == 5)        {            x++;            continue;            break;        }        Console.WriteLine(x + " ");    }}while (x < 10);

Choices:
- 1 2 3 4 5
- 10
- 5 6 7 8 9 10
- 1 2 3 4 5 6 7 8 9 10


Question:
What will be the output of the following C# code?
static void Main(string[] args){    int x;    for (x = 1; x <= 3; x++)    {        int j = 1;        do        {            j++;        }while (x % j == 2);        Console.WriteLine(x + " " + j);    }    Console.ReadLine();}

Choices:
- 1 12 1 3 1
- 1 12 13 1
- 12 22 32
- 11 21 31


Question:
What will be the output of the following C# code?
  static void Main(string[] args)  {      int i;      Console.WriteLine("enter value of i:");      i = Convert.ToInt32(Console.ReadLine());      if (i < 7)      {          i++;          continue;      }      Console.WriteLine("final value of i:" +i);      Console.ReadLine();  }

Choices:
- 12
- 11
- Compile time error
- 13


Question:
What will be the output of the following C# code?
 static void Main(string[] args) {     int i;     Console.WriteLine("enter value of i:");     i = Convert.ToInt32(Console.ReadLine());     if ( i % 2 == 0)         goto even:     else     {         Console.WriteLine("number is odd:");         Console.ReadLine();     }     even:     Console.WriteLine("number is even:");     Console.ReadLine(); }for i = 4.

Choices:
- number is odd
- number is even
- Compile time error
- none of the mentioned


Question:
What will be the output of the following C# code?
   static void Main(string[] args)   {       int i = 10 , j = 0;       label:       i--;       if ( i > 0)       {           Console.WriteLine(i+ " ");           goto label;       }       Console.ReadLine();   }

Choices:
- 1 2 3 4 5 6 7 8 9 10
- 10 9 8 7 6 5 4 3 2 1 0
- 9 8 7 6 5 4 3 2 1
- 10 9 8 7 6 5 4 3 2 1


Question:
What will be the output of the following C# code?
  static void Main(string[] args)  {      int i = 0, j = 0;      while (i < 2)      {          l1: i--;          while (j < 2)          {              Console.WriteLine("hi\n");              goto l1;          }      }      Console.ReadLine();  }

Choices:
- hi hi hi
- hi hi
- hi
- hi hi hi…..infinite times


Question:
What will be the output of the following C# code?
  static void Main(string[] args)  {      int i = 0;      if (i == 0)      {          goto label;      }      label: Console.WriteLine("HI...");      Console.ReadLine();  }

Choices:
- Hi…infinite times
- Code runs prints nothing
- Hi Hi
- Hi…


Question:
What will be the output of the following C# code?
  static void Main(string[] args)  {      int i = 0, j = 0;      l1: while (i < 2)      {            i++;          while (j < 3)          {              Console.WriteLine("loop\n");              goto l1;          }       }      Console.ReadLine();  }

Choices:
- loop is printed infinite times
- loop
- loop loop
- Compile time error


Question:
What will be the output of the following C# code?
  static void Main(string[] args)  {      int i= 0,k;      label: Console.WriteLine(i);      if (i == 0)          goto label;      Console.ReadLine();  }

Choices:
- 0 0 0 0
- 0 0 0
- 0 infinite times
- 0


Question:
What will be the output of the following C# code?
   static void Main(string[] args)   {       int i = 0;       int j = 0;       for (i = 0; i < 4; i++)       {           for (j = 0; j < 3; j++)           {               if (i > 1)                   continue;               Console.WriteLine("Hi \n");           }       }       Console.ReadLine();   }

Choices:
- Prints hi 4 times
- Prints hi 3 times
- Prints hi 6 times
- Prints hi infinite times


Question:
Select the output for the following set of code :
    static void Main(string[] args)    {        int a = 0;        int i = 0;        int b;        for (i = 0; i < 5; i++)        {             a++;             Console.WriteLine("Hello \n");             continue;        }        Console.ReadLine();    }

Choices:
- print hello 4 times
- print hello 3 times
- print hello 5 times
- print hello infinite times


Question:
What will be the output of the following C# code?
    static void Main(string[] args)    {        Console.WriteLine("HI");        continue;        Console.WriteLine("Hello");        Console.ReadLine();    }

Choices:
- Hi Hello
- Hi
- Hello
- Compile time error


Question:
What will be the output of the following C# code?
 class sample {     public int i;     public int[] arr = new int[10];     public void fun(int i, int val)     {         arr[i] = val;     } } class Program {     static void Main(string[] args)     {         sample s = new sample();         s.i = 10;         sample.fun(1, 5);         s.fun(1, 5);         Console.ReadLine();     } }

Choices:
- sample.fun(1, 5) will not work correctly
- s.i = 10 cannot work as i is ‘public’
- sample.fun(1, 5) will set value as 5 in arr[1]
- s.fun(1, 5) will work correctly


Question:
What will be the output of the following C# code?
  class sample  {      public int i;      public int j;      public void fun(int i, int j)      {          this.i = i;          this.j = j;      }  }  class Program  {      static void Main(string[] args)      {          sample s = new sample();          s.i = 1;          s.j = 2;          s.fun(s.i, s.j);          Console.WriteLine(s.i + " " + s.j);          Console.ReadLine();      }  }

Choices:
- Error while calling s.fun() due to inaccessible level
- Error as ‘this’ reference would not be able to call ‘i’ and ‘j’
- 1 2
- Runs successfully  but prints nothing


Question:
What will be the output of the following C# code?
  class z  {      public int X;      public int Y;      public  const int c1 = 5;      public  const int c2 = c1 * 25;      public void set(int a, int b)      {          X = a;          Y = b;      }   }  class Program  {      static void Main(string[] args)      {          z s = new z();          s.set(10, 20);          Console.WriteLine(s.X + " " + s.Y);          Console.WriteLine(z.c1 + " " + z.c2);          Console.ReadLine();      }   }

Choices:
- name n = new name();
- n = name();
- name n = name();
- n = new name();


Question:
What will be the output of the following C# code?
  class z  {      public string name1;      public string address;      public void show()      {          Console.WriteLine("{0} is in city{1}", name1, " ", address);      }  }  class Program  {      static void Main(string[] args)      {          z n = new z();          n.name1 = "harsh";          n.address = "new delhi";          n.show();          Console.ReadLine();      }  }

Choices:
- Syntax error
- {0} is in city{1} harsh new delhi
- harsh is in new delhi
- Run successfully prints nothing


Question:
What does the following C# code imply?
      csharp abc;
      abc = new charp();

Choices:
- Object creation on class csharp
- Create an object of type csharp on heap or on stack depending on the size of object
- create a reference c on csharp and an object of type csharp on heap
- create an object of type csharp on stack


Question:
What will be the output of the following C# code?
   class test   {       public void print()       {           Console.WriteLine("Csharp:");       }   }   class Program   {       static void Main(string[] args)       {           test t;           t.print();           Console.ReadLine();       }   }

Choices:
- Code runs successfully prints nothing
- Code runs and prints “Csharp”
- Syntax error as t is unassigned variable which is never used
- None of the mentioned


Question:
What will be the output of the following C# code?
   static void Main(string[] args)   {       int a = 5;       fun1 (ref a);       Console.WriteLine(a);       Console.ReadLine();    }    static void fun1(ref int a)    {        a = a * a;    }

Choices:
- 5
- 0
- 20
- 25