C Program find Output code snippet SET - 11



.
FILE is a structure suitably typedef'd in "stdio.h".
A.
True
B.
False
Workspace

2.
We want to round off x, a float, to an int value, The correct way to do is
A.
y = (int)(x + 0.5)
B.
y = int(x + 0.5)
C.
y = (int)x + 0.5
D.
y = (int)((int)x + 0.5)
Workspace

3.
The binary equivalent of 5.375 is
A.
101.101110111
B.
101.011
C.
101011
D.
None of above
Workspace

4.
What will you do to treat the constant 3.14 as a float?
A.
use float(3.14f)
B.
use 3.14f
C.
use f(3.14)
D.
use (f)(3.14)
Workspace

5.
Every operator has an Associativity
A.
Yes
B.
No
Workspace

6.
What will be the output of the program if the array begins at address 65486?
#include<stdio.h>

int main()
{
    int arr[] = {12, 14, 15, 23, 45};
    printf("%u, %u\n", arr, &arr);
    return 0;
}
A.
65486, 65488
B.
65486, 65486
C.
65486, 65490
D.
65486, 65487
Workspace

7.
Range of double is -1.7e-38 to 1.7e+38 (in 16 bit platform - Turbo C under DOS)
A.
True
B.
False
Workspace

8.
The macro va_arg is used to extract an argument from the variable argument list and advance the pointer to the next argument.
A.
True
B.
False
Workspace

9.
What will be the output of the program?
#include<stdio.h>
int get();

int main()
{
    const int x = get();
    printf("%d", x);
    return 0;
}
int get()
{
    return 20;
}
A.
Garbage value
B.
Error
C.
20
D.
0
Workspace

10.
What will be the output of the program (myprog.c) given below if it is executed from the command line?
cmd> myprog one two three
/* myprog.c */
#include<stdio.h>
#include<stdlib.h>

int main(int argc, char **argv)
{
    int i;
    for(i=1; i<=3; i++)
        printf("%u\n", &argv[i]);
    return 0;
}
If the first value printed by the above program is 65517, what will be the rest of output?
A.
65525 65531
B.
65519 65521
C.
65517 65517
D.
65521 65525
Workspace

11.
The macro va_arg is used to extract an argument from the fixed micro argument list and advance the pointer to the next argument.
A.
Yes
B.
No
Workspace

12.
A preprocessor directive is a message from compiler to a linker.
A.
True
B.
False
Workspace

13.
In a macro call the control is passed to the macro.
A.
True
B.
False
Workspace

14.
What will be the output of the program ?
#include<stdio.h>
#include<string.h>

int main()
{
    printf("%d\n", strlen("123456"));
    return 0;
}
A.
6
B.
12
C.
7
D.
2
Workspace

15.
Point out the error in the program?
#include<stdio.h>

int main()
{
    unsigned int a, b, c, d, e, f;
    a=b=c=d=e=f=32;
    a<<=2;
    b>>=2;
    c^=2;
    d|=2;
    e&=2;
    f~=2;
    printf("%x %x %x %x %x %x\n", a, b, c, d, e, f);
    return 0;
}
A.
Error: printf() statement
B.
Error: d|=2; statement
C.
Error : f~=2; statement
D.
No error
Workspace

16.
Can a structure can point to itself?
A.
Yes
B.
No
Workspace

17.
What will be the output of the program?
#include<stdio.h>

int main()
{
    int i;
    i = printf("How r u\n");
    i = printf("%d\n", i);
    printf("%d\n", i);
    return 0;
}
A.
How r u
7
2
B.
How r u
8
2
C.
How r u
1
1
D.
Error: cannot assign printf to variable
Workspace

18.
What will be the output of the program?
#include<stdio.h>
int main()
{
    float a=0.7;
    if(a < 0.7)
        printf("C\n");
    else
        printf("C++\n");
    return 0;
}
A.
C
B.
C++
C.
Compiler error
D.
Non of above
Workspace

19.
What will be the output of the program?
#include<stdio.h>
int main()
{
    int k, num=30;
    k = (num>5 ? (num <=10 ? 100 : 200): 500);
    printf("%d\n", num);
    return 0;
}
A.
200
B.
30
C.
100
D.
500

Provide your Output in Comments. We will publish the output soon.

Comments

Popular posts from this blog

Tips 01) self introduction in an interview

Computer Science Terminology

Why Failure Is Good for Success