C Q.
C Q.
#include<stdio.h>
int main()
{
char ch;
if(ch = printf(""))
printf("It matters");
else
printf("It doesn't matter");
return 0;
}
Select one:
matter
o No output
o It matters
o It doesn't matter
o Question 2
Select one:
o 1, 2, 3, 4,
o 23456
o 1234
o 4, 3, 2, 1
Select one:
o w
o e
o W
o Error
Select one:
o 2
o 0
o 1
o 3
17.What is the command to compile a C program named welcome.c?
Select one:
o welcome.c
o tcc welcome
o gcc welcme.c
o gcc welcome.c
Select one:
o 0 times
o Infinite times
o 11 times
o 10 times
19.In the following statements, what does 6 specify?
int num[6];
num[6]=21;
Select one:
o In the first statement, 6 specifies a particular element, whereas in the second
statement it specifies an array size.
o In the first statement, 6 specifies a particular element, whereas in the second
statement it specifies a type.
o In the first statement, 6 specifies an array size, whereas in the second
statement it specifies a particular element of an array.
o In both the statements, 6 specifies an array size.
#include<stdio.h>
int main()
{
static char s[25] = "Hello world";
int i=0;
char ch;
ch = s[++i];
printf("%c", ch);
ch = s[i++];
printf("%c", ch);
ch = s[i++];
printf("%c", ch);
return 0;
}
Select one:
o eel
o hel
o ell
o eee
Select one:
o Line number 8
o Line number 7
o None of these
o Line number 9
25.Which of the following function(s) can NOT be used to find the length of a
string?
Tick all correct answer(s). No partial marks and no negative marks.
Select one or more:
o int xstrlen(char *s)
{
int length=0;
while(*s!='\0')
{ length++; s++; }
return (length);
}
o int xstrlen(char *s)
{
int length=0;
while(*s!='\0')
s++;
return (length);
}
o int xstrlen(char s)
{
int length=0;
while(*s!='\0')
length++; s++;
return (length);
}
o int xstrlen(char *s)
{
int length=0;
while(*s!='\0')
length++;
return (length);
}
26.Which of the following is/are valid expression(s)? Tick all correct answer(s).
No partial marks and no negative marks.
Select one or more:
o None of these
o a = 2 + (b = 5);
o a = 11 % 3
o a = b = c = 5;
27.Which of the following operation(s) is/are correct? Tick all correct answer(s).
No partial marks and no negative marks.
Select one or more:
o long int k = 365L; k = k;
o float a = 3.14; a = a%3;
o short int j = 255; j = j;
o int i = 35; i = i%5;
31.What will be the output of the following program? Type the answer with the
correct Case.
#include<stdio.h>
int main()
{
char *ptr;
char string[]="How are you?";
ptr=string;
ptr+=4;
printf("%s",ptr);
return 0;
}
Answer:
32.What will be the output of the program? Write the answer in digits not
alphabets.
#include<stdio.h>
int main()
{
float a=3.16000;
printf("%.2f", a);
return 0;
}
Answer: