Functions - Point Out Errors Multiple Questions and Answers.




1.Point out the error in the program?
A. Missing parenthesis in return statement
B. The function should be defined as int f(int a, int b)
C. Redeclaration of a
D. None of above

2.Point out the error in the program?
#include<stdio.h>
int f(int a)
{
  a > 20? return(10): return(20);
}
int main()
{
    int f(int);
    int b;
    b = f(20);
    printf("%d\n", b);
    return 0;
}
A. Error: Prototype declaration
B. No error
C. Error: return statement cannot be used with conditional operators
D. None of above

3.Point out the error in the program?
A. Error: Not allowed assignment
B. Error: Doesn't print anything
C. No error
D. None of above




Date to Date Current Affairs 2022

PakMCQs.net

Quick Links

GAT Subject



   Computer Science    English Mcqs    Agriculture    

Engineering



   Computer Science    Civil Engineering    

Technical



   Networking    Electronics    Database    

Past Papers



   Model Papers    FPSC Papers