You are on page 1of 45

instruction : null

Module 1

question : There are how many character set in C language?


answer : 4
option : 5
option : 6
option : 7

question : What is the ASCII code for "\n" in C programming?


option : 0
option : 5
answer : 10
option : 15

question : What is the ASCII code for "\0" in C programming ?'


answer : 0
option : 5
option : 10
option : 15

question : Which is the Odd out of the following?


option : _5678
option : _dEF
answer : BAD.
option : _3_FGH

question : There are .........types of constants in C language


option : 3
answer : 4
option : 5
option : 6

question : Which of the following is not an attribute of a variable in C programming?


option : Name
option : Scope
answer : Operator
option : Value

question : A variable that can referenced anywhere within a program is called a........
answer : global variable
option : auto variable
option : local variable
option : publiuc variable

question : ........... variable often has its value changed unexpectedly at anytime without the knowledge of the
programmer.
answer : volatile
option : static
option : extern option : register

question : What will be the final value of x in the expression (y+5)+(y=y+5)+y, if y initially is 20?
option : 10
option : 15
option : 20
answer : 25

question : # include "stdio.h"


main()
{
int a; float b,c;
a=2; b=2.5; c = a*b;
printf("%d",c);
}
What is the output of the code above?
option : Compilation error
option : 5.0
option : 5.000000
answer : 0

question : # include "stdio.h"


main()
{
int m; float x,y;
m=5; x=2.5; y = x*m;
printf("%f",y);
}
What is the output of the code above?
option : Compilation error
option : 12.5
answer : 12.500000
option : 0

question : # include "stdio.h"


main()
{
float a,b,c;
printf("input value for a, b, and c");
scanf("%f %f %f",&a,&b,&c);
printf("%f",(a > b ? (a > c ? a : c) : (b > c ? b : c )));
}
What will be the output if the values 23 34 2 where entered
option : 23.000000
answer : 34.000000
option : 2.000000
option : 23 34 2

question : Which of the following is the correct order of evaluation for the expression below?
z=x+y*z/4%2-1
answer : * / % + - =
option : / * % - + =
option : = * / % + -
option : * % / - + =

question : # 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


option : Compilation error
option : Runtime error
answer : 22
option : 8

question : # 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++);
printf("%d",n);
}

What is the output of the code above


answer : 14
option : 15
option : 22
option : Compilation Error

question : # 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


option : 10
option : 14
option : 22
answer : Compilation Error

question : C programming Language was created by ........


answer : Dennis Ritchie
option : John Kemeny
option : John Backus
option : Ken Thompson

question : C programming Language evolved from all of the following except ......
option : B programming Language
option : BCPL
answer : C++
option : ALGOL

question : Which of the following is false about C programming Language?


option : Every statement must be appended with a semicolon
option : C programming Language is Case Sensitive
answer : C programming Language is Column Sensitive
option : C programming Language is Strong Typing

question : Which of the following is a basic data type in C programming language?


option : Int
option : Char
option : Float
answer : double

question : Which is the Odd out of the following?


option : _1234
option : _ABC
answer : ABC.
option : _8_ABC

question : Which of the following is not an attribute of a variable in C programming?


option : Memory address
option : Datatype
answer : Pointer
option : Value

instruction : null
Module 2

question : What is the return value for scanf() function?


option : char *
option : string
answer : int
option : void

question : # include "stdio.h"


main() {
char FName[10]="Olalekan";
char SName[10]="Adebayo";
puts("Your Name is : "); puts(FName, SName);
}
What is the output of the code above?
option : Your Name is : Olalekan Adebayo
option : Your Name is
Olalekan Adebayo
option : Your Name is : OlalekanAdebayo
answer : Compilation error

question : # include "stdio.h"


main() {
int x,y;
scanf("%d.%d",&x,&y);
printf("%d.%d", x,y);
}
What will be the output if 20.20 is inputted
option : 20 20
answer : 20.20
option : 20. 20
option : 20 . 20

question : # include "stdio.h"


main() {
int x,y;
scanf("%d.%d",&x,&y);
printf("%d %d", x,y);
}
What will be the output if 20.20 is inputted
answer : 20 20
option : 20.20
option : 20 . 20
option : 20. 20
question : # 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
option : 20 30 40
option : 203040
option : Compilation error
answer : undesired result

question : # 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
option : 203040
answer : 2040
option : Undesired result
option : 2030

question : # include "stdio.h"


# include "string.h"
main(){
int n, i;
char s1[6] = "there";
i = 2;
n = strlen(s1);
n+=(++i + n++);
printf("%d",n%i);
}

What is the output of the code above?


option : 1
option : Compilation error
answer : 2
option : 0

question : # include "stdio.h"


main()
{
int a=-3, b=2,c=0,d;
d=++a || ++b && ++c;
printf("%d %d %d %d", a,b,c,d);
}

What is the output of the code above?


option : -4 2 1 0
answer : -2 2 0 1
option : -2 1 0 1
option : Compilation error

question : # include "stdio.h"


main()
{
int i=-3, j=2,k=0,m;
m=++i && ++j && ++k;
printf("%d %d %d %d", i,j,k,m);
}

What is the output of the code above?


