Get Latest Job Updates

Get Latest Walkins and Job Updates Directly to your Inbox.
20,000 People Subscribed

Sign Up Now.
Email address
Secure and Spam free...

C Quiz-1

C Quiz-1

Welcome to your C Quiz-1

NameEmail
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;
}

 
The keyword used to transfer control from a function back to the calling function is
Which of the statements is correct about the program?
#include<stdio.h>

int main()
{
float a=3.14;
char *j;
j = (char*)&a;
printf("%d\n", *j);
return 0;
}
Which of the following statements are correct about an array?

1: The array int num[26]; can store 26 elements.
2: The expression num[1] designates the very first element in the array.
3: It is necessary to initialize the array at the time of declaration.
4: The declaration num[SIZE] is allowed if SIZE is a macro.
If char=1, int=4, and float=4 bytes size, What will be the output of the program ?
#include<stdio.h>

int main()
{
char ch = 'A';
printf("%d, %d, %d", sizeof(ch), sizeof('A'), sizeof(3.14f));
return 0;
}
What will be the output of the program ?
#include<stdio.h>

int main()
{
char str[] = "Nagpur";
str[0]='K';
printf("%s, ", str);
str = "Kanpur";
printf("%s", str+1);
return 0;
}
What will be the output of the program?
#include<stdio.h>

int main()
{
char c=48;
int i, mask=01;
for(i=1; i<=5; i++)
{
printf("%c", c|mask);
mask = mask<<1;
}
return 0;
}
Which header file should you include, if you are going to develop a function, which can accept variable number of arguments?
Which of the following statements are correct about the below C-program?
#include<stdio.h>
int main()
{
int x = 10, y = 100%90, i;
for(i=1; i<10; i++)
if(x != y);
printf("x = %d y = %d\n", x, y);
return 0;
}
1 : The printf() function is called 10 times.
2 : The program will produce the output x = 10 y = 10
3 : The ; after the if(x!=y) will NOT produce an error.
4 : The program will not produce output.
Point out the error in the following program.

#include<stdio.h>
int main()
{
struct emp
{
char name[20];
float sal;
};
struct emp e[10];
int i;
for(i=0; i<=9; i++)
scanf("%s %f", e[i].name, &e[i].sal);
return 0;
}

Leaderboard for C Quiz-1

1. jithendra-40 Points
2. jithendra-35 Points
3. jithendra-25 Points
4. -5 Points
5. -