Uploaded by LAZKIBALO COMEDY

C Tutorial Questions

advertisement
C Tutorial Questions
C Tutorial Questions
Your email address (15-52ha056@students.unilorin.edu.ng) will be recorded when you submit this
form. Not you? Sign out
................variable often has its value changed unexpectedly
at anytime without the knowledge of the programmer.
1 point
auto
extern
volatile
register
# include "stdio.h" # include "string.h" main() { int n, i,x=5,
a=6; char s1[6] = "there"; i = 2; n = strlen(s1); n+=(++i + n++);
n+=i+=x; printf("%d",n); } What is the output of the code
above
22
14
Compilation Error
Runtime error
1 point
# include "stdio.h" main() { int n, i,x=5, a=6; char s1[6] =
"there"; i = 2; n = strlen(s1); n+=(++i + n++); n+=i+=x;
printf("%d",n); } What is the output of the code above
1 point
22
14
Compilation Error
Runtime
What is the return value for scanf() function?
1 point
memory address
int
float
double
# include "stdio.h" main() { char FName[10]="Olalekan"; char
SName[10]="Adebayo"; puts(FName, SName); } What is the
output of the code above?
Compilation Error
Adebayo
Olalekan
OlalekanAdedayo
1 point
# include "stdio.h" main() { int x,y,z;
scanf("%d%*d%d",&x,&y,&z); printf("%d%d%d", x,y,z); } What
will be the output if 20 30 40 is inputted
1 point
20 30 40
Garbage Value
203040
Compilation error
# include "stdio.h" main() { int x,y,z;
scanf("%d%*d%d",&x,&y,&z); printf("%d%d", x,y,z); } What will
be the output if 20 30 40 is inputted
1 point
203040
2030
2040
Compilation error
What is the output of the code below? # include "stdio.h"
main(){ int i=10, j=40; if ((j-i)%10) printf("Hello"); else
printf("World"); }
Hello
World
Hello World
World Hello
1 point
What is the output of the code below? # include "stdio.h"
main( ) { int x = 10, y = 20; if (! (!x) && x) printf ("%d",x); else
printf ("%d",y); }
1 point
10
0
1
Compilation Error
Which is the odd out of the following?
1 point
if statement
switch statement
continue
while loop statement
which is the odd out of the following?
1 point
goto statement
switch statement
break statement
continue statement
# include "stdio.h" main() { int size = 10; int arr[size]; for ( i =
1 ; i <= size; i++) { scanf ("%d",&arr[i]); printf ("\n%d", arr[i]); } }
Compilation error
Runtime error
Garbage value
1 2 3 4 5 6 7 8 9 10
1 point
What is the output of the code below # include "stdio.h"
main() { int arr1[10],arr2[10], i ; for ( i = 0 ; i <= 9 ; i++) { arr1[i]
= 'A' + i ; arr2[i] = 'a' + i ; printf ("%d ", arr2[i]-arr1[i]); } }
1 point
32 32 32 32 32 32 32 32 32 32
Compilation error
Runtime error
Garbage Value
What is the output of the code below? # include "stdio.h"
main() { int a[]={2,3,4,5,6} ; int i ; for ( i = 5 ; i > 0; ) printf ("%d
",a[--i]) ; }
1 point
65432
65432
Compilation error
Garbage value
What is the output of the code below? # include "stdio.h"
main() { int b[] = {10,20,30,40,50} ; int i, *k; k=&b[4]-4 ; for ( i =
0 ; i <= 4 ; i++) { printf ("%d ",*k) ; k++ ; } }
10 20 30 40 50
1020304050
Compilation error
Garbage error
1 point
What is the output of the code below? # include "stdio.h"
main() { int a[] = {5,7,9,11,13} ; int i ; for ( i = 0 ; i <= 4 ; i++) { *
(a+i)=a[i ] + a[i]; printf ("%d ", *( i + a)) : } }
1 point
5 7 9 11 13
10 14 18 22 26
Compilation error
Garbage error
# include "stdio.h" int b=6; int *a = &b; void *ptr; main() { ptr =
&b; a=(int *) ptr; printf("%d ", *a); } What is the output of the
code above ?
1 point
6
Compilation error
Runtime error
Garbage value
# include "stdio.h" int b=6; int *a = &b; void *ptr; main() { ptr =
&b; a=(char *) ptr; printf("%d ", b); } What is the output of the
code above ?
6
Compilation error
Runtime error
Garbage value
1 point
# include "stdio.h" int b=6; int *a = &b; void *ptr; main() { ptr =
&b; a= ptr; printf("%d ", *a); } What is the output of the code
above
1 point
6
Compilation error
Runtime error
Garbage value
# include "stdio.h" int b=6; int *a = &b; void *ptr; main() { ptr =
&b; a= ptr; printf("%d ", b); } What is the output of the code
above ?
1 point
6
Compilation error
Runtime error
Garbage value
# include "stdio.h" main() { printf(5+"olalekan"); }
kan
5olalekan
Compilation error
Runtime error
1 point
# include "stdio.h" main() { char st[6]="hello"; printf("%s",*st);
} What is the output of the code above?
1 point
Compilation error
Runtime error
h
H
# include "stdio.h" main() { struct employee { char name[25];
int age; float bs; } struct employee e ; e.name = "Hacker" ;
e.age = 25 ; printf ("%s %d", e.name, e.age) ; } What is the
output of the code above?
1 point
Compilation error
Runtime error
Hacker 25
Garbage error
# include "stdio.h" # include "stdlib.h" main() { struct node {
long data; struct node *link; } ; struct node*p,*q; p = (node
*)malloc (sizeof (struct node)) ; q = (node *)malloc (sizeof
(struct node)) ; printf ("%d ", sizeof (p) , sizeof (q)) ; } What is
the output of the code above?
4
Compilation error
Runtime error
Garbage value
SUBMIT
1 point
This form was created inside of University of Ilorin, Nigeria. Report Abuse - Terms of Service - Additional Terms
Forms
Download