answer : -2 3 1 1
option : -2 2 0 1
option : -2 3 0 1
option : Compilation error

question : # include "stdio.h"


main()
{
int i = 3;
i = i++;
printf("%d",i);
}

What is the output of the code above?


answer : 4
option : 3
option : Compilation error
option : Garbage value

question : Which of the following is false about variables in C programming Language?


option : Only a single value can be stored in a variable
option : The Data stored in variable can be accessed by the name of the variable
answer : A variable may not be declared before usage
option : A variable is initialized once only.

question : What is the return value for printf() function?


answer : int
option : char *
option : float
option : double

question : What is the return value for gets(str) function?


option : int
answer : char *
option : float
option : char
question : What is the return value for puts(str) function?
option : char*
answer : int
option : char
option : float

question : Which of the following is false about input/output functions in C programming Language?
option : scanf() function can accept more than one argument
option : printf() function accept more than one argument
answer : gets() function can accept more than one argument
option : gets() function does not preempts on blank space

question : # include "stdio.h"


main() {
char FName[10]="Ayobami";
char SName[10]="Esther";
printf("Your Name is : "); puts(FName, SName);
}
What is the output of the code above?
option : Your Name is : Ayobami Esther
option : Your Name is
Esther Ayobami
option : Your Name is : AyobamiEsther
answer : Compilation error

question : Which of the followingis false about conversion characters?


answer : Conversion character is a sequence of two characters which starts with %
option : Conversion character is an action character
option : Conversion character denotes a type into which the data for input or output is to be converted
option : Conversion characters are optional in scanf() and printf() functions

question : # include "stdio.h"


main() {
int x,y;
scanf("%d.%d",&x,&y);
printf("%d.%d", x,y);
}
What will be the output if 50.50 is inputted
option : 50 50
answer : 50.50
option : 50. 50
option : 50 . 50

question : # include "stdio.h"


main() {
int x,y;
scanf("%d.%d",&x,&y);
printf("%d %d", x,y);
}
What will be the output if 50.50 is inputted
answer : 50 50
option : 50.50
option : 50 . 50
option : 50. 50

question : # 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 50 60 70 is inputted
option : 50 60 70
option : 506070
option : Compilation error
answer : Undesired result

question : # 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 80 70 60 is inputted
option : 807060
answer : 8060
option : Undesired result
option : 8070

question : # include "stdio.h"


main(){
int x = 5, y = 6;
printf("%d", y=x);
}
What is the output of the code above?
answer : 5
option : 6
option : Compilation error
option : Undesired result

question : # include "stdio.h"


main(){
int x = 4, y = 5;
printf("%d", x==y);
}
What is the output of the code above?
option : 4
option : 5
answer : 0
option : Compilation error
question : # include "stdio.h"
# include "string.h"
main(){
int n, i;
char s1[6] = "hello";
i = 2;
n = strlen(s1);
n+=(++i + n++);
printf("%d",n%i);
}

What is the output of the code above?


option : 1
option : Compilation error
answer : 2
option : 0

question : # include "stdio.h"


# include "string.h"
main()
{
int n, i;
char s1[6] = "world";
i = 2;
n = strlen(s1);
n+=(++i + n++);
printf("%d",n);
}
answer : 14
option : Compilation error
option : Undesired result
option : 9

question : # include "stdio.h"


main()
{
int i=-2, j=1,k=0,m;
m=++i || ++j && ++k;
printf("%d %d %d %d", i,j,k,m);
}

What is the output of the code above?


option : -1 2 1 0
answer : -1 1 0 1
option : -1 2 0 1
option : Compilation error

question : # include "stdio.h"


main()
{
int i=-1, j=1,k=0,m;
m=++i && ++j && ++k;
printf("%d %d %d %d", i,j,k,m);
}

What is the output of the code above?


answer : 0 2 1 1
option : -2 2 0 1
option : 0 2 0 1
option : Compilation error

question : # include "stdio.h"


main()
{
int x=1, y=2,z=0,i;
i=x<y<z;
printf("%d", i);
}

What is the output of the code above?


option : 1
option : 2
answer : 0
option : Compilation error

question : # include "stdio.h"


main()
{
int i = 3;
i = i++;
printf("%d",++i);
}

What is the output of the code above?


option : 4
option : 3
answer : 5
option : Garbage value

question : # include "stdio.h"


main(){
int x = 1, y = 1;
x++; y--;++x;--y;
printf("%d", x!=y);
}
What is the output of the code above?
option : 4
option : 5
option : 0
answer : 1

question : # include "stdio.h"


main(){
int x = 5, y = 5;
printf("%d", x==y);
}
What is the output of the code above?
option : 4
option : 5
answer : 1
option : 0

question : # include "stdio.h"


main()
{
int x=1, y=2,z=5,i;
i=x<y<z;
printf("%d", i);
}

What is the output of the code above?


answer : 1
option : 0
option : 2
option : 5

question : # include "stdio.h"


main(){
int x = 1, y = 1;
x++; y--;++x;--y;
printf("%d", x=y);
}
What is the output of the code above?
option : 1
option : 0
answer : -1
option : 3

instruction : null

Module 3

question : # include "srdio.h"


main(){
int a=1;
for(;;){
printf("%d",a);
if(a>10)
continue;
}
}

