What is the output of this C code?
#include
#define a 10
int main()
{
const int a = 5;
printf("a = %d\n", a);
}
To print out a and b given below, which printf() statement would you use?
float a = 3.14;
double b = 3.14;
Can I increase the size of dynamically allocated array?
Which of the following header files must necessarily be included to use dynamic memory allocation functions?
What will be the output of the following C code (run without any command line arguments)?
#include
int main(int argc, char *argv[])
{
while (argc--)
printf("%s\n", argv[argc]);
return 0;
}
What is argv[0] in command line arguments?
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
int main(int argc, char **argv)
{
printf("%c\n", **++argv);
return 0;
}
What will be the output of the following C code?
#include
enum sanfoundry
{
a=2,b=3.56
};
enum sanfoundry s;
main()
{
printf("%d%d",a,b);
}
Predict the output of above program. Assume that the size of an integer is 4 bytes and size of character is 1 byte. Also assume that there is no alignment needed.
union test
{
int x;
char arr[4];
int y;
};
int main()
{
union test t;
t.x = 0;
t.arr[1] = 'G';
printf("%s", t.arr);
return 0;
}
What will be the output of the program?
#include
int main()
{
int i;
i = scanf("%d %d", &i, &i);
printf("%d\n", i);
return 0;
}
Left shifting an unsigned int or char by 1 is always equivalent to multiplying it by 2.
The unattended interactive information systems such as automatic teller machine or ATM is called as _________
#include
int main()
{
char str[] = "GeeksQuiz";
printf("%s %s %s\n", &str[5], &5[str], str+5);
printf("%c %c %c\n", *(str+6), str[6], 6[str]);
return 0;
}
What will be the output of the following C code?
#include
int main()
{
int i = 10;
int *p = &i;
foo(&p);
printf("%d ", *p);
printf("%d ", *p);
}
void foo(int **const p)
{
int j = 11;
*p = &j;
printf("%d ", **p);
}
What will be the output of the following C code?
#include
void foo(int*);
int main()
{
int i = 10;
foo((&i)++);
}
void foo(int *p)
{
printf("%d\n", *p);
}
Assignment statements assigning value to local static variables are executed only once?
What is the value of the below assignment expression
(x = foo())!= 1 considering foo() returns 2
A compiler is a translating program which
Mnemonic a memory trick is used in which of the following language?
Before a disk drive can access any sector record, a computer program has to provide the record’s disk address. What information does this address specify?
Total number of questions : 20
Number of answered questions : 0
Number of unanswered questions : 20
What is the output of this C code?
#include
#define a 10
int main()
{
const int a = 5;
printf("a = %d\n", a);
}
Your Answer : (Not Answered)
Correct Answer : C
The #define substitutes a with 10 leaving no identifier and hence compilation error.
Output:
$ cc pgm3.c
pgm3.c: In function ‘main’:
pgm3.c:5: error: expected identifier or ‘(’ before numeric constant
To print out a and b given below, which printf() statement would you use?
float a = 3.14;
double b = 3.14;
Your Answer : (Not Answered)
Correct Answer : A
No answer description available for this question.
Can I increase the size of dynamically allocated array?
Your Answer : (Not Answered)
Correct Answer : A
Use realloc(variable_name, value);
Which of the following header files must necessarily be included to use dynamic memory allocation functions?
Your Answer : (Not Answered)
Correct Answer : A
stdlib.h is a header file which stands for the standard library. It consists of the declaration for dynamic memory allocation functions such as malloc(), calloc(), realloc() and free.
What will be the output of the following C code (run without any command line arguments)?
#include
int main(int argc, char *argv[])
{
while (argc--)
printf("%s\n", argv[argc]);
return 0;
}
Your Answer : (Not Answered)
Correct Answer : B
No answer description available for this question.
What is argv[0] in command line arguments?
Your Answer : (Not Answered)
Correct Answer : A
No answer description available for this question.
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
int main(int argc, char **argv)
{
printf("%c\n", **++argv);
return 0;
}
Your Answer : (Not Answered)
Correct Answer : C
No answer description available for this question.
What will be the output of the following C code?
#include
enum sanfoundry
{
a=2,b=3.56
};
enum sanfoundry s;
main()
{
printf("%d%d",a,b);
}
Your Answer : (Not Answered)
Correct Answer : D
No answer description available for this question
Predict the output of above program. Assume that the size of an integer is 4 bytes and size of character is 1 byte. Also assume that there is no alignment needed.
union test
{
int x;
char arr[4];
int y;
};
int main()
{
union test t;
t.x = 0;
t.arr[1] = 'G';
printf("%s", t.arr);
return 0;
}
Your Answer : (Not Answered)
Correct Answer : A
No answer description available for this question.
What will be the output of the program?
#include
int main()
{
int i;
i = scanf("%d %d", &i, &i);
printf("%d\n", i);
return 0;
}
Your Answer : (Not Answered)
Correct Answer : B
No answer description available for this question.
Left shifting an unsigned int or char by 1 is always equivalent to multiplying it by 2.
Your Answer : (Not Answered)
Correct Answer : A
No answer description available for this question.
The unattended interactive information systems such as automatic teller machine or ATM is called as _________
Your Answer : (Not Answered)
Correct Answer : A
The term information kiosks are used for the same. Touch screens are used the most preferred human-computer interface used in information kiosks.
#include
int main()
{
char str[] = "GeeksQuiz";
printf("%s %s %s\n", &str[5], &5[str], str+5);
printf("%c %c %c\n", *(str+6), str[6], 6[str]);
return 0;
}
Your Answer : (Not Answered)
Correct Answer : D
No answer description available for this question.
What will be the output of the following C code?
#include
int main()
{
int i = 10;
int *p = &i;
foo(&p);
printf("%d ", *p);
printf("%d ", *p);
}
void foo(int **const p)
{
int j = 11;
*p = &j;
printf("%d ", **p);
}
Your Answer : (Not Answered)
Correct Answer : B
No answer description available for this question.
What will be the output of the following C code?
#include
void foo(int*);
int main()
{
int i = 10;
foo((&i)++);
}
void foo(int *p)
{
printf("%d\n", *p);
}
Your Answer : (Not Answered)
Correct Answer : C
No answer description available for this question.
Assignment statements assigning value to local static variables are executed only once?
Your Answer : (Not Answered)
Correct Answer : B
No answer description available for this question.
What is the value of the below assignment expression
(x = foo())!= 1 considering foo() returns 2
Your Answer : (Not Answered)
Correct Answer : A
No answer description available for this question.
A compiler is a translating program which
Your Answer : (Not Answered)
Correct Answer : D
No answer description available for this question.
Mnemonic a memory trick is used in which of the following language?
Your Answer : (Not Answered)
Correct Answer : B
No answer description available for this question.
Before a disk drive can access any sector record, a computer program has to provide the record’s disk address. What information does this address specify?
Your Answer : (Not Answered)
Correct Answer : D
No answer description available for this question.
Total number of questions : 20
Number of answered questions : 0
Number of unanswered questions : 20
We'll write only best content for you