0% found this document useful (0 votes)
5 views3 pages

Function Output Question for Practise an Mam

The document provides a series of C programming questions focused on function outputs and potential errors. Each question presents a code snippet and multiple-choice answers regarding the expected output or errors. The content is designed for practice and assessment of understanding C programming concepts.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
5 views3 pages

Function Output Question for Practise an Mam

The document provides a series of C programming questions focused on function outputs and potential errors. Each question presents a code snippet and multiple-choice answers regarding the expected output or errors. The content is designed for practice and assessment of understanding C programming concepts.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

Subject: C Programming Subject Code: BCSG0002

Topic: Function Output Based Question For Practice


Question1: What will be the output of the following Question2: What will be the output of the following
program? code?
#include<stdio.h> #include<stdio.h>
int main(){ int main(){
function(); main();
return 0; return 0;
} }
void function{
printf(“This is the function block”);
} A. Runtime Error B. Compilation Error
A . This is the function block B. no output C. 0 D. None of the above
C. Runtime Error D. Compile Error
Question3: What is the output of the following code? Question4: What will be the output of the following
#include<stdio.h> code?
int function(); #include<stdio.h>
main(){ int function();
int i; main(){
i = function(); int i;
printf("%d", i); i = function();
return 0; } printf("%d", i);
function(){ return 0;}
int a; function(){
a = 250; int a;
return 0;} a = 250;}
A. Run Time Error B. 0 A. 250 B. 0
C. 250 D. No output C. 1 D. Garbage Value
Question5: What will be the output of the following Question6: What will be the output of the following
code? code?
#include<stdio.h> #include<stdio.h>
int function(int, int); int main(){
int main(){ int num = _a_123(4);
int a = 25, b = 24 + 1, c; printf("%d\n", --num);
printf("%d", function(a, b)); return 0;
return 0; }
} int _a_123(int num){
int function(int x, int y){ return(num++);
return (x - (x == y)); } }
A. Compilation Error B. 25 A. 3 B. Compilation Error
C. 1 D. 24 C. 4 D. 5
Question7. What will be the ouput of the following Question8. What will be the output of the following
codes? code?
#include<stdio.h> #include<stdio.h>
int main() int main()
{ {
char c = ' ', x; char arr[] = "function\0";
getc(c); int num = strlen(a);
if((c >= 'a') && (c <= 'z')) printf("Length of function is %d", num);
x = convert(c); return 0;
printf("%c", x); }
return 0;
}
A. Run Time Error B. Any symbol or Special Character A. 9 B. 7
C. Compilation Error D. B C. 10 D. 8
Question9. What is the output of the following codes? Question10. What will be the output of the following
#include<stdio.h> codes?
char normal[15] = "Ambulance"; #include<stdio.h>
char accident[15]; void ptr(char**);
int main() int main(){
{ char *argv[] = { "abc", "def", "ghi", "jkl", "mno",
swab(normal, accident, strlen(normal +1)); "pqr" };
printf ("%s\n", normal); ptr(argv); return 0; }
return 0; void ptr(char **p) { char *t;
} t = (p += sizeof(int))[-1]; printf("%s\n", t); }
A. Ambulance B. mAubulance A. ghi B. jkl
C. mAubalcn D. ecnalubmA C. mno D. pqr
Question11. What is the output of the following Question12. What is the output of the following
codes? codes?
#include<stdio.h> #include<stdio.h>
int recursive(int i){ void fun(int*, int);
static int count = 0; void (*ptr[1])(int*, int);
count = count + i; int main(){
return count; } int a = 2;
int main(){ int b = 4;
int i, j; ptr[0] = fun;
for (i = 0; i <= 5; i++) ptr[0](&a, b);
j = recursive(i); printf("%d %d ", a, b);
printf("%d\n", j); return 0; }
return 0; } void fun(int *p, int q) {
} int tmp = *p; *p = q; q = tmp; }
A. 5 B. Compilation Error A. 2 2 B. 4 2
C. 15 D. 0 C. 4 4 D. 2 4
Question13. What is the output of the following Question14. What will be the output of the following
codes? codes?
#include<stdio.h> #include<stdio.h>
int num = 5; void fun(char *);
int main(){ int main(){
fun(); char *string = "function in c";
fun(); fun(string);
return 0; } printf("%s", string);
int fun() { return 0; }
static int num = 2; void fun(char *a){
printf("%d ",num); while(*a){
num++; *a += 1;
return 0; } a++; } }
A. 2 3 B. 2 2 A. function in c B. Compilation Error
C. 5 5 D. 5 6 C. Runction Error D. Nothing Prints
Question15. What will be the output of the following Question16. What is the output of the following
codes? codes?
#include<stdio.h> #include<stdio.h>
int main(){ int main(){
int *ptr = fun(); char str1[] = {'H', 'A', 'I'}; char str2[] = {'H', 'A', 'I'};
printf("%d", *ptr); if (strcmp(str1, str2)){
return 0; printf("strings are not equal");}
} else{
int fun(){ printf("strings are equal");}
int num = 10; return 0;}
return num;}
A. 10 B. Compilation Error A. Strings are not equal B. Compilation Error
C. Runtime Error D. None of the above C. strings are equal D. None of the above

You might also like