Point out the error,if any, in the code above.


option : The condition in the for loop is a must
option : The two semicolons shoild be dropped
option : The for loop should be replaced by a while loop
answer : Compilation error

question : # include "stdio.h"


main()
{
int a = 4;
while()
{
printf("%d",a++);
if (i>20)
continue;
}
}

Point out the error, if any, in the while loop


answer : The condition in the while loop is a must
option : There should be atleast a semicolon in the while()
option : The while loop should be replaced by a for loop
option : No error

question : # include "stdio.h"


main(){
int a=500, b=100, c ;
if(!(a>=400))
b=300;
c=200;
printf("b = %d c = %d",b,c);
}

What is the output of the code above?


answer : b = 100 c = 200
option : b=300 c=200
option : b = 300 c = 200
option : b=100 c=200

question : What is the output of the code below?


# include "stdio.h"
main(){
int a=300, b=10, c=20 ;
if(!(a>=400))
b=300;
c=200;
printf("b = %d c = %d",b,c);
}
answer : b = 300 c = 200
option : b = 10 c = 200
option : b=10 c=20
option : b=300 c=200

question : What is the output of the code below?


# include "stdio.h"
main(){
int a=1, b=10%9 ;
if(a!=b) ;
printf("a=%d b=%d",a,b);
}
answer : a=1 b=1
option : Compilation error
option : a = 1 b = 1
option : a = 1 b = 10

question : What is the output of the code below?


# include "stdio.h"
main(){
int x=0, y=1 ;
y=!x; x=!y;
printf("x=%d y=%d",x,y);
}
answer : x=0 y=1
option : x=1 y=1
option : x=1 y=0
option : Compilation error

question : What is the output of the code below?


# include "stdio.h"
main(){
int x=10, y=-20 ;
x=!x; y=!y;
printf("x=%d y=%d",x,y); }
answer : x=0 y=0
option : x=10 y=-20
option : Garbage value
option : Compilation error

question : What is the output of the code below?


# include "stdio.h"
main(){
if(!3.14)
printf("Hello");
else printf("World");

}
option : Hello
answer : World
option : Compilation error
option : Garbage value
question : What is the output of the code below?
# include "stdio.h"
main(){
int x=3, y=4, z=4 ;
printf("%d",z>=y&&y>=x?1:0);
}
answer : 1
option : 3
option : Compilation error
option : Garbage value

question : What is the output of the code below?


# include "stdio.h"
main(){
int x=3, y=4, z=4 ;
printf("%d",z>=y>=x?100:200);
}
option : 100
answer : 200
option : 3
option : Cimpilation error

question : What is the output of the code below?


# include "stdio.h"
main(){
int x=10;
if x>=2
printf("%d",x);
}
option : 10
option : 2
answer : Compilation error
option : Garbage value

question : 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");
}
option : Hello
answer : World
option : Garbage value
option : Compilation error

question : # include "stdio.h"


main()
{
int i = -4, j , num = 10;
j = i%-3;
j = (j ? 0: num * num);
printf ("j = %d",j);
}

What is the output of the code above?


answer : j = 0
option : j = 10
option : j = 100
option : Garbage value

question : # include "stdio.h"


main()
{
int k = 12,n = 30;
k = (k>5&&(n = 4?100:200));
printf ("%d",k);
}

What is the output of the code above?


option : 100
option : 200
answer : 1
option : Compilation Error

question : 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);
}
answer : 10
option : 0
option : 1
option : Compilatioon error

question : What is the output of the code below?

# include "stdio.h"
main( )
{
int x = 10;
if (!!x)
printf ("%d" , !x);
else
printf ("%d",x);
}
option : 100
answer : 0
option : Garbage value
option : Compilation error

question : Which is the odd out of the following?


option : break
option : continue
answer : switch
option : goto

question : Which is the odd out of the following?


option : if
option : switch
option : while
answer : continue

question : Break statement can work with following but .....


answer : if statement
option : for statement
option : while statement
option : switch statement

question : # include "stdio.h"


main(){
int i=1;
for(;;){
printf("%d",i);
if(i>10)
break;
i++;
}
}

Point out the error,if any, in the for loop


option : The condition in the for loop is a must
option : The two semicolons shoild be dropped
option : The for loop should be replaced by a while loop
answer : No error

question : # include "stdio.h"


main()
{
int i = 1;
while(1,i>0)
{
printf("%d",i++);
if (i>10)
break;
}
}

Point out the error, if any, in the while loop answer : The condition in the while loop is a must option : There
should be atleast a semicolon in the while()
option : The while loop should be replaced by a for loop
answer : No error

question : What is the output of the code below?


# include "stdio.h"
main(){
int a=300, b=10, c=20 ;
if(!(a>=400))
b=300;
c=200;
printf("b = %d c = %d",b,c);
}
answer : b = 300 c = 200
option : b = 10 c = 200
option : b=10 c=20
option : b=300 c=200

question : What is the output of the code below?


# include "stdio.h"
main(){
int x=10, y=100%90 ;
if(x!=y)
printf("x=%d y=%d",x,y);
}
answer : x=10 y=10
option : x=10 y=100
option : x = 10 y = 10
option : x = 10 y = 100

