Professional Documents
Culture Documents
10.01.2020
Note:
You are allowed to have only course slides so no book, no notes on the slides, or no other document is
allowed during this examination.
Total time for this examination is 110 minutes.
A
Name , Surname:
ID:
Section (that appears in your course
registration):
Signature :
A
A
1) A) Compile error: pointing another pointer is not
allowed
#include<stdio.h> B) 6, 6, 6
int my_func(int *n)
{ C) 5, 5, arbitrary number
return *(++n + 1) + 2; D) 5, 5, memory address
} E) 5, 6, 5
void main(){
int dizi[8] = {7, 5, 3, 6, 1, 2};
printf("%d", my_func(dizi+2)); 5)
}
#include<stdio.h>
What is the output of the above C program? void transform(int *arr, int b);
void main(){
A) 1 int a[6] = {2,5,7,3,1,8};
B) 3 int b=5;
transform(a,b);
C) 4 printf("%d, %d, %d\n",a[1],a[3],a[4]);
D) 6 }
E) 8 void transform(int arr[], int b)
{
int i;
2) What will be the final values of a and c in the following
for(i=0;i<b;i++)
C statement? (Initial values: a = 2, c = 1) arr[i] += arr[b-i];
}
c = (c) ? a = 0 : 2; What is the output of the above C program?
A) a = 0, c = 0; A) 5, 3, 1
B) a = 2, c = 2; B) 1, 7, 5
C) a = 2, c = 0; C) 6, 13, 7
D) a = 0, c = 1; D) 10, 10, 13
E) Syntax error E) No output due to compile time error (errors in
code)
3)
6)
#include<stdio.h>
int my_rec(int n, int a){ #include<stdio.h>
if(n==1) return 1;
void main()
return(n+a+my_rec(n-1,a));
{
}
struct {inta;} deger={7},*p=°er;
void main(){
printf("%d%d%d",deger.a,p->a,(*p).a);
int n=50, a=10;
}
printf("%d\n", my_rec(n,a));
} What is the output of the above C program?
#include<stdio.h>
4) main()
{
#include<stdio.h> char *s = "Hello";
main() while(*s != '\0')
{ {
int x = 5, *p=&x, **q=&p; printf("%c", *s++);
++**q; }
printf("%d,%d,%d",x,*p,**q); }
}
What is the output of the above C program?
What is the output of the above C program?
A) Compile error: \0 is not defined
A
A
B) Hello\0 D)
customer *structure_array(int n){
C) Hello customer *custom_arr;
custom_arr=(customer*)malloc(n*sizeof(customer));
D) HIJKL return *custom_arr;
E) Infinite loop }
E)
customer *structure_array(int n){
8) Function fopen() with the mode "r+" tries to open the customer *custom_arr;
custom_arr=(customer*)malloc(n*sizeof(customer));
file for …. return custom_arr;
}
15) Which of the following true about FILE *fp A) Syntax error
B) 03
A) FILE is a keyword in C for representing files and C) 11
fp is a variable of FILE type D) 53
B) FILE is a stream E) 51
C) FILE is a buffered stream
D) FILE is a structure and fp is a pointer to the 20) Choose the right statement for fscanf() and scanf()
structure of FILE type
A) fscanf() can read from standard input whereas
E) FILE is variable and fp is the pointer
scanf() specifies a stream from which to read
16) B) fscanf() can specifies a stream from which to read
whereas scanf() can read only from standard input
#include <stdio.h> C) fscanf() and scanf() has no difference in their
int main()
functions
{
int a = 10, b = 5, c = 5; D) fscanf() and scanf() can read from specified stream
int d; E) All of the above
d = b + c == a;
printf("%d", d);
}
What is the output of the above C program?
A) Syntax error
A
A
21) 24)