Download as pdf or txt
Download as pdf or txt
You are on page 1of 8

Pre-Assessment Module

1. Dashboard
2. My courses
3. PA
4. Topic 1
5. SET-A

Previous Activity
Next Activity
Started on Wednesday, 1 May 2019, 1:52 PM
State Finished
Completed on Wednesday, 1 May 2019, 1:59 PM
Time taken 6 mins 57 secs

Question 1

Complete
Marked out of 2
Flag question

Question text

What is the output of following c code?

#include<stdio.h>

int main()

int i;

i = 10;

printf("i : %d\n",i);

printf("sizeof(i++) is: %d\n",sizeof(i++));

printf("i : %d\n",i);

return 0;

Select one:
a. compile time error
b. run time error
c. i=10, sizeof(i++) is:4,i=11
d. i=10, sizeof(i++) is:4,i=10

Question 2

Complete
Marked out of 2
Flag question

Question text

What is the output of following c code?

# include <stdio.h>

void print(int arr[])


{

int n = sizeof(arr);

int i;

for (i = 0; i < n; i++)

printf("%d ", arr[i]);

int main()

int arr[] = {1, 2, 3, 4, 5, 6, 7, 8};

print(arr);

return 0;

Select one:
a. Compile Error
b. Runtime error
c. 209874
d. 1 2 3 4 5 6 7 8

Question 3

Complete
Marked out of 2
Flag question

Question text

What is the ouput for the following c code?

#include <stdio.h>

struct point

int x;

int y;

};

struct notpoint

int x;

int y;

};

struct point foo();

int main()

struct point p = {1};

struct notpoint p1 = {2, 3};

p1 = foo();

printf("%d\n", p1.x);

struct point foo()


{

struct point temp = {1, 2};

return temp;

Select one:
a. Garbage Value
b. 1
c. 2
d. Compilation Error

Question 4

Complete
Marked out of 2
Flag question

Question text

Which of the datatypes have size that is variable?


Select one:
a. int
b. struct
c. float
d. double

Question 5

Complete
Marked out of 2
Flag question

Question text

What is the output of the following program

main( )

int a=5, i=1;

while(i++ <a)

printf(“%d”,a);

return 0;

Select one:
a. 5,4,3,2,1
b. 5 5 5 5 5
c. 4,3,2,1
d. 1 1 1 1 1

Question 6

Complete
Marked out of 2
Flag question

Question text

#include<stdio.h>
int main()
{
int a = 10;
int *p = &a;
int *ptr = p;
printf("%u",*ptr);
return 0;
}
Select one:
a. 10
b. Address
c. 2
d. Compilation error
e. None of above

Question 7

Complete
Marked out of 2
Flag question

Question text

Point out the error in the program?

#include<stdio.h>

int main()

union a

int i;

char ch[2];

};

union a z1 = {512};

union a z2 = {0, 2};

return 0;

Select one:
a. Error: invalid union declaration
b. Error: in Initializing z2
c. No error
d. None of above

Question 8

Complete
Marked out of 2
Flag question

Question text

Among the following which is not a C token


Select one:
a. strings
b. constants
c. identifers
d. comment

Question 9

Not answered
Marked out of 2
Flag question

Question text

#include <stdio.h>
struct p

int x[2];

};

struct q

int *y;

};

int main()

struct p p1 = {1, 2};

struct q *ptr1;

ptr1->y = (struct q*)&p1->x;

printf("%d\n", ptr1->y[1]);

Select one:
a. Compilation Error
b. 2
c. 1
d. Runtime Error

Question 10

Complete
Marked out of 2
Flag question

Question text

What is the output of following c code?


#include<stdio.h>
int main()
{
printf("%c", "CampusCorporateConnect"[10]);
return 0;
}
Select one:
a. orateConnect
b. o
c. CampusCorp
d. CompileError

Question 11

Complete
Marked out of 2
Flag question

Question text

Consider scanf("%2d", &n); and the input data is 3142 then n will be assigned
Select one:
a. 42
b. 31.42
c. error
d. 31

Question 12

Complete
Marked out of 2
Flag question

Question text

What if the value of n=8;

int sum(int n)

if (n==0)

return n;

else

return n + sum(n-1);

Select one:
a. 40
b. 36
c. 8
d. 15

Question 13

Complete
Marked out of 2
Flag question

Question text

The largest element of an array index is called its _________


Select one:
a. lower bound
b. range
c. upper bound
d. All of these

Question 14

Complete
Marked out of 2
Flag question

Question text

#include<stdio.h>
int main()
{
char arr[10];
arr = "world";
printf("%s",arr);
return 0;
}
Select one:
a. world
b. w
c. Null
d. Compilation error
e. None of above

Question 15

Complete
Marked out of 2
Flag question

Question text

What will be the output of following program ?

#include <stdio.h>
int main()

int a=10;

if(10L == a)

printf("10L");

else if(10==a)

printf("10");

else

printf("0");

return 0;

Select one:
a. 10
b. 10L
c. 10L10
d. ERROR

Question 16

Complete
Marked out of 2
Flag question

Question text

Give the output of the following program:


#include<stdio.h>
int main()
{
int I=1;
while (I < 5)
{
printf("%d", I);
}
return 0;
}
Select one:
a. Infnite loop
b. Warning for no return type for main ( )
c. Print the value of I as 1
d. Prints the value of I as11111

Question 17

Complete
Marked out of 2
Flag question

Question text

What will be the value of x and y ?

#include <stdio.h>

int main()

int x,y;

x=(100,200);

y=100,200;

printf("x=%d,y=%d",x,y);
return 0;

Select one:
a. x=100,y=200
b. x=200,y=200
c. ERROR
d. x=200,y=100

Question 18

Complete
Marked out of 2
Flag question

Question text

int something(int number)


{
if(number <= 0)
return 1;
else return number *something(number-1);
}
something(4);
Select one:
a. 12
b. 24
c. 1
d. 0

Question 19

Complete
Marked out of 2
Flag question

Question text

What is the output of the following program?

#include<stdio.h>

int main()

int x=10,y=20;

switch(x,y)

case 10: printf("ccc");

break;

case 20:printf("CCC");

break;

Select one:
a. Compilation error
b. ccc
c. CCC
d. Warning

Question 20

Complete
Marked out of 2
Flag question

You might also like