question : What is the output of the code below?


# include "stdio.h"
main(){
int x=0, y=1 ;
y=!x; x=!y;
printf("x=%d y=%d",x,y);
}
answer : x=0 y=1
option : x=1 y=1
option : x=1 y=0
option : Compilation error

question : What is the output of the code below?


# include "stdio.h"
main(){
int x=10, y=-20 ;
x=!x; y=!y;
printf("x=%d y=%d",x,y); }
answer : x=0 y=0
option : x=10 y=-20
option : Garbage value
option : Compilation error

question : What is the output of the code below?


# include "stdio.h"
main(){
if(!0)
printf("Hello");
else printf("World");

}
answer : Hello
option : World
option : Compilation error
option : Garbage value

question : What is the output of the code below?


# include "stdio.h"
main(){
int x=3, y=4, z=4 ;
printf("%d",z>=y&&y>=x?1:0);
}
answer : 1
option : 3
option : Compilation error
option : Garbage value

question : What is the output of the code below?


# include "stdio.h"
main(){
int x=3, y=4, z=4 ;
printf("%d",z>=y>=x?100:200);
}
option : 100
answer : 200
option : 3
option : Cimpilation error

question : What is the output of the code below?


# include "stdio.h"
main(){
int x=10;
if (x>=2, 1)
printf("%d",x);
}
answer : 10
option : 2
option : Compilation error
option : Garbage value

question : What is the output of the code below?


# include "stdio.h"
main(){
int x=10, j=40;
if ((j-i)%10)
printf("Hello");
else printf("World");
}
option : Hello
answer : World
option : Garbage value
option : Compilation error

question : # include "stdio.h"


main()
{
int i = -4, j , num = 10;
j = i%-2;
j = (j ? 0: num * num);
printf ("j = %d",j);
}

What is the output of the code above?


option : j=0
option : j=10
answer : j=100
option : Garbage value

question : What is the output of the code below?

# include "stdio.h"
main()
{
int c = 0, d = 5, e = 10, a;
a = c> 1 ? d > 11| e > 1 ? 100:200:300;
print f ("%d" , a) ;
}
option : 100
option : 200
answer : 300
option : Compilation error

question : What is the output of the code below?

# include "stdio.h"
main( )
{
int x = 0;
if (!!x)
printf ("%d" , !x);
else
printf ("%d",x);
}
option : 100
answer : 0
option : 1
option : Compilation error

question : Which is the odd out of the following?


option : break
option : continue
answer : switch
option : goto

question : Which is the odd out of the following?


option : if
option : switch
option : while
answer : continue

question : Break statement can work with following but .....


answer : if statement
option : for statement
option : while statement
option : switch statement

question : # include "stdio.h"


main()
{
int i = 1;
while(0,i>0)
{
printf("%d",i++);
if (i>10)
break;
}
}

Point out the error, if any, in the while loop


answer : No error
option : Compilation error
option : Runtime error
option : The while loop can't have two conditional expression

instruction : null

Module 4
instruction : null question : What is the output of the code below?

# 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]);
}
}
answer : Compilation error
option : Runtime error
option : Garbage value
option : 10

question : What is the output of the code below?

# include "stdio.h"
main()
{
int i, j = 10, arrsize;
int arr[arrsize];
if ( j == 10)
arrsize = 20 ;
else
arrsize = 40 ;
for ( i = 0 ; i < arrsize; i++)
arr[i] = 100;
}
answer : Compilation error
option : Runtime error
option : 20
option : 40

question : 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]);
}
}
option : Compilation error
option : Runtime error
answer : 32 32 32 32 32 32 32 32 32 32
option : 32 33 34 35 36 37 38 39 40 41
question : What is the output of the code below?
include "stdio.h"
main()
{
int b[] = {10,20,30,40,50} ;
int i ;
for ( i = 0 ; i <= 4 ; i++)
printf ("%d ", b[i]) ;
}
answer : 10 20 30 40 50
option : 1020304050
option : Compilation error
option : Runtime error

question : What is the output of the code below?

include "stdio.h"
main()
{
int Array[6] = {1,2,3,4,5,6} ;
int i ;
for ( i = 0 ; i <= 5 ; i++)
printf ("%d",Array[i]) ;
}
answer : 123456
option : 1 2 3 4 5 6
option : Compilation error
option : Garbage value

question : 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]) ;
}
answer : 6 5 4 3 2
option : 65432
option : Compilation error
option : Runtime error

question : What is the output of the code below?

# include "stdio.h"
main()
{
int arr(25), i ;
for ( i = 0 ; t <= 100; t++)
{
arr(i) = 100;
printf ("%d",arr(i)) ;
}
}
option : 25
option : 100
answer : Compilation error
option : Runtime error

question : What is the output of the code below?

# include "stdio.h"
main()
{
int a[ ] = {10,20,30,40,50} ;
int j ;
for ( j = 0 ; j < 5; j++)
{
printf ("%d",*a) ;
a++;
}
}
option : 10 20 30 40 50
option : 1020304050
answer : Compilation error
option : Runtime error

question : What is the output of the code below?

