C language interview questions solution for freshers beginners placement tricky good pointers answers explanation operators data types arrays structures functions recursion preprocessors looping file handling strings switch case if else printf advance linux objective mcq faq online written test prime numbers Armstrong Fibonacci series factorial palindrome code programs examples on c++ tutorials and pdf
7 stars printed because ist call stack[5] return stmt 1st quiz...............(1) 2nd call stack[5,2] return stmt 1st quiz................(2) now w=1 <1 print * return to (2) pop top element now call by 2nd quiz stack[5,,2] return stmt 2nd quiz;...............(3) w=1<1 print * return to (3)pop top element print * and return to (1)pop top element stack [5,,,5] call by 2nd quiz...........................(4) stack[5,,,5,2] call by 2nd quiz ........................(5) now w=1<1 print * return goto 5 print *;stack[5,,,5]pop top element return goto 4 print *;stack[5,,,,]pop top element now print final print one more * due to the 1st call;stack [];pop top element
identify the errors in the program,correct them and explain the output thereof; main () { int i; printf("enter the number") scanf"",&i); if(i<=50) printf("\n entered number is <50)
identify the errors in the program,correct them and explain the output thereof; main () { int i; printf("enter the number") scanf"",&i); if(i<=50) printf("\n entered number is <50)
main() { int i; printf("enter i\n"); scanf("%d",&i); if(i<=50) printf("entered no is lessthan 50"); else printf("entered no is not in less than 50"); }
int main(){ char binaryNumber[MAX],hexaDecimal[MAX]; long int i=0;
printf("Enter any hexadecimal number: "); scanf("%s",hexaDecimal);
printf("\nEquivalent binary value: "); while(hexaDecimal[i]){ switch(hexaDecimal[i]){ case '0': printf("0000"); break; case '1': printf("0001"); break; case '2': printf("0010"); break; case '3': printf("0011"); break; case '4': printf("0100"); break; case '5': printf("0101"); break; case '6': printf("0110"); break; case '7': printf("0111"); break; case '8': printf("1000"); break; case '9': printf("1001"); break; case 'A': printf("1010"); break; case 'B': printf("1011"); break; case 'C': printf("1100"); break; case 'D': printf("1101"); break; case 'E': printf("1110"); break; case 'F': printf("1111"); break; case 'a': printf("1010"); break; case 'b': printf("1011"); break; case 'c': printf("1100"); break; case 'd': printf("1101"); break; case 'e': printf("1110"); break; case 'f': printf("1111"); break; default: printf("\nInvalid hexadecimal digit %c ",hexaDecimal[i]); return 0; } i++; }
return 0; } why use char to store the binary value
16 comments:
syntactical que bt repeated thinkg require
Explanation needed:-
#include
#include
void quiz(int w); main() { int x= 5; clrscr(); quiz(5); } void quiz(int w) { if(w>1) { quiz(w/2); quiz(w/2); } printf("*"); }
pointers,functions and strings are my favorite chapters in c programming and i can really defend these in 100%. i love c programming
It Will only a print a star because in if condition you haven't written anything so only print one star on terminal
Mokka subject.
7 stars printed because
ist call
stack[5] return stmt 1st quiz...............(1)
2nd call
stack[5,2] return stmt 1st quiz................(2)
now w=1 <1 print *
return to (2) pop top element
now call by 2nd quiz stack[5,,2] return stmt 2nd quiz;...............(3)
w=1<1 print *
return to (3)pop top element
print * and return to (1)pop top element
stack [5,,,5] call by 2nd quiz...........................(4)
stack[5,,,5,2] call by 2nd quiz ........................(5)
now w=1<1 print *
return goto 5 print *;stack[5,,,5]pop top element
return goto 4 print *;stack[5,,,,]pop top element
now print final print one more * due to the 1st call;stack [];pop top element
can u provide some questions on bit programming
q(5) -> q(2) -> q(1)
. | -> q(1)
. | -> q(2) -> q(1)
. -> q(1)
This is a recursive algorithm. Seven * are printed. The algorithm stops calling q recursivelly when w=1.
Can you tell the meaning of below code
while(num)
{
//
}
identify the errors in the program,correct them and explain the output thereof;
main ()
{
int i;
printf("enter the number")
scanf"",&i);
if(i<=50)
printf("\n entered number is <50)
identify the errors in the program,correct them and explain the output thereof;
main ()
{
int i;
printf("enter the number")
scanf"",&i);
if(i<=50)
printf("\n entered number is <50)
while(num)
{
}
if u give no is 0 then condition is fail while wont exicute....
if u give non zero no conditio always true it goes to infinite loop
main()
{
int i;
printf("enter i\n");
scanf("%d",&i);
if(i<=50)
printf("entered no is lessthan 50");
else
printf("entered no is not in less than 50");
}
hellop can i please get sme help
#include
#define MAX 1000
int main(){
char binaryNumber[MAX],hexaDecimal[MAX];
long int i=0;
printf("Enter any hexadecimal number: ");
scanf("%s",hexaDecimal);
printf("\nEquivalent binary value: ");
while(hexaDecimal[i]){
switch(hexaDecimal[i]){
case '0': printf("0000"); break;
case '1': printf("0001"); break;
case '2': printf("0010"); break;
case '3': printf("0011"); break;
case '4': printf("0100"); break;
case '5': printf("0101"); break;
case '6': printf("0110"); break;
case '7': printf("0111"); break;
case '8': printf("1000"); break;
case '9': printf("1001"); break;
case 'A': printf("1010"); break;
case 'B': printf("1011"); break;
case 'C': printf("1100"); break;
case 'D': printf("1101"); break;
case 'E': printf("1110"); break;
case 'F': printf("1111"); break;
case 'a': printf("1010"); break;
case 'b': printf("1011"); break;
case 'c': printf("1100"); break;
case 'd': printf("1101"); break;
case 'e': printf("1110"); break;
case 'f': printf("1111"); break;
default: printf("\nInvalid hexadecimal digit %c ",hexaDecimal[i]); return 0;
}
i++;
}
return 0;
}
why use char to store the binary value
hi
Post a Comment