# include "stdio.h"
main()
{
float a[ ] = {13.24,1.5,1.5, 5.4,3.5} ;
float *j, *k;
j=a;
k=a+4 ;
j=j*2;
k=k/2 ;
printf ("%f%f",*j,*k) ;
}
answer : Compilation error
option : Runtime error
option : 13.24 1.5 1.5 5.4 3.5
option : Garbage error

question : 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++ ;
}
}
answer : 10 20 30 40 50
option : 1020304050
option : Compilation error
option : Runtime error

question : What is the output of the code below?


# include "stdio.h"
main()
{
int a[] = {2,4,6,8,10} ;
int i ;
for ( i = 0 ; i <= 4 ; i++)
{
*(a+i)=a[i ] + a[i];
printf ("%d ", *( i + a)) :
}
}
answer : 4 8 12 16 20
option : Garbage value
option : Runtime error
option : Compilation error

question : What is the output of the code below?

# include "stdio.h"
main()
{
int arr[] ={0,1,2,3,4} ;
int i, *ptr;
for (ptr = &arr[0]; ptr <= &arr[4]; ptr++)
printf ("%d ",*ptr) ;
}
answer : 0 1 2 3 4
option : 01234
option : Compilation error
option : Runtime error

question : What is the output of the code below?

# include "stdio.h"
main()
{
int arr[] ={0,1,2,3,4} ;
int i, *ptr;
for (ptr = &arr[0], i = 0 ; i <= 4 ; i++)
printf ("%d",ptr[i]) ;
}
option : 0 1 2 3 4
answer : 01234
option : Compilation error
option : Runtime error

question : What is the output of the code below?

# include "stdio.h"
main()
{
int arr[] = { 0,1,2,3,4} ;
int i, *p;
for (p = arr, i = 0 ; p + i <= arr + 4 ; p++, i++)
printf ("%d ",*(p + i)) ;
)
option : 0 1 2 3 4
answer : 0 2 4
option : 01234
option : 024

question : What is the output of the code below?

# include "stdio.h"
main()
{
int arr[] = {0,2,4,6,8} ;
int i, *ptr;
for (ptr = arr + 4 ; ptr <= arr; ptr--)
printf ("%d ",*ptr) ;
}
answer : 8 6 4 2 0
option : 86420
option : 0 2 4 6 8
option : 02468

question : What is the output of the code below?


# include "stdio.h"
main()
{
int arr[] = {0,2,4,6,8} ;
int i, *ptr;
for (ptr = arr + 4, i = 0 ; i <= 4 ; i++)
printf ("%d", ptr[-i]);
}
answer : 8 6 4 2 0
option : 86420
option : 02468
option : 0 2 4 6 8
question : # include "stdio.h"
# include "alloc.h"
# include "stdlib.h"
main()
{
char *sname ;
sname=(char *)malloc(5);
char fname[6]=("World");
sname=fname;
free(sname);
printf("%s",sname);
}
What id the output of the code above?
answer : World
option : garbage value
option : Compilation error
option : Runtime error

question : What is the output of the code below?

# include "stdio.h"
main()
{
float arr[] ={1.2,12,2.4,24,3.5,35} ;
int i ;
for ( i = 0 ; i <= 5; i++)
printf ("%.2f", arr[i]);
}
answer : 1.20 12.00 2.40 24.00 3.50 35.00
option : 1.2 12 2.4 24 3.5 35
option : Compilation error
option : Garbage value

question : What is the output of the code below?

# include "stdoi.h"
main()
{
static int a[]={2,3,4,5,6} ;
int i ;
for ( i = 5 ; i > 0; )
printf ("%d ",a[--i]) ;
}
option : 6 5 4 3 2
option : 65432
answer : Compilation error
option : Runtime error

question : What is the output of the code below?

# include "stdio.h"
main()
{
int n[25];
n[0] = 100;
n[24] = 200;
printf ("%d %d", *n, *(n + 24) + *( n + 0)) ;
}
answer : 100 300
option : 100 200
option : 200 300
option : Compilation error

question : # include "stdio.h"


# include "alloc.h"
# include "stdlib.h"
main()
{
char *sname ;
char fname[6]=("hello");
sname=fname;
free(sname);
printf("%s",sname);
}
What id the output of the code above?
answer : hello
option : garbage value
option : Compilation error
option : Runtime error

instruction : null

Module 5

question : What is the value of var after executing the following program

#include "stdio.h"
#define var 5
int main()
{
int *ptrx;
ptrx = &var;
*ptrx = 10;
printf("%d\n", var);
return 0;
}
option : 5
option : 10
answer : Compilation error
option : Rubtime error

question : . What is the value of x after executing the following program

#include "stdio.h"
int main()
{
int x=15;
int *ptrx;
ptrx = &x;
*ptrx = 20;
printf("%d\n", x);
return 0;
}
option : 15
answer : 20
option : Compilation error
option : Runtime error

question : Assume variable x is stored at memory location 100, y at memory 200, and ip at memory 300. What
will be the value of ip after executing the following statements?

int x, y, *ip; y=5;


ip=&x; option : ip = 300
answer : ip = 100
option : ip = 200
option : ip = 5

question : Assume variable x is stored at memory location 1000, y at memory 2000, and ip at memory 100. What
will be the value of y after executing the following statements?

int x, y, *ip;
x=5;y=10;
ip=&x;
y= *ip;
option : y =1000
answer : y = 5
option : y = 10
option : Runtime error

question : Assume variable x is stored at memory location 1000, y at memory 2000, and ip at memory 100. What
will be the value of y after executing the following statements?

int x, y, *ip;
x=5;y=10;
ip=&y;
y= *ip;
option : y=1000
option : y=5
answer : y=10
option : Runtime error

question : Assume variable x is stored at memory location 100, y at memory 200, and ip at memory 1000. What
will be the value of y after executing the following statements?

int x, y, *ip;
x=1;y=2;
ip=&x;
y= ip;
answer : y=100
option : y = 1
option : y=2
option : Runtime error

question : Assume variable x is stored at memory location 100, y at memory 200, and ip at memory 1000. What
will be the value of y after executing the following statements?

int x, y, *ip1,*ip2;
x=1;y=2;
ip1=&x;
ip2=&y;
y= ip2;
option : y=100
answer : y=200
option : y=1
option : y=2

question : Assume variable x is stored at memory location 100, y at memory 200, and ip at memory 1000. What
will be the value of y after executing the following statements?

int x, y, *ip1,*ip2;
x=10;y=2;
ip1=&x;
ip2=&y;
y= *ip1;
option : y=100
option : y=1000
option : y=200
answer : y=10

question : Assume variable x is stored at memory location 100, y at memory 200, and ip at memory 1000. What
will be the value of y after executing the following statements?

int x, y, *ip1,*ip2;
x=1;y=2;
ip1=&x;
ip2=&y;
y= ++(*ip2);
option : y=1
option : y=2
answer : y=3
option : y=100

question : What is the value of y after executing the following program?


#include "stdio.h"
main()
{
int count,y;
count = 20;
y = count > 10 ? 100:200;
printf("\ny=%i",y);
}
option : y=200
option : y=20
answer : y=100
option : y=10

question : # include "stdio.h"


# include "alloc.h"
# include "stdlib.h"
main()
{
char *sname ;
sname=(char *)malloc(5);
char fname[6]=("hello");
sname=fname;
free(sname);
printf("%s",fname);
}

What is the output of the code above?


answer : hello
option : Garbage value
option : Compilation error
option : Runtime error

question : # include "stdio.h"


# include "string.h"
# include "alloc.h"
main()
{
char *sname ="hello";
char fname[6];
strcpy(sname,fname);
printf("%s",sname);
}
option : hello
answer : Garbage value
option : Compilation error
option : Runtime error

question : . What is the value of x after executing the following program

#include "stdio.h"
int main()
{
int x=15;
int *ptrx;
ptrx = &x;
*ptrx = 20;
printf("%d\n", x);
return 0;
}
option : 15
answer : 20
option : Compilation error
option : Runtime error

question : Assume variable x is stored at memory location 1000, y at memory 2000, and ip at memory 3000.
What will be the value of ip after executing the following statements?

int x, y, *ip; y=2;


ip=&x;
option : ip = 3000
answer : ip = 1000
option : ip = 2000
option : ip = 2

question : Assume variable x is stored at memory location 100, y at memory 200, and ip at memory 1000. What
will be the value of y after executing the following statements?

int x, y, *ip;
x=1;y=2;
ip=&x;
y= *ip;
option : y =100
answer : y = 1
option : y = 2
option : Runtime error

question : Assume variable x is stored at memory location 100, y at memory 200, and ip at memory 1000. What
will be the value of y after executing the following statements?

int x, y, *ip;
x=1;y=2;
ip=&y;
y= *ip;
option : y=100
option : y=1
answer : y=2
option : Runtime error

question : Assume variable x is stored at memory location 100, y at memory 200, and ip at memory 1000. What
will be the value of y after executing the following statements?

int x, y, *ip;
x=1;y=2;
ip=&x;
y= ip;
answer : y=100
option : y = 1
option : y=2
option : Runtime error

question : Assume variable x is stored at memory location 100, y at memory 200, and ip at memory 1000. What
will be the value of y after executing the following statements?

int x, y, *ip1,*ip2;
x=1;y=2;
ip1=&x;
ip2=&y;
y= ip2;
option : y=100
answer : y=200
option : y=1
option : y=2

question : Assume variable x is stored at memory location 100, y at memory 200, and ip at memory 1000. What
will be the value of y after executing the following statements?

int x, y, *ip1,*ip2;
x=10;y=2;
ip1=&x;
ip2=&y;
y= *ip1;
option : y=100
option : y=1000
option : y=200
answer : y=10

question : Assume variable x is stored at memory location 100, y at memory 200, and ip at memory 1000. What
will be the value of y after executing the following statements?

int x, y, *ip1,*ip2;
x=1;y=2;
ip1=&x;
ip2=&y;
y= ++(*ip2);
option : y=1
option : y=2
answer : y=3
option : y=100

question : What is the value of y after executing the following program?


#include "stdio.h"
main()
{
int count,y;
count = 20;
y = count > 10 ? 100:200;
printf("\ny=%i",y);
}
option : y=200
option : y=20
answer : y=100
option : y=10

question : # include "stdio.h"


# include "alloc.h"
# include "stdlib.h"
main()
{
char *sname ;
sname=(char *)malloc(5);
char fname[6]=("hello");
sname=fname;
free(sname);
printf("%s",fname);
}

What is the output of the code above?


answer : hello
option : Garbage value
option : Compilation error
option : Runtime error

question : # include "stdio.h"


# include "string.h"
# include "alloc.h"
main()
{
char *sname ="hello";
char fname[6];
strcpy(sname,fname);
printf("%s",sname);
}
option : hello
answer : Garbage value
option : Compilation error
option : Runtime error

question : Which is not a valid operation on pointer ?


option : Relational Operator
option : Assignment Operator
option : Poniter Arithmetic
answer : Logical Operator

question : Which of the following is false about a pointer of type void* ?


option : It can be assigned pointer of any type
option : It must be casted to the newly assigned type
option : The value pointed to by void pointer is not valid
answer : The value pointed to by void pointer is valid
question : The concept of a pointer in programming to ...............
answer : effective usage of memory
option : effective usage of values
option : effective usage of time
option : effective usage of compiler

question : Memory allocated to pointer are taken from the .......


option : Global memory
option : main memory
answer : heap
option : registers

question : # include "stdio.h"


int b=9;
int *a = &b;
void *ptr;
main()
{
ptr = &b;
a=(int *) ptr;
printf("%d ", *a);
}
What is the output of the code above ? option : Compilation error
option : Runtime error
answer : 9
option : address of a

question : # include "stdio.h"


int b=9;
int *a = &b;
void *ptr;
main()
{

ptr = &b;
a=(char *) ptr;
printf("%d ", b);
}
What is the output of the code above ?
option : Address of a
option : 9
answer : compilation error
option : runtime error

question : # include "stdio.h"


int b=9;
int *a = &b;
void *ptr;
main()
{
ptr = &b;
a= ptr;
printf("%d ", *a);
}
What is the output of the code above ?
option : 9
option : Address of a
answer : Compilation error
option : Runtime error

question : # include "stdio.h"


int b=9;
int *a = &b;
void *ptr;
main()
{

ptr = &b;
a= ptr;
printf("%d ", b);
}

What is the output of the code above ?


option : 9
option : Address of a
answer : Compilation error
option : Runtime error

instruction : null

Module 6

instruction : null question : # include "stdio.h"


main()
{
printf(5+"olalekan");
}
answer : kan
option : 5olalekan
option : Compilation error
option : olale

question : # include "stdio.h"


main()
{ char st1[ ]="hello";
char st2[ ]= "hello";
if(st1==st2)puts("equal");
puts("unequal");
}
What is the output of the code above?
option : equal
answer : unequal
option : equal
unequal
option : compilation error

question : # include "stdio.h"


main()
{ char st1[ ]="hello";
char st2[ ]= "Hello";
if(st1==st2)puts("equal");
puts("unequal");
}
What is the output of the code above?
option : equal
option : unequal
answer : equal
unequal
option : compilation error

question : # include "stdio.h"


main()
{ char st1[ ]="hello";
char st2[ ]= "hello";
if(st1!=st2)puts("equal");
puts("unequal");
}
What is the output of the code above?
option : equal
option : unequal
answer : equal
unequal
option : compilation error

question : # include "stdio.h"


main()
{
char st[5]="hello";
printf("%s",st);
}

What is the output of the code above?


answer : compilation error
option : hello
option : garbage value
option : runtime error

question : # include "stdio.h"


main()
{
char st[6]="hello";
printf("%c",st);
}

What is the output of the code above?


answer : NO output
option : Compilation error
option : Runtime error
option : h

question : # include "stdio.h"


main()
{
char st[6]="hello";
printf("%c",*st);
}

What is the output of the code above?


option : hello
answer : h
option : Compilation error
option : Garbage vale

question : # include "stdio.h"


main()
{
char st[6]="hello";
printf("%s",*st);
}

What is the output of the code above?


option : h
option : hello
option : Compilation error
answer : Runtime error

question : # include "stdio.h"


# include "string.h"

main()
{
char fname[10], sname[10];
strcpy(fname,"BAyo");
strcpy(sname, "baYo");
printf("%s", memcpy(fname, sname,1));
}

What is the output of the code above?


option : bAyo
option : BAyo
option : baYO
answer : baYo
question : # include "stdio.h"
# include "string.h"

main()
{
char fname[10], sname[10];
strcpy(fname,"BAyo");
strcpy(sname, "baYo");
printf("%s", memcpy(fname, sname,2));
}

What is the output of the code above?


option : bayo
option : bAyo
option : BAyo
answer : baYo

question : What is the return type of strlen() fucntion ?


option : integer
answer : unsigned
option : long
option : memory address

question : What is the return type of strcat() function ?


option : int
option : short
option : long
answer : memory address

question : # include "stdio.h"


# include "string.h"

main()
{
char fname[10], sname[10];

strcpy(fname,"BAyo");
strcpy(sname, "baYo");
printf(" %d", strcmpi(fname, sname));

}
What is the output of the code above?
answer : 0
option : 1
option : -1
option : No output

question : # include "stdio.h"


# include "string.h"

main()
{
char fname[10], sname[10];

strcpy(fname,"BAyo");
strcpy(sname, "baYo");
printf(" %d", strcmp(fname, sname));

}
What is the output of the code above?
option : 0
option : 1
answer : -1
option : No output

question : # include "stdio.h"


# include "string.h"
# include "stdlib.h"
main()
{
char str[6] = "12pet";
char str1[6] = "paul";
char ch = 'e';
int x = atoi(str);
printf("%f",atof(str));

return 0;
}
What is the ouytput of the code above?
option : 12
answer : 12.000000
option : Compilation error
option : Garbage value

question : # include "stdio.h"


# include "string.h"
# include "stdlib.h"
main()
{
char str[6] = "12pet";
char str1[6] = "paul";
char ch = 'e';
printf("%s",strchr(str,ch));
return 0;
}
What is the output of the code above ?
answer : et
option : Compilation error
option : 12pet
option : 12p

question : # include "stdio.h"


# include "string.h"
# include "stdlib.h"
main()
{
char str[6] = "12pet";
char str1[6] = "paul";
char ch = 'e';
printf("%s",strset(str1,ch));
return 0;
}
What is the output of the code above ?
answer : eeee
option : paul
option : No output
option : Compilation error

question : .......... fucntion is used to clear the buffer attached to the standard input.

answer : fflush()
option : clear()
option : exit()
option : dump()

instruction : null

Module 7

instruction : null question : # include "stdio.h"


main()
{
struct employee {
char name[25];
int age;
float bs;
}
struct employee e ;
e.name = "Hacker" ;
e.age = 25 ;
print
f ("%s %d", e.name, e.age) ;
}

What is the ouitput of the code above?


answer : Compilation error
option : Runtime error
option : Hacker 25
option : Grabage Value

question : # include "stdio.h"


main()
{
struct
{
char name[25];
char language[10].
}a ;
static struct a = {"Hacker","C"};
printf ("%s %s", a.name, a.language) ;
}

What is the output of the code above?


answer : Compilation error
option : Runtime error
option : Hacker C
option : C Hacker

question : # include "stdio.h"


struct virus
{
char signature[25];
int size;
}v[2] ;
main()
{
static struct v[0] = {"Better by Far", 1975} ;
static struct v[1] = {"Naturally Ahead", 1970} ;
int i ;
for ( i = 0 ; i <= 1 ; i++)
printf ("%s %d\n", v[i].signature, v[i].size) ;
}

What is the output of the code above?


answer : Compilation error
option : Runtime error
option : Naturally Ahead 1970
option : Better by Far 1970

question : # include "stdio.h"


# include "string.h"
main()
{ struct
{
int num;
float f ;
char mess[50];
}m;
m.num = 1 ;
m.f = 314 ;
strcpy (m.mess, "Hello");
printf ("%d %.2f %s\n", m.num, m.f, m.mess);
}

What is the output of the code above?


option : Compilation error
option : Runtime error
answer : 1 314.00 Hello
option : Garbage value

question : # include "stdio.h"


# include "stdlib.h"
main()
{
struct node
{
int data;
struct node *link;
};
struct node*p,*q;
p = (node *)malloc (sizeof (struct node)) ;
q = (node *)malloc (sizeof (struct node)) ;
printf ("%d %d", sizeof (p) , sizeof (q)) ;
}

What is the output of the code above ?


answer : 4 4
option : Compilation error
option : Runtime error
option : 44

question : # include "stdio.h"


# include "stdlib.h"
main()
{
struct node
{
int 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?
answer : 4
option : Compilation error
option : Runtime error
option : Garbage value

question : # include "stdio.h"


# include "stdlib.h"
main()
{
struct node
{
int data;
struct node *link;
};
struct node*p,*q;
p = (node *)malloc (sizeof (struct node)) ;
q = (node *)malloc (sizeof (struct node)) ;
printf ("%d %d", sizeof (p)) ;
}

What is the output of the code above?


option : 4
option : Compilation error
option : Runtime error
answer : Garbage value

question : # include "stdio.h"


# include "stdlib.h"
main()
{
struct node
{
int data;
struct node *link;
};
struct node*p,*q;
p = (node *)malloc (sizeof (struct node)) ;
q = (node *)malloc (sizeof (struct node)) ;
printf ("%d %x", sizeof (p) , sizeof (q)) ;
}

What is the output of the code above?


answer : 4 4
option : Compilation error
option : Runtime error
option : Garbage value

question : # include "stdio.h"


# include "stdlib.h"
main()
{
struct node
{
int data;
struct node *link;
};
struct node*p,*q;
p = (node *)malloc (sizeof (struct node)) ;
q = (node *)malloc (sizeof (struct node)) ;
printf ("%x %x", sizeof (p) , sizeof (q)) ;
}

What is the output of the code above?


answer : 4 4
option : Compilation error
option : Runtime error
option : Garbage value
question : # include "stdio.h"
# include "stdlib.h"
main()
{
struct node
{
int data;
struct node *link;
};
struct node*p,*q;
p = (node *)malloc (sizeof (struct node)) ;
q = (node *)malloc (sizeof (struct node)) ;
printf ("%X%x", sizeof (p) , sizeof (q)) ;
}

What is the output of the code above?


option : Compilation error
option : Runtime error
answer : 4 4
option : Garbage value

You might also like