1-Pi takes 8 bytes in data memory----False (0 Bytes)
2-Any statements that begins with a points …---True
3-File.a is an assembly files. ---False
4-gcc-c main c produces main.o file. ----True
5-gcc-E pre 1.c o pre2.c ,The pre2.c file is a preprocessed and executable file ready to run ----False
6-gcc-S file.c will produce file.s –True
7-gcc-s file.c will produce file.s –False
8-gcc main.c sqrt.c will produce a lager file size than gcc-static main.c sqrt.c ---False
9- gcc main.c sqrt.c will produce a faster exucution than gcc-static main.c sqrt.c ---False
10- gcc main.c sqrt.c will produce an exucatable file which cannot run if a related library--- False
11-- gcc sqrt.o main o produces a.out file which is executable---True
12-Linking is the process of bringing together multiple acces –False
13-sqrt= main.o sqrt.o
Gcc-o sqrt sqrt.o main.o
Main.o=main.c
Gcc-c main.c
Sqrt.o=sqrt.c
Gcc –c sqrt.c
When we run the make commend first time there will be three gcc commend execution. ---True
14-When we update main.c and asrt.c make will do two gcc command execution. –False
15-When we update main.c make will do two gcc commands execution—True
16- When we run the make commend second time them... ---True
17-Object code files can do created from any ,not just C –True
18-extern int x , x variable is visible from another file –True
19-int x
Auto int y
Storage classes of x and y are same----True
How can you fix the logical error
here:
#include <stdio.h>
#include <math.h>
main(int argc,char
*argv[])
{
int n,i;
int d2,count;
double d1;
while (1)
{
printf("Enter a number (0 to quit): "
scanf("%d",&n);
if (n == 0)
break;
count=0;
for (i=0; i<n; i++)
QUIZ NAVIGATION
Show one page at a time
Finish review
1 2 3 4 5 6 7
8 9 10 11 12 13 14
15 16 17 18 19 20 21
22 23 24 25 26 27 28
29 30 31 32 33 34 35
36 37 38 39 40Question 2
Partially correct
Mark 0.17 out of
1.00
Flag question
{
d1=(double)n/(double)i;
d2=n/i;
if
(fabs(d1-(double)d2) < 0.00001)
count++;
}
if (count == 2)
printf("%d is prime\n"
else
printf("%d is not prime\n"
}
}
Select one:
a.
while (1>0)
b.
for (i=1; i<n; i++)
c.
main(int argc[],char
*argv[])
d.
double d1=0;
The correct answer is:
for (i=1; i<n; i++)
Question 2
Partially correct
Mark 0.17 out of
1.00
Flag question
{
d1=(double)n/(double)i;
d2=n/i;
if
(fabs(d1-(double)d2) < 0.00001)
count++;
}
if (count == 2)
printf("%d is prime\n"
else
printf("%d is not prime\n"
}
}
Select one:
a.
while (1>0)
b.
for (i=1; i<n; i++)
c.
main(int argc[],char
*argv[])
d.
double d1=0;
The correct answer is:
for (i=1; i<n; i++)
.
#include <stdio.h>
#include <string.h>
main()
{int i,a;
char s[3],t[2];
s[0]='B'; s[1]='c'; s[2]='\0';
t[0]='B'; t[1]='\0';
i=0; a=0;
while (a == 0)
{
if (s[i] < t[i]) a=-1;
if (s[i] > t[i]) a=1;
if (s[i] == '\0' || t[i] == '\0')
break;
i++;
}
printf("%d\n",a);
a=strcmp(s,t);
printf("%d\n",a);
}
second value of a 'B'
Total memory
space used by the
program in bytes:
1
last value of a 99
First value of a 1
last value of t[0] 13
last value of i 0
The correct answer is: second valueQuestion 3
Correct
Mark 1.00 out of
1.00
Flag question
Question 4
Correct
Mark 1.00 out of
1.00
Flag question
of a – 1, Total memory space used
by the program in bytes: – 13, last
value of a – 99, First value of a – 0,
last value of t[0] – 'B', last value of i –
1.
What is the latest value of i ?
int i,n=0;
for (i=1; i<=4;i++)
n=n+2;
Select one:
a. 5
b. 2
c. 1
d. 4
The correct answer is:
5
.
Which program prompts the user
for a positive integer and then
computes the sum of all even
digits. For example, if the user
enters 2784, the program should
print 14, which is (2+8+4).
Select one:
a. #include <stdio.h>
main()
{
int n,sum,last_digit;
printf("Enter an integer: ");
scanf("%d",&n);
while (n > 0){
last_digit=n%10;
if ((last_digit%2) == 0)
sum=sum+last_digit;
n=n/10;
} printf("The sum of its digits is
%d\n",sum);
}
b. #include <stdio.h>
main()
{
int n,sum,last_digit;
printf("Enter an integer: ");
scanf("%d",&n);
sum=0;
while (n > 0){
last_digit=n%10;
if ((last_digit%2) == 0)
sum=sum+last_digit;
n=n-10;
}
printf("The sum of its digits is
%d\n",sum);
}
c. #include <stdio.h>
main()
{
int n,sum,last_digit;
printf("Enter an integer: ");
scanf("%d",&n);
sum=0;
while (n > 0){
last_digit=n%10;
sum=sum+last_digit;
n=n/10;
}
printf("The sum of its digits is
%d\n",sum);
}
d. #include <stdio.h>
main()
{
int n,sum,last_digit;
printf("Enter an integer: ");
scanf("%d",&n);
sum=0;
while (n > 0){
last_digit=n%10;Question 5
Correct
Mark 1.00 out of
1.00
Flag question
if ((last_digit%2) == 0)
sum=sum+last_digit;
n=n/10;
}
printf("The sum of its digits is
%d\n",sum);
}
The correct answer is:
#include <stdio.h>
main()
{
int n,sum,last_digit;
printf("Enter an integer: ");
scanf("%d",&n);
sum=0;
while (n > 0){
last_digit=n%10;
if ((last_digit%2) == 0)
sum=sum+last_digit;
n=n/10;
}
printf("The sum of its digits is
%d\n",sum);
}
.
What is the value of 1 0 0 1 0 0 1 1
in fixed-point bit model?
Select one:
a. I don't know
b. 18.25
c. 2.275
d. 18.375
The correct answer is:
18.375
.Question 6
Incorrect
Mark 0.00 out of
1.00
Flag question
Question 7
Correct
Mark 1.00 out of
1.00
What is the last value of d2?
#include <stdio.h>
main()
{
struct ID {
int number;
float cost;
double *barcode;
};
struct ID list[3],*item;
float *f;
double d2;
d2=8;
list[2].number=12;
list[2].cost=44.11;
list[2].barcode=&d2;
item=&(list[2]);
f=&(item->cost);
d=item->barcode;
}
Select one:
a. 888
b. 889
c. 8
d. 9
The correct answer is:
8
.
How many bytes does the following
code occupies in memory?
int a[4];Flag question
Question 8
Correct
Mark 1.00 out of
1.00
Flag question
Question 9
Correct
Mark 1.00 out of
1.00
Flag question
Question 10
Correct
Select one:
a. 16
b. 8
c. 0
d. 4
The correct answer is:
16
.
System software on a UNIX
system performs the basic
services as system software on a
Microsoft Windows system.
Select one:
True
False
The correct answer is 'True'.
In two's complement bit model 5 bits
can represent range of ______.
Select one:
a. -16 to +15
b. -128 to +127
c. 0 to 8
d. -8 to +8
The correct answer is:
-16 to +15
.
How many bytes does the following
code occupies in memory?Mark 1.00 out of
1.00
Flag question
Question 11
Correct
Mark 1.00 out of
1.00
Flag question
Question 12
Incorrect
Mark 0.00 out of
1.00
Flag question
int a[4][2];
Select one:
a. 8
b. 0
c. 32
d. 16
The correct answer is:
32
.
What is the binary representation for
char d=’G’;
Select one:
a. 00100011
b. 01000011
c. 01100011
d. 01000111
The correct answer is:
01000111
.
How many total bytes does the
following code declares for
variables?
#include <stdio.h>
main()
{
struct ID {
int number;
float cost;
double *barcode;
};Question 13
Correct
Mark 1.00 out of
1.00
Flag question
struct ID list[3],*item;
float *f;
double d2;
d2=888;
list[2].number=12;
list[2].cost=44.11;
list[2].barcode=&d2;
item=&(list[2]);
f=&(item->cost);
d=item->barcode;
}
Select one:
a. 15
b. 60
c. 52
d. 56
The correct answer is:
52
.
35 & 3
Select one:
a. 0000 0111
b. 0000 0011
c. 0000 1111
d. 0001 0011
The correct answer is:
0000 0011
.Question 14
Correct
Mark 1.00 out of
1.00
Flag question
Question 15
Correct
Mark 1.00 out of
1.00
Flag question
What will be the output of the
following code?
#include <stdio.h>
int main()
{
int i, j; char s[8], t[4];
s[0] = 'S'; s[1] = 'y'; s[2] = '\0';
t[0] = 's'; t[1] = 't'; t[2] = 'e'; t[3] = '\0';
i = strlen(s); j = 0;
while (t[j] != '\0'){
s[i + j] = t[j];
j++;
}
s[i] = '\0';
printf("%s",s);
return 0;
}
Select one:
a. Sy
b. System
c. Syst
d. Syste
The correct answer is:
Sy
.
How can you fix the logical error
here:
#include <stdio.h>
#include <math.h>
main(int argc,char
*argv[]){
int n,i;
int d2,count;
double d1;
while (1)
{
printf("Enter a number (0 to quit): "
scanf("%d",&n);
if (n == 0)
break;
count=0;
for (i=1; i<n; i++)
{
d1=(double)n/(double)i;
d2=n/i;
if
(fabs(d1-(double)d2) < 0.00001)
count++;
}
if (count == 2)
printf("%d is prime\n"
else
printf("%d is not prime\n"
}
}
Select one:
a.
for (i=1; i<=n; i++)
b.
for (i=0; i<n; i++)
c.
main(int argc[],char
*argv[])Question 16
Correct
Mark 1.00 out of
1.00
Flag question
Question 17
Correct
Mark 1.00 out of
1.00
Flag question
d.
for (i=1; i<=n; i--)
The correct answer is:
for (i=1; i<=n; i++)
.
int *a; a = (int *) malloc (21); //How
many bytes are we requesting
from OS?
Select one:
a. 84
b. 0
c. 21
d. 42
The correct answer is:
21
.
unsigned char a;
a=18;
a=a << 2;
What is the value of a?
Select one:
a. 76
b. 72
c. 20
d. 16
The correct answer is:
72
.Question 18
Correct
Mark 1.00 out of
1.00
Flag question
Question 19
Correct
Mark 1.00 out of
1.00
Flag question
Question 20
Incorrect
Mark 0.00 out of
1.00
Flag question
In sign-magnitude bit model 5 bits
can represent range of ______.
Select one:
a. -15 to +15
b. -8 to +8
c. -128 to +127
d. 0 to 8
The correct answer is:
-15 to +15
.
Which one is two's complement bit
model?
Select one:
a. text
b. unsigned int
c. unsigned char
d. int
The correct answer is:
int
.
What is the last value of d2?
#include <stdio.h>
main()
{
struct ID {
int number;
float cost;
double *barcode;
};
struct ID list[3],*item;Question 21
Incorrect
Mark 0.00 out of
1.00
Flag question
float *f;
double d2;
d2=8;
list[2].number=12;
list[2].cost=44.11;
list[2].barcode=&d2;
item=&(list[2]);
f=&(item->cost);
d=item->barcode;
*d=(*d)+10;
}
Select one:
a. 888
b. 18
c. 8
d. 889
The correct answer is:
8
.
What is the latest value of i ?
int i,n=0;
for (i=1; i<=4;i++)
n=n+2;
i=6;
Select one:
a. 5
b. 2
c. 4
d. 6
The correct answer is:Question 22
Correct
Mark 1.00 out of
1.00
Flag question
Question 23
Correct
Mark 1.00 out of
1.00
Flag question
Question 24
Incorrect
Mark 0.00 out of
1.00
Flag question
6
.
Which one is magnitude-only bit
model?
Select one:
a. char
b. int
c. float
d. unsigned char
The correct answer is:
unsigned char
.
unsigned char a;
a=18;
a=a >> 2;
What is the value of a?
Select one:
a. 16
b. 20
c. 72
d. 4
The correct answer is:
4
.
What is the last value of d[1]?
double d[3],*e;
e=&(d[1]);
d[0]=2.0;Question 25
Incorrect
Mark 0.00 out of
1.00
Flag question
Question 26
Incorrect
Mark 0.00 out of
1.00
Flag question
d[1]=0.0
*(e-1)=1.5;
e[0]=2.5;
Select one:
a. 2.5
b. 2.0
c. 0.0
d. 1.5
The correct answer is:
2.5
.
cp=&(ca[1]);
What can you write instead of *
(cp+1)=7;
Select one:
a. ca[2] = 7
b. ca[1] = 1
c. ca[1] = 7
d. ca[0] = 7
The correct answer is:
ca[2] = 7
.
What is wrong with the following
code:
#include <stdio.h>
#include <math.h>
main(int argc,char
*argv[]){
int n,i;
int d2,count,
double d1;
while (1)
{
printf("Enter a number (0 to quit): "
scanf("%d",&n);
if (n == 0)
break;
count=0;
for (i=0; i<n; i++)
{
d1=(double)n/(double)i;
d2=n/i;
if
(fabs(d1-(double)d2) < 0.00001)
count++;
}
if (count == 2)
printf("%d is prime\n"
else
printf("%d is not prime\n"
}
}
Select one:
a.
while (1)
b.
main(int argc,char
*argv[])
c.
double d1;
d.Question 27
Not answered
Marked out of
1.00
Flag question
Question 28
Incorrect
Mark 0.00 out of
1.00
Flag question
int d2,count,
The correct answer is:
int d2,count,
.
What is the last value of i[3]?
int *ip, i[5];
i[1]=1;i[2]=1;i[3]=1;
ip=&(i[0]);
*(ip+3) = *(ip+1) + *(ip+2);
printf("%d",i[3]);
Select one:
a. 1
b. 3
c. 2
d. 4
The correct answer is:
2
.
What is the last value of d[1]?
double d[3],*e;
e=&(d[1]);
d[0]=2.0;
*(e-1)=1.5;
*(e+0)=2.5;
Select one:
a. 1.5Question 29
Incorrect
Mark 0.00 out of
1.00
Flag question
Question 30
Incorrect
Mark 0.00 out of
1.00
Flag question
Question 31
Correct
Mark 1.00 out of
1.00
Flag question
b. 0.0
c. 2.5
d. 2.0
The correct answer is:
2.5
.
int *ip; *(ip+7)=8; //If the &ip = 400,
which address are we storing 8?
Select one:
a. 428
b. 414
c. 402
d. 407
The correct answer is:
428
.
A string is an array of char.
Select one:
True
False
The correct answer is 'True'.
b=01000000 What is b >> 3 ?
Select one:
a. 03000000
b. 01000003
c. 00010000
d. 00001000Question 32
Correct
Mark 1.00 out of
1.00
Flag question
Question 33
Incorrect
Mark 0.00 out of
1.00
Flag question
Question 34
The correct answer is:
00001000
.
Unsigned int has a range of
Select one:
a. 1 to 255
b. 0 to 4,294,967,295
c. 1 to 8
d. 0 to 256
The correct answer is:
0 to 4,294,967,295
.
What is the last value of d[0]?
double d[3],*e;
e=&(d[1]);
d[0]=2.0;
*(e-1)=1.5;
*(e+0)=2.5;
Select one:
a. 2.0
b. 0.0
c. 2.5
d. 1.5
The correct answer is:
1.5
.
What is the binary representation forCorrect
Mark 1.00 out of
1.00
Flag question
Question 35
Correct
Mark 1.00 out of
1.00
Flag question
Question 36
Incorrect
Mark 0.00 out of
1.00
Flag question
char c=35;
Select one:
a. 01000011
b. 00100011
c. 00100010
d. 01100011
The correct answer is:
00100011
.
unsigned char a;
a=4;
a=~a;
What is the value of a?
Select one:
a. 251
b. 20
c. 72
d. 16
The correct answer is:
251
.
Which one is not a way that a text
editor can assist with writing
program code (as opposed to
writing generic text using a word
processor).
Select one:
a. Automatically adjust
algorithms
b. Move the cursor to a matching
braceQuestion 37
Correct
Mark 1.00 out of
1.00
Flag question
Question 38
Correct
Mark 1.00 out of
1.00
Flag question
Question 39
c. Highlight programming
language keywords and reserved
words
d. Display the line number
The correct answer is:
Automatically adjust algorithms
.
char *cp; *(cp+7)=8; //If the &cp =
400, which address are we storing
8?
Select one:
a. 428
b. 407
c. 402
d. 414
The correct answer is:
407
.
Unsigned char has a range of
Select one:
a. 0 to 255
b. 1 to 8
c. 0 to 256
d. 1 to 255
The correct answer is:
0 to 255
.
Assume that our data type isCorrect
Mark 1.00 out of
1.00
Flag question
Question 40
Correct
Mark 1.00 out of
1.00
Flag question
magnitude-only bit model and it uses
4 bits. What would be the value
range?
Select one:
a. 0 to 256
b. 1 to 4
c. 0 to 15
d. 1 to 255
The correct answer is:
0 to 15
.
What is the total bytes declared in
memory for the following code?
char a;
float c;
double d;
a = 1; c = 1.0; d = 2.0;
Select one:
a. 4
b. 13
c. 3
d. 17
The correct answer is:
13
Question 1
Incorrect
Mark 0.00 out of 1.00
Not flaggedFlag question
Question text
unsigned char a;
a=4;
a=~a;
What is the value of a?
Select one:
a. 16 Incorrect
b. 72
c. 251
d. 20
Feedback
The correct answer is:
251
.
Question 2
Incorrect
Mark 0.00 out of 1.00
Not flaggedFlag question
Question text
int *a; a = (int *) malloc (21); //How many bytes are we requesting from OS?
Select one:
a. 84 Incorrect
b. 42
c. 0
d. 21
Feedback
The correct answer is:
21
.
Question 3
Incorrect
Mark 0.00 out of 1.00
Not flaggedFlag question
Question text
x = 0000 0001 What is x = x | (1«3);
Select one:
a. 0000 1000 Incorrect
b. 0000 1001
c. 0000 0001
d. 0000 0011
Feedback
The correct answer is:
0000 1001
.
Question 4
Correct
Mark 1.00 out of 1.00
Not flaggedFlag question
Question text
Assume that our data type is magnitude-only bit model and it uses 4 bits. What would be the value range?
Select one:
a. 0 to 15 Correct
b. 1 to 255
c. 1 to 4
d. 0 to 256
Feedback
The correct answer is:
0 to 15
.
Question 5
Incorrect
Mark 0.00 out of 1.00
Not flaggedFlag question
Question text
int *ip; *(ip+7)=8; //If the &ip = 400, which address are we storing 8?
Select one:
a. 402
b. 407
c. 428
d. 414 Incorrect
Feedback
The correct answer is:
428
.
Question 6
Incorrect
Mark 0.00 out of 1.00
Not flaggedFlag question
Question text
What will be the output of the following code?
#include <stdio.h>
int main()
{
int i, j; char s[8], t[4];
s[0] = 'S'; s[1] = 'y'; s[2] = '\0';
t[0] = 's'; t[1] = 't'; t[2] = 'e'; t[3] = '\0';
i = strlen(s); j = 0;
while (t[j] != '\0'){
s[i + j] = t[j];
j++;
}
s[i] = '\0';
printf("%s",s);
return 0;
}
Select one:
a. System
b. Syste Incorrect
c. Sy
d. Syst
Feedback
The correct answer is:
Sy
.
Question 7
Correct
Mark 1.00 out of 1.00
Not flaggedFlag question
Question text
4 bits called ______.
Select one:
a. Half
b. Bubble
c. Double
d. Nibble Correct
Feedback
The correct answer is:
Nibble
.
Question 8
Incorrect
Mark 0.00 out of 1.00
Not flaggedFlag question
Question text
What is the last value of d[0]?
double d[3],*e;
e=&(d[1]);
d[0]=2.0;
*(e-1)=1.5;
*(e+0)=2.5;
Select one:
a. 2.0 Incorrect
b. 0.0
c. 2.5
d. 1.5
Feedback
The correct answer is:
1.5
.
Question 9
Correct
Mark 1.00 out of 1.00
Not flaggedFlag question
Question text
What is the last value of d2?
#include <stdio.h>
main()
{
struct ID {
int number;
float cost;
double *barcode;
};
struct ID list[3],*item;
float *f;
double d2;
d2=8;
list[2].number=12;
list[2].cost=44.11;
list[2].barcode=&d2;
item=&(list[2]);
f=&(item->cost);
d=item->barcode;
}
Select one:
a. 8 Correct
b. 9
c. 889
d. 888
Feedback
The correct answer is:
8
.
Question 10
Correct
Mark 1.00 out of 1.00
Not flaggedFlag question
Question text
15 | 65
Select one:
a. 0100 1110
b. 1100 1111
c. 0110 1111
d. 0100 1111 Correct
Feedback
The correct answer is:
0100 1111
.
Question 11
Correct
Mark 1.00 out of 1.00
Not flaggedFlag question
Question text
What is the total bytes declared in memory for the following code?
char a;
short int c;
double d;
a = 1; c = 1; d = 2.0;
Select one:
a. 4
b. 17
c. 3
d. 11 Correct
Feedback
The correct answer is:
11
.
Question 12
Incorrect
Mark 0.00 out of 1.00
Not flaggedFlag question
Question text
Which program prompts the user for a positive integer and then computes the sum of all even digits. For example, if the user enters 2784, the program should print 14, which is (2+8+4).
Select one:
a. #include <stdio.h>
main()
{
int n,sum,last_digit;
printf("Enter an integer: ");
scanf("%d",&n);
sum=0;
while (n > 0){
last_digit=n%10;
if ((last_digit%2) == 0)
sum=sum+last_digit;
n=n/10;
}
printf("The sum of its digits is %d\n",sum);
}
b. #include <stdio.h>
main()
{
int n,sum,last_digit;
printf("Enter an integer: ");
scanf("%d",&n);
while (n > 0){
last_digit=n%10;
if ((last_digit%2) == 0)
sum=sum+last_digit;
n=n/10;
}
printf("The sum of its digits is %d\n",sum);
}
Incorrect
c. #include <stdio.h>
main()
{
int n,sum,last_digit;
printf("Enter an integer: ");
scanf("%d",&n);
sum=0;
while (n > 0){
last_digit=n%10;
sum=sum+last_digit;
n=n/10;
}
printf("The sum of its digits is %d\n",sum);
}
d. #include <stdio.h>
main()
{
int n,sum,last_digit;
printf("Enter an integer: ");
scanf("%d",&n);
sum=0;
while (n > 0){
last_digit=n%10;
if ((last_digit%2) == 0)
sum=sum+last_digit;
n=n-10;
}
printf("The sum of its digits is %d\n",sum);
}
Feedback
The correct answer is:
#include <stdio.h>
main()
{
int n,sum,last_digit;
printf("Enter an integer: ");
scanf("%d",&n);
sum=0;
while (n > 0){
last_digit=n%10;
if ((last_digit%2) == 0)
sum=sum+last_digit;
n=n/10;
}
printf("The sum of its digits is %d\n",sum);
}
.
Question 13
Correct
Mark 1.00 out of 1.00
Not flaggedFlag question
Question text
How can you fix the logical error here:
#include <stdio.h>
#include <math.h>
main(int argc,char *argv[])
{
int n,i;
int d2,count;
double d1;
while (1)
{
printf("Enter a number (0 to quit): ");
scanf("%d",&n);
if (n == 0)
break;
count=0;
for (i=1; i<n; i++)
{
d1=(double)n/(double)i;
d2=n/i;
if (fabs(d1-(double)d2) < 0.00001)
count++;
}
if (count == 2)
printf("%d is prime\n",n);
else
printf("%d is not prime\n",n);
}
}
Select one:
a.
main(int argc[],char *argv[])
b.
for (i=1; i<=n; i++)
Correct
c.
for (i=0; i<n; i++)
d.
for (i=1; i<=n; i--)
Feedback
The correct answer is:
for (i=1; i<=n; i++)
.
Question 14
Correct
Mark 1.00 out of 1.00
Not flaggedFlag question
Question text
Unsigned int has a range of
Select one:
a. 1 to 8
b. 0 to 256
c. 0 to 4,294,967,295 Correct
d. 1 to 255
Feedback
The correct answer is:
0 to 4,294,967,295
.
Question 15
Incorrect
Mark 0.00 out of 1.00
Not flaggedFlag question
Question text
How many bytes does the following code occupies in memory?
int a[4][2];
Select one:
a. 16
b. 32
c. 0
d. 8 Incorrect
Feedback
The correct answer is:
32
.
Question 16
Correct
Mark 1.00 out of 1.00
Not flaggedFlag question
Question text
What is the binary representation for
char d=’G’;
Select one:
a. 01000111 Correct
b. 01000011
c. 01100011
d. 00100011
Feedback
The correct answer is:
01000111
.
Question 17
Incorrect
Mark 0.00 out of 1.00
Not flaggedFlag question
Question text
What is the last value of d2?
#include <stdio.h>
main()
{
struct ID {
int number;
float cost;
double *barcode;
};
struct ID list[3],*item;
float *f;
double d2;
d2=8;
list[2].number=12;
list[2].cost=44.11;
list[2].barcode=&d2;
item=&(list[2]);
f=&(item->cost);
d=item->barcode;
*d=(*d)+10;
}
Select one:
a. 889 Incorrect
b. 888
c. 18
d. 8
Feedback
The correct answer is:
8
.
Question 18
Correct
Mark 1.00 out of 1.00
Not flaggedFlag question
Question text
35 & 3
Select one:
a. 0000 1111
b. 0000 0011 Correct
c. 0000 0111
d. 0001 0011
Feedback
The correct answer is:
0000 0011
.
Question 19
Incorrect
Mark 0.00 out of 1.00
Not flaggedFlag question
Question text
What is wrong with the following code:
#include <stdio.h>
#include <math.h>
main(int argc,char *argv[])
{
int n,i;
int d2,count,
double d1;
while (1)
{
printf("Enter a number (0 to quit): ");
scanf("%d",&n);
if (n == 0)
break;
count=0;
for (i=0; i<n; i++)
{
d1=(double)n/(double)i;
d2=n/i;
if (fabs(d1-(double)d2) < 0.00001)
count++;
}
if (count == 2)
printf("%d is prime\n",n);
else
printf("%d is not prime\n",n);
}
}
Select one:
a.
double d1;
Incorrect
b.
while (1)
c.
int d2,count,
d.
main(int argc,char *argv[])
Feedback
The correct answer is:
int d2,count,
.
Question 20
Incorrect
Mark 0.00 out of 1.00
Not flaggedFlag question
Question text
cp=&(ca[1]);
What can you write instead of *(cp+1)=7;
Select one:
a. ca[1] = 1
b. ca[1] = 7 Incorrect
c. ca[0] = 7
d. ca[2] = 7
Feedback
The correct answer is:
ca[2] = 7
.
Question 21
Correct
Mark 1.00 out of 1.00
Not flaggedFlag question
Question text
What is the last value of d[1]?
double d[3],*e;
e=&(d[1]);
d[0]=2.0;
*(e-1)=1.5;
*(e+0)=2.5;
Select one:
a. 2.0
b. 2.5 Correct
c. 0.0
d. 1.5
Feedback
The correct answer is:
2.5
.
Question 22
Incorrect
Mark 0.00 out of 1.00
Not flaggedFlag question
Question text
How can you fix the logical error here:
#include <stdio.h>
#include <math.h>
main(int argc,char *argv[])
{
int n,i;
int d2,count;
double d1;
while (1)
{
printf("Enter a number (0 to quit): ");
scanf("%d",&n);
if (n == 0)
break;
count=0;
for (i=0; i<n; i++)
{
d1=(double)n/(double)i;
d2=n/i;
if (fabs(d1-(double)d2) < 0.00001)
count++;
}
if (count == 2)
printf("%d is prime\n",n);
else
printf("%d is not prime\n",n);
}
}
Select one:
a.
while (1>0)
b.
for (i=1; i<n; i++)
c.
main(int argc[],char *argv[])
d.
double d1=0;
Incorrect
Feedback
The correct answer is:
for (i=1; i<n; i++)
.
Question 23
Correct
Mark 1.00 out of 1.00
Not flaggedFlag question
Question text
How many bytes does the following code occupies in memory?
int a[4];
Select one:
a. 16 Correct
b. 8
c. 0
d. 4
Feedback
The correct answer is:
16
.
Question 24
Correct
Mark 1.00 out of 1.00
Not flaggedFlag question
Question text
In sign-magnitude bir model a value of 1 in the sign bit indicates a ________ number.
Select one:
a. negative Correct
b. complex
c. integer
d. positive
Feedback
The correct answer is:
negative
.
Question 25
Incorrect
Mark 0.00 out of 1.00
Not flaggedFlag question
Question text
x = 0000 1001 What is x = x AND NOT (1«3);
Select one:
a. 0000 0001
b. 0000 0011
c. 0000 1001 Incorrect
d. 0000 1000
Feedback
The correct answer is:
0000 0001
.
Question 26
Correct
Mark 1.00 out of 1.00
Not flaggedFlag question
Question text
unsigned char a;
a=18;
a=a >> 2;
What is the value of a?
Select one:
a. 4 Correct
b. 16
c. 72
d. 20
Feedback
The correct answer is:
4
.
Question 27
Incorrect
Mark 0.00 out of 1.00
Not flaggedFlag question
Question text
What does 10011001 represents?
Select one:
a. Depends on the bit model.
b. 153 Incorrect
c. -153
Feedback
The correct answer is:
Depends on the bit model.
.
Question 28
Incorrect
Mark 0.00 out of 1.00
Not flaggedFlag question
Question text
Which one is magnitude-only bit model?
Select one:
a. unsigned char
b. char
c. int Incorrect
d. float
Feedback
The correct answer is:
unsigned char
.
Question 29
Incorrect
Mark 0.00 out of 1.00
Not flaggedFlag question
Question text
char *cp; *(cp+7)=8; //If the &cp = 400, which address are we storing 8?
Select one:
a. 407
b. 402 Incorrect
c. 414
d. 428
Feedback
The correct answer is:
407
.
Question 30
Correct
Mark 1.00 out of 1.00
Not flaggedFlag question
Question text
b=01000000 What is b >> 3 ?
Select one:
a. 01000003
b. 03000000
c. 00010000
d. 00001000 Correct
Feedback
The correct answer is:
00001000
.
Question 31
Incorrect
Mark 0.00 out of 1.00
Not flaggedFlag question
Question text
How many bytes does the following code uses in the memory?
struct ID {
int number;
float cost;
double *barcode;
};
Select one:
a. 16 Incorrect
No. This is template. If we define struct ID list; Then we are using memory.
b. 0
c. 12
d. 6
Feedback
The correct answer is:
0
.
Question 32
Correct
Mark 1.00 out of 1.00
Not flaggedFlag question
Question text
*(list)[i]=10+i; May be written as:
Select one:
a. *((*list)+i)=i;
b. *((*list)+i)=10;
c. *((*list)+i)=10+i; Correct
d. *((*list)+10)=10+i;
Feedback
The correct answer is:
*((*list)+i)=10+i;
.
Question 33
Incorrect
Mark 0.00 out of 1.00
Not flaggedFlag question
Question text
In sign-magnitude bit model 5 bits can represent range of ______.
Select one:
a. -8 to +8
b. 0 to 8
c. -128 to +127 Incorrect
d. -15 to +15
Feedback
The correct answer is:
-15 to +15
.
Question 34
Correct
Mark 1.00 out of 1.00
Not flaggedFlag question
Question text
Unsigned int has a range of
Select one:
a. 1 to 8
b. 0 to 256
c. 1 to 255
d. 0 to 255 Correct
Feedback
The correct answer is:
0 to 255
.
Question 35
Incorrect
Mark 0.00 out of 1.00
Not flaggedFlag question
Question text
d[0]='t',d[1]='e', d[2]='\0', d[3]='t', d[4]='\0'
printf("%c%c%c%c%c\n", d[0], d[1], d[2], d[3], d[4]);
printf ("%s\n", d);
Both printf statements will print same thing.
Select one:
True Incorrect
False
Feedback
The correct answer is 'False'.
Question 36
Incorrect
Mark 0.00 out of 1.00
Not flaggedFlag question
Question text
How many total bytes does the following code declares for variables?
#include <stdio.h>
main()
{
struct ID {
int number;
float cost;
double *barcode;
};
struct ID list[3],*item;
float *f;
double d2;
d2=888;
list[2].number=12;
list[2].cost=44.11;
list[2].barcode=&d2;
item=&(list[2]);
f=&(item->cost);
d=item->barcode;
}
Select one:
a. 56 Incorrect
b. 52
c. 15
d. 60
Feedback
The correct answer is:
52
.
Question 37
Incorrect
Mark 0.00 out of 1.00
Not flaggedFlag question
Question text
What is the last value of d[1]?
double d[3],*e;
e=&(d[1]);
d[0]=2.0;
d[1]=0.0
*(e-1)=1.5;
e[0]=2.5;
Select one:
a. 2.5
b. 1.5 Incorrect
c. 2.0
d. 0.0
Feedback
The correct answer is:
2.5
.
Question 38
Incorrect
Mark 0.00 out of 1.00
Not flaggedFlag question
Question text
What is the latest value of i ?
int i,n=0;
for (i=1; i<=4;i++)
n=n+2;
i=6;
Select one:
a. 6
b. 2
c. 4
d. 5 Incorrect
Feedback
The correct answer is:
6
.
Question 39
Incorrect
Mark 0.00 out of 1.00
Not flaggedFlag question
Question text
In sign-magnitude bit model 8 bits can represent range of ______.
Select one:
a. -128 to +127 Incorrect
b. -8 to +8
c. -127 to +127
d. 0 to 8
Feedback
The correct answer is:
-127 to +127
.
Question 40
Incorrect
Mark 0.00 out of 1.00
Not flaggedFlag question
Question text
What is the value of 1 0 0 1 0 0 1 1 in fixed-point bit model?
Select one:
a. 18.25
b. I don't know Incorrect
c. 2.275
d. 18.375
Feedback
The correct answer is:
18.375
unsigned char a;
a=18;
a=a >> 2;
What is the value of a?
Select one:
a. 20
b. 16
c. 4 Correct
d. 72
Feedback
The correct answer is:
4
.
Question 2
Incorrect
Mark 0.00 out of 1.00
Not flaggedFlag question
Question text
What is the last value of d2?
#include <stdio.h>
main()
{
struct ID {
int number;
float cost;
double *barcode;
};
struct ID list[3],*item;
float *f;
double d2;
d2=8;
list[2].number=12;
list[2].cost=44.11;
list[2].barcode=&d2;
item=&(list[2]);
f=&(item->cost);
d=item->barcode;
*d=(*d)+10;
}
Select one:
a. 18
b. 888
c. 889 Incorrect
d. 8
Feedback
The correct answer is:
8
.
Question 3
Correct
Mark 1.00 out of 1.00
Not flaggedFlag question
Question text
What is the last value of i[3]?
int *ip, i[5];
i[1]=1;i[2]=1;i[3]=1;
ip=&(i[0]);
*(ip+3) = *(ip+1) + *(ip+2);
printf("%d",i[3]);
Select one:
a. 3
b. 2 Correct
c. 1
d. 4
Feedback
The correct answer is:
2
.
Question 4
Correct
Mark 1.00 out of 1.00
Not flaggedFlag question
Question text
char *cp; *(cp+7)=8; //If the &cp = 400, which address are we storing 8?
Select one:
a. 428
b. 402
c. 407 Correct
d. 414
Feedback
The correct answer is:
407
.
Question 5
Incorrect
Mark 0.00 out of 1.00
Not flaggedFlag question
Question text
Which one is magnitude-only bit model?
Select one:
a. int Incorrect
b. float
c. char
d. unsigned char
Feedback
The correct answer is:
unsigned char
.
Question 6
Incorrect
Mark 0.00 out of 1.00
Not flaggedFlag question
Question text
What is the binary representation for
char c=35;
Select one:
a. 00100011
b. 01000011
c. 01100011
d. 00100010 Incorrect
Feedback
The correct answer is:
00100011
.
Question 7
Correct
Mark 1.00 out of 1.00
Not flaggedFlag question
Question text
Assume that our data type is magnitude-only bit model and it uses 4 bits. What would be the value
range?
Select one:
a. 1 to 255
b. 0 to 15 Correct
c. 1 to 4
d. 0 to 256
Feedback
The correct answer is:
0 to 15
.
Question 8
Incorrect
Mark 0.00 out of 1.00
Not flaggedFlag question
Question text
15 | 65
Select one:
a. 0110 1111
b. 1100 1111
c. 0100 1110 Incorrect
d. 0100 1111
Feedback
The correct answer is:
0100 1111
.
Question 9
Correct
Mark 1.00 out of 1.00
Not flaggedFlag question
Question text
int *a; a = (int *) malloc (21); //How many bytes are we requesting from OS?
Select one:
a. 21 Correct
b. 84
c. 42
d. 0
Feedback
The correct answer is:
21
.
Question 10
Incorrect
Mark 0.00 out of 1.00
Not flaggedFlag question
Question text
What is the last value of d[1]?
double d[3],*e;
e=&(d[1]);
d[0]=2.0;
d[1]=0.0
*(e-1)=1.5;
e[0]=2.5;
Select one:
a. 2.0
b. 2.5
c. 0.0 Incorrect
d. 1.5
Feedback
The correct answer is:
2.5
.
Question 11
Correct
Mark 1.00 out of 1.00
Not flaggedFlag question
Question text
unsigned char a;
a=4;
a=~a;
What is the value of a?
Select one:
a. 16
b. 20
c. 251 Correct
d. 72
Feedback
The correct answer is:
251
.
Question 12
Incorrect
Mark 0.00 out of 1.00
Not flaggedFlag question
Question text
cp=&(ca[1]);
What can you write instead of *(cp+1)=7;
Select one:
a. ca[2] = 7
b. ca[0] = 7
c. ca[1] = 7 Incorrect
d. ca[1] = 1
Feedback
The correct answer is:
ca[2] = 7
.
Question 13
Incorrect
Mark 0.00 out of 1.00
Not flaggedFlag question
Question text
In two's complement bit model 5 bits can represent range of ______.
Select one:
a. -8 to +8
b. -16 to +15
c. 0 to 8
d. -128 to +127 Incorrect
Feedback
The correct answer is:
-16 to +15
.
Question 14
Correct
Mark 1.00 out of 1.00
Not flaggedFlag question
Question text
In sign-magnitude bit model 8 bits can represent range of ______.
Select one:
a. 0 to 8
b. -8 to +8
c. -128 to +127
d. -127 to +127 Correct
Feedback
The correct answer is:
-127 to +127
.
Question 15
Incorrect
Mark 0.00 out of 1.00
Not flaggedFlag question
Question text
Which one is two's complement bit model?
Select one:
a. unsigned char Incorrect
b. text
c. int
d. unsigned int
Feedback
The correct answer is:
int
.
Question 16
Incorrect
Mark 0.00 out of 1.00
Not flaggedFlag question
Question text
In sign-magnitude bit model 5 bits can represent range of ______.
Select one:
a. -15 to +15
b. 0 to 8
c. -128 to +127 Incorrect
d. -8 to +8
Feedback
The correct answer is:
-15 to +15
.
Question 17
Correct
Mark 1.00 out of 1.00
Not flaggedFlag question
Question text
How many total bytes does the following code declares for variables?
#include <stdio.h>
main()
{
struct ID {
int number;
float cost;
double *barcode;
};
struct ID list[3],*item;
float *f;
double d2;
d2=888;
list[2].number=12;
list[2].cost=44.11;
list[2].barcode=&d2;
item=&(list[2]);
f=&(item->cost);
d=item->barcode;
}
Select one:
a. 56
b. 15
c. 52 Correct
d. 60
Feedback
The correct answer is:
52
.
Question 18
Incorrect
Mark 0.00 out of 1.00
Not flaggedFlag question
Question text
How can you fix the logical error here:
#include <stdio.h>
#include <math.h>
main(int argc,char *argv[])
{
int n,i;
int d2,count;
double d1;
while (1)
{
printf("Enter a number (0 to quit): ");
scanf("%d",&n);
if (n == 0)
break;
count=0;
for (i=0; i<n; i++)
{
d1=(double)n/(double)i;
d2=n/i;
if (fabs(d1-(double)d2) < 0.00001)
count++;
}
if (count == 2)
printf("%d is prime\n",n);
else
printf("%d is not prime\n",n);
}
}
Select one:
a.
main(int argc[],char *argv[])
b.
for (i=1; i<n; i++)
c.
double d1=0;
Incorrect
d.
while (1>0)
Feedback
The correct answer is:
for (i=1; i<n; i++)
.
Question 19
Incorrect
Mark 0.00 out of 1.00
Not flaggedFlag question
Question text
In sign-magnitude bir model a value of 1 in the sign bit indicates a ________ number.
Select one:
a. positive Incorrect
b. complex
c. integer
d. negative
Feedback
The correct answer is:
negative
.
Question 20
Correct
Mark 1.00 out of 1.00
Not flaggedFlag question
Question text
What will be the output of the following code?
#include <stdio.h>
int main()
{
int i, j; char s[8], t[4];
s[0] = 'S'; s[1] = 'y'; s[2] = '\0';
t[0] = 's'; t[1] = 't'; t[2] = 'e'; t[3] = '\0';
i = strlen(s); j = 0;
while (t[j] != '\0'){
s[i + j] = t[j];
j++;
}
s[i] = '\0';
printf("%s",s);
return 0;
}
Select one:
a. Sy Correct
b. Syste
c. Syst
d. System
Feedback
The correct answer is:
Sy
.
Question 21
Incorrect
Mark 0.00 out of 1.00
Not flaggedFlag question
Question text
What is the latest value of i ?
int i,n=0;
for (i=1; i<=4;i++)
n=n+2;
i=6;
Select one:
a. 4
b. 6
c. 2 Incorrect
d. 5
Feedback
The correct answer is:
6
.
Question 22
Incorrect
Mark 0.00 out of 1.00
Not flaggedFlag question
Question text
A string is an array of char.
Select one:
True
False Incorrect
Feedback
The correct answer is 'True'.
Question 23
Correct
Mark 1.00 out of 1.00
Not flaggedFlag question
Question text
int *ip; *(ip+7)=8; //If the &ip = 400, which address are we storing 8?
Select one:
a. 414
b. 428 Correct
c. 407
d. 402
Feedback
The correct answer is:
428
.
Question 24
Incorrect
Mark 0.00 out of 1.00
Not flaggedFlag question
Question text
What is the last value of d[1]?
double d[3],*e;
e=&(d[1]);
d[0]=2.0;
*(e-1)=1.5;
*(e+0)=2.5;
Select one:
a. 2.5
b. 1.5
c. 0.0 Incorrect
d. 2.0
Feedback
The correct answer is:
2.5
.
Question 25
Correct
Mark 1.00 out of 1.00
Not flaggedFlag question
Question text
How many bytes does the following code occupies in memory?
int a[4];
Select one:
a. 16 Correct
b. 0
c. 4
d. 8
Feedback
The correct answer is:
16
.
Question 26
Incorrect
Mark 0.00 out of 1.00
Not flaggedFlag question
Question text
unsigned char a;
a=18;
a=a << 2;
What is the value of a?
Select one:
a. 72
b. 76
c. 16 Incorrect
d. 20
Feedback
The correct answer is:
72
.
Question 27
Correct
Mark 1.00 out of 1.00
Not flaggedFlag question
Question text
*(list)[i]=10+i; May be written as:
Select one:
a. *((*list)+i)=10;
b. *((*list)+10)=10+i;
c. *((*list)+i)=10+i; Correct
d. *((*list)+i)=i;
Feedback
The correct answer is:
*((*list)+i)=10+i;
.
Question 28
Incorrect
Mark 0.00 out of 1.00
Not flaggedFlag question
Question text
What is the value of 1 0 0 1 0 0 1 1 in fixed-point bit model?
Select one:
a. 2.275
b. 18.375
c. 18.25
d. I don't know Incorrect
Feedback
The correct answer is:
18.375
.
Question 29
Correct
Mark 1.00 out of 1.00
Not flaggedFlag question
Question text
Which program prompts the user for a positive integer and then computes the sum of all even digits. For
example, if the user enters 2784, the program should print 14, which is (2+8+4).
Select one:
a. #include <stdio.h>
main()
{
int n,sum,last_digit;
printf("Enter an integer: ");
scanf("%d",&n);
while (n > 0){
last_digit=n%10;
if ((last_digit%2) == 0)
sum=sum+last_digit;
n=n/10;
}
printf("The sum of its digits is %d\n",sum);
}
b. #include <stdio.h>
main()
{
int n,sum,last_digit;
printf("Enter an integer: ");
scanf("%d",&n);
sum=0;
while (n > 0){
last_digit=n%10;
if ((last_digit%2) == 0)
sum=sum+last_digit;
n=n/10;
}
printf("The sum of its digits is %d\n",sum);
}
Correct
c. #include <stdio.h>
main()
{
int n,sum,last_digit;
printf("Enter an integer: ");
scanf("%d",&n);
sum=0;
while (n > 0){
last_digit=n%10;
if ((last_digit%2) == 0)
sum=sum+last_digit;
n=n-10;
}
printf("The sum of its digits is %d\n",sum);
}
d. #include <stdio.h>
main()
{
int n,sum,last_digit;
printf("Enter an integer: ");
scanf("%d",&n);
sum=0;
while (n > 0){
last_digit=n%10;
sum=sum+last_digit;
n=n/10;
}
printf("The sum of its digits is %d\n",sum);
}
Feedback
The correct answer is:
#include <stdio.h>
main()
{
int n,sum,last_digit;
printf("Enter an integer: ");
scanf("%d",&n);
sum=0;
while (n > 0){
last_digit=n%10;
if ((last_digit%2) == 0)
sum=sum+last_digit;
n=n/10;
}
printf("The sum of its digits is %d\n",sum);
}
.
Question 30
Incorrect
Mark 0.00 out of 1.00
Not flaggedFlag question
Question text
Which one is not a way that a text editor can assist with writing program code (as opposed to writing
generic text using a word processor).
Select one:
a. Display the line number
b. Move the cursor to a matching brace
c. Highlight programming language keywords and reserved words Incorrect
d. Automatically adjust algorithms
Feedback
The correct answer is:
Automatically adjust algorithms
.
Question 31
Partially correct
Mark 0.33 out of 1.00
Not flaggedFlag question
Question text
#include <stdio.h>
#include <string.h>
main()
{
int i,a;
char s[3],t[2];
s[0]='B'; s[1]='c'; s[2]='\0';
t[0]='B'; t[1]='\0';
i=0; a=0;
while (a == 0)
{
if (s[i] < t[i]) a=-1;
if (s[i] > t[i]) a=1;
if (s[i] == '\0' || t[i] == '\0')
break;
i++;
}
printf("%d\n",a);
a=strcmp(s,t);
printf("%d\n",a);
}
second value of a
Incorrect
First value of a
Incorrect
last value of a
Incorrect
last value of i
Correct
Total memory space used by the program in bytes:
Correct
last value of t[0]
Incorrect
Feedback
The correct answer is: second value of a – 1, First value of a – 0, last value of a – 99, last value of i – 1,
Total memory space used by the program in bytes: – 13, last value of t[0] – 'B'.
Question 32
Correct
Mark 1.00 out of 1.00
Not flaggedFlag question
Question text
How many bytes does the following code occupies in memory?
int a[4][2];
Select one:
a. 8
b. 32 Correct
c. 16
d. 0
Feedback
The correct answer is:
32
.
Question 33
Incorrect
Mark 0.00 out of 1.00
Not flaggedFlag question
Question text
What is the total bytes declared in memory for the following code?
char a;
short int c;
double d;
a = 1; c = 1; d = 2.0;
Select one:
a. 17 Incorrect
b. 3
c. 4
d. 11
Feedback
The correct answer is:
11
.
Question 34
Incorrect
Mark 0.00 out of 1.00
Not flaggedFlag question
Question text
System software on a UNIX system performs the basic services as system software on a Microsoft
Windows system.
Select one:
True
False Incorrect
Feedback
The correct answer is 'True'.
Question 35
Incorrect
Mark 0.00 out of 1.00
Not flaggedFlag question
Question text
What is wrong with the following code:
#include <stdio.h>
#include <math.h>
main(int argc,char *argv[])
{
int n,i;
int d2,count,
double d1;
while (1)
{
printf("Enter a number (0 to quit): ");
scanf("%d",&n);
if (n == 0)
break;
count=0;
for (i=0; i<n; i++)
{
d1=(double)n/(double)i;
d2=n/i;
if (fabs(d1-(double)d2) < 0.00001)
count++;
}
if (count == 2)
printf("%d is prime\n",n);
else
printf("%d is not prime\n",n);
}
}
Select one:
a.
double d1;
b.
while (1)
Incorrect
c.
main(int argc,char *argv[])
d.
int d2,count,
Feedback
The correct answer is:
int d2,count,
.
Question 36
Correct
Mark 1.00 out of 1.00
Not flaggedFlag question
Question text
System software on a UNIX system performs the basic services as system software on a Microsoft
Windows system. However, there are some fundamental differences in how the system software is
designed and developed. Which one is not one of those:
Select one:
a. Virtual Correct
b. Modular
c. Monolithic
d. Proprietary code
Feedback
The correct answer is:
Virtual
.
Question 37
Correct
Mark 1.00 out of 1.00
Not flaggedFlag question
Question text
Unsigned int has a range of
Select one:
a. 0 to 256
b. 1 to 8
c. 0 to 4,294,967,295 Correct
d. 1 to 255
Feedback
The correct answer is:
0 to 4,294,967,295
.
Question 38
Correct
Mark 1.00 out of 1.00
Not flaggedFlag question
Question text
x = 0000 1001 What is x = x AND NOT (1«3);
Select one:
a. 0000 1001
b. 0000 0001 Correct
c. 0000 0011
d. 0000 1000
Feedback
The correct answer is:
0000 0001
.
Question 39
Incorrect
Mark 0.00 out of 1.00
Not flaggedFlag question
Question text
x = 0000 0001 What is x = x | (1«3);
Select one:
a. 0000 0001
b. 0000 1000
c. 0000 0011 Incorrect
d. 0000 1001
Feedback
The correct answer is:
0000 1001
.
Question 40
Incorrect
Mark 0.00 out of 1.00
Not flaggedFlag question
Question text
How many bytes does the following code uses in the memory?
struct ID {
int number;
float cost;
double *barcode;
};
Select one:
a. 16
b. 0
c. 12 Incorrect
No. This is template. If we define struct ID list; Then we are using memory.
d. 6
Feedback
The correct answer is:
0
Question textWhat is the last value of d[0]?
double d[3],*e;
e=&(d[1]);
d[0]=2.0;
*(e-1)=1.5;
*(e+0)=2.5;
Select one:
a. 0.0
b. 2.0
c. 2.5
d. 1.5
FeedbackThe correct answer is:1.5
.
Question 2Correct
Mark 1.00 out of 1.00
Flag question
Question textWhat is wrong with the following code:
#include <stdio.h>
#include <math.h>
main(int argc,char *argv[])
{
int n,i;
int d2,count,
double d1;
while (1)
{
printf("Enter a number (0 to quit): ");
scanf("%d",&n);
if (n == 0)
break;
count=0;
for (i=0; i<n; i++)
{
d1=(double)n/(double)i;
d2=n/i;
if (fabs(d1-(double)d2) < 0.00001)
count++;
}
if (count == 2)
printf("%d is prime\n",n);
else
printf("%d is not prime\n",n);
}
}
Select one:
a.double d1;
b.int d2,count,
c.while (1)
d.main(int argc,char *argv[])
FeedbackThe correct answer is:int d2,count,
.
Question 3Correct
Mark 1.00 out of 1.00
Flag question
Question textx = 0000 1001 What is x = x AND NOT (1«3);
Select one:
a. 0000 1000
b. 0000 0001
c. 0000 0011
d. 0000 1001
FeedbackThe correct answer is:0000 0001
.
Question 4Correct
Mark 1.00 out of 1.00
Flag question
Question text4 bits called ______.
Select one:
a. Half
b. Double
c. Nibble
d. Bubble
FeedbackThe correct answer is:Nibble
.
Question 5Correct
Mark 1.00 out of 1.00
Flag question
Question textWhat is the last value of d[1]?
double d[3],*e;
e=&(d[1]);
d[0]=2.0;
d[1]=0.0
*(e-1)=1.5;
e[0]=2.5;
Select one:
a. 1.5
b. 2.0
c. 2.5
d. 0.0
FeedbackThe correct answer is:2.5
.
Question 6Correct
Mark 1.00 out of 1.00
Flag question
Question textWhat is the last value of d2?
#include <stdio.h>
main()
{
struct ID {
int number;
float cost;
double *barcode;
};
struct ID list[3],*item;
float *f;
double d2;
d2=8;
list[2].number=12;
list[2].cost=44.11;
list[2].barcode=&d2;
item=&(list[2]);
f=&(item->cost);
d=item->barcode;
}
Select one:
a. 8
b. 889
c. 888
d. 9
FeedbackThe correct answer is:8
.
Question 7Correct
Mark 1.00 out of 1.00
Flag question
Question textHow can you fix the logical error here:
#include <stdio.h>
#include <math.h>
main(int argc,char *argv[])
{
int n,i;
int d2,count;
double d1;
while (1)
{
printf("Enter a number (0 to quit): ");
scanf("%d",&n);
if (n == 0)
break;
count=0;
for (i=1; i<n; i++)
{
d1=(double)n/(double)i;
d2=n/i;
if (fabs(d1-(double)d2) < 0.00001)
count++;
}
if (count == 2)
printf("%d is prime\n",n);
else
printf("%d is not prime\n",n);
}
}
Select one:
a.for (i=1; i<=n; i--)
b.for (i=1; i<=n; i++)
c.main(int argc[],char *argv[])
d.for (i=0; i<n; i++)
FeedbackThe correct answer is:for (i=1; i<=n; i++)
.
Question 8Correct
Mark 1.00 out of 1.00
Flag question
Question textAssume that our data type is magnitude-only bit model and it uses 4 bits. What would be the value range?
Select one:
a. 0 to 15
b. 0 to 256
c. 1 to 255
d. 1 to 4
FeedbackThe correct answer is:0 to 15
.
Question 9Correct
Mark 1.00 out of 1.00
Flag question
Question textint *ip; *(ip+7)=8; //If the &ip = 400, which address are we storing 8?
Select one:
a. 407
b. 402
c. 414
d. 428
FeedbackThe correct answer is:428
.
Question 10Correct
Mark 1.00 out of 1.00
Flag question
Question textIn sign-magnitude bit model 8 bits can represent range of ______.
Select one:
a. -8 to +8
b. -127 to +127
c. -128 to +127
d. 0 to 8
FeedbackThe correct answer is:-127 to +127
.
Question 11Correct
Mark 1.00 out of 1.00
Flag question
Question textA string is an array of char.
Select one:
True
False
FeedbackThe correct answer is 'True'.
Question 12Correct
Mark 1.00 out of 1.00
Flag question
Question textunsigned char a;
a=18;
a=a << 2;
What is the value of a?
Select one:
a. 72
b. 16
c. 20
d. 76
FeedbackThe correct answer is:72
.
Question 13Correct
Mark 1.00 out of 1.00
Flag question
Question textSystem software on a UNIX system performs the basic services as system software on a Microsoft Windows system. However, there are some fundamental differences in how the system software is designed and developed. Which one is not one of those:
Select one:
a. Modular
b. Proprietary code
c. Monolithic
d. Virtual
FeedbackThe correct answer is:Virtual
.
Question 14Correct
Mark 1.00 out of 1.00
Flag question
Question textSystem software on a UNIX system performs the basic services as system software on a Microsoft Windows system.
Select one:
True
False
FeedbackThe correct answer is 'True'.
Question 15Correct
Mark 1.00 out of 1.00
Flag question
Question textWhat is the last value of d[1]?
double d[3],*e;
e=&(d[1]);
d[0]=2.0;
*(e-1)=1.5;
*(e+0)=2.5;
Select one:
a. 1.5
b. 0.0
c. 2.0
d. 2.5
FeedbackThe correct answer is:2.5
.
Question 16Correct
Mark 1.00 out of 1.00
Flag question
Question textWhich one is magnitude-only bit model?
Select one:
a. float
b. unsigned char
c. char
d. int
FeedbackThe correct answer is:unsigned char
.
Question 17Correct
Mark 1.00 out of 1.00
Flag question
Question text*(list)[i]=10+i; May be written as:
Select one:
a. *((*list)+i)=10+i;
b. *((*list)+i)=i;
c. *((*list)+10)=10+i;
d. *((*list)+i)=10;
FeedbackThe correct answer is:*((*list)+i)=10+i;
.
Question 18Correct
Mark 1.00 out of 1.00
Flag question
Question textWhat is the binary representation for
char c=35;
Select one:
a. 01100011
b. 00100010
c. 00100011
d. 01000011
FeedbackThe correct answer is:00100011
.
Question 19Correct
Mark 1.00 out of 1.00
Flag question
Question textWhat is the total bytes declared in memory for the following code?
char a;
short int c;
double d;
a = 1; c = 1; d = 2.0;
Select one:
a. 3
b. 11
c. 4
d. 17
FeedbackThe correct answer is:11
.
2-Any statements that begins with a points …---True
3-File.a is an assembly files. ---False
4-gcc-c main c produces main.o file. ----True
5-gcc-E pre 1.c o pre2.c ,The pre2.c file is a preprocessed and executable file ready to run ----False
6-gcc-S file.c will produce file.s –True
7-gcc-s file.c will produce file.s –False
8-gcc main.c sqrt.c will produce a lager file size than gcc-static main.c sqrt.c ---False
9- gcc main.c sqrt.c will produce a faster exucution than gcc-static main.c sqrt.c ---False
10- gcc main.c sqrt.c will produce an exucatable file which cannot run if a related library--- False
11-- gcc sqrt.o main o produces a.out file which is executable---True
12-Linking is the process of bringing together multiple acces –False
13-sqrt= main.o sqrt.o
Gcc-o sqrt sqrt.o main.o
Main.o=main.c
Gcc-c main.c
Sqrt.o=sqrt.c
Gcc –c sqrt.c
When we run the make commend first time there will be three gcc commend execution. ---True
14-When we update main.c and asrt.c make will do two gcc command execution. –False
15-When we update main.c make will do two gcc commands execution—True
16- When we run the make commend second time them... ---True
17-Object code files can do created from any ,not just C –True
18-extern int x , x variable is visible from another file –True
19-int x
Auto int y
Storage classes of x and y are same----True
How can you fix the logical error
here:
#include <stdio.h>
#include <math.h>
main(int argc,char
*argv[])
{
int n,i;
int d2,count;
double d1;
while (1)
{
printf("Enter a number (0 to quit): "
scanf("%d",&n);
if (n == 0)
break;
count=0;
for (i=0; i<n; i++)
QUIZ NAVIGATION
Show one page at a time
Finish review
1 2 3 4 5 6 7
8 9 10 11 12 13 14
15 16 17 18 19 20 21
22 23 24 25 26 27 28
29 30 31 32 33 34 35
36 37 38 39 40Question 2
Partially correct
Mark 0.17 out of
1.00
Flag question
{
d1=(double)n/(double)i;
d2=n/i;
if
(fabs(d1-(double)d2) < 0.00001)
count++;
}
if (count == 2)
printf("%d is prime\n"
else
printf("%d is not prime\n"
}
}
Select one:
a.
while (1>0)
b.
for (i=1; i<n; i++)
c.
main(int argc[],char
*argv[])
d.
double d1=0;
The correct answer is:
for (i=1; i<n; i++)
Question 2
Partially correct
Mark 0.17 out of
1.00
Flag question
{
d1=(double)n/(double)i;
d2=n/i;
if
(fabs(d1-(double)d2) < 0.00001)
count++;
}
if (count == 2)
printf("%d is prime\n"
else
printf("%d is not prime\n"
}
}
Select one:
a.
while (1>0)
b.
for (i=1; i<n; i++)
c.
main(int argc[],char
*argv[])
d.
double d1=0;
The correct answer is:
for (i=1; i<n; i++)
.
#include <stdio.h>
#include <string.h>
main()
{int i,a;
char s[3],t[2];
s[0]='B'; s[1]='c'; s[2]='\0';
t[0]='B'; t[1]='\0';
i=0; a=0;
while (a == 0)
{
if (s[i] < t[i]) a=-1;
if (s[i] > t[i]) a=1;
if (s[i] == '\0' || t[i] == '\0')
break;
i++;
}
printf("%d\n",a);
a=strcmp(s,t);
printf("%d\n",a);
}
second value of a 'B'
Total memory
space used by the
program in bytes:
1
last value of a 99
First value of a 1
last value of t[0] 13
last value of i 0
The correct answer is: second valueQuestion 3
Correct
Mark 1.00 out of
1.00
Flag question
Question 4
Correct
Mark 1.00 out of
1.00
Flag question
of a – 1, Total memory space used
by the program in bytes: – 13, last
value of a – 99, First value of a – 0,
last value of t[0] – 'B', last value of i –
1.
What is the latest value of i ?
int i,n=0;
for (i=1; i<=4;i++)
n=n+2;
Select one:
a. 5
b. 2
c. 1
d. 4
The correct answer is:
5
.
Which program prompts the user
for a positive integer and then
computes the sum of all even
digits. For example, if the user
enters 2784, the program should
print 14, which is (2+8+4).
Select one:
a. #include <stdio.h>
main()
{
int n,sum,last_digit;
printf("Enter an integer: ");
scanf("%d",&n);
while (n > 0){
last_digit=n%10;
if ((last_digit%2) == 0)
sum=sum+last_digit;
n=n/10;
} printf("The sum of its digits is
%d\n",sum);
}
b. #include <stdio.h>
main()
{
int n,sum,last_digit;
printf("Enter an integer: ");
scanf("%d",&n);
sum=0;
while (n > 0){
last_digit=n%10;
if ((last_digit%2) == 0)
sum=sum+last_digit;
n=n-10;
}
printf("The sum of its digits is
%d\n",sum);
}
c. #include <stdio.h>
main()
{
int n,sum,last_digit;
printf("Enter an integer: ");
scanf("%d",&n);
sum=0;
while (n > 0){
last_digit=n%10;
sum=sum+last_digit;
n=n/10;
}
printf("The sum of its digits is
%d\n",sum);
}
d. #include <stdio.h>
main()
{
int n,sum,last_digit;
printf("Enter an integer: ");
scanf("%d",&n);
sum=0;
while (n > 0){
last_digit=n%10;Question 5
Correct
Mark 1.00 out of
1.00
Flag question
if ((last_digit%2) == 0)
sum=sum+last_digit;
n=n/10;
}
printf("The sum of its digits is
%d\n",sum);
}
The correct answer is:
#include <stdio.h>
main()
{
int n,sum,last_digit;
printf("Enter an integer: ");
scanf("%d",&n);
sum=0;
while (n > 0){
last_digit=n%10;
if ((last_digit%2) == 0)
sum=sum+last_digit;
n=n/10;
}
printf("The sum of its digits is
%d\n",sum);
}
.
What is the value of 1 0 0 1 0 0 1 1
in fixed-point bit model?
Select one:
a. I don't know
b. 18.25
c. 2.275
d. 18.375
The correct answer is:
18.375
.Question 6
Incorrect
Mark 0.00 out of
1.00
Flag question
Question 7
Correct
Mark 1.00 out of
1.00
What is the last value of d2?
#include <stdio.h>
main()
{
struct ID {
int number;
float cost;
double *barcode;
};
struct ID list[3],*item;
float *f;
double d2;
d2=8;
list[2].number=12;
list[2].cost=44.11;
list[2].barcode=&d2;
item=&(list[2]);
f=&(item->cost);
d=item->barcode;
}
Select one:
a. 888
b. 889
c. 8
d. 9
The correct answer is:
8
.
How many bytes does the following
code occupies in memory?
int a[4];Flag question
Question 8
Correct
Mark 1.00 out of
1.00
Flag question
Question 9
Correct
Mark 1.00 out of
1.00
Flag question
Question 10
Correct
Select one:
a. 16
b. 8
c. 0
d. 4
The correct answer is:
16
.
System software on a UNIX
system performs the basic
services as system software on a
Microsoft Windows system.
Select one:
True
False
The correct answer is 'True'.
In two's complement bit model 5 bits
can represent range of ______.
Select one:
a. -16 to +15
b. -128 to +127
c. 0 to 8
d. -8 to +8
The correct answer is:
-16 to +15
.
How many bytes does the following
code occupies in memory?Mark 1.00 out of
1.00
Flag question
Question 11
Correct
Mark 1.00 out of
1.00
Flag question
Question 12
Incorrect
Mark 0.00 out of
1.00
Flag question
int a[4][2];
Select one:
a. 8
b. 0
c. 32
d. 16
The correct answer is:
32
.
What is the binary representation for
char d=’G’;
Select one:
a. 00100011
b. 01000011
c. 01100011
d. 01000111
The correct answer is:
01000111
.
How many total bytes does the
following code declares for
variables?
#include <stdio.h>
main()
{
struct ID {
int number;
float cost;
double *barcode;
};Question 13
Correct
Mark 1.00 out of
1.00
Flag question
struct ID list[3],*item;
float *f;
double d2;
d2=888;
list[2].number=12;
list[2].cost=44.11;
list[2].barcode=&d2;
item=&(list[2]);
f=&(item->cost);
d=item->barcode;
}
Select one:
a. 15
b. 60
c. 52
d. 56
The correct answer is:
52
.
35 & 3
Select one:
a. 0000 0111
b. 0000 0011
c. 0000 1111
d. 0001 0011
The correct answer is:
0000 0011
.Question 14
Correct
Mark 1.00 out of
1.00
Flag question
Question 15
Correct
Mark 1.00 out of
1.00
Flag question
What will be the output of the
following code?
#include <stdio.h>
int main()
{
int i, j; char s[8], t[4];
s[0] = 'S'; s[1] = 'y'; s[2] = '\0';
t[0] = 's'; t[1] = 't'; t[2] = 'e'; t[3] = '\0';
i = strlen(s); j = 0;
while (t[j] != '\0'){
s[i + j] = t[j];
j++;
}
s[i] = '\0';
printf("%s",s);
return 0;
}
Select one:
a. Sy
b. System
c. Syst
d. Syste
The correct answer is:
Sy
.
How can you fix the logical error
here:
#include <stdio.h>
#include <math.h>
main(int argc,char
*argv[]){
int n,i;
int d2,count;
double d1;
while (1)
{
printf("Enter a number (0 to quit): "
scanf("%d",&n);
if (n == 0)
break;
count=0;
for (i=1; i<n; i++)
{
d1=(double)n/(double)i;
d2=n/i;
if
(fabs(d1-(double)d2) < 0.00001)
count++;
}
if (count == 2)
printf("%d is prime\n"
else
printf("%d is not prime\n"
}
}
Select one:
a.
for (i=1; i<=n; i++)
b.
for (i=0; i<n; i++)
c.
main(int argc[],char
*argv[])Question 16
Correct
Mark 1.00 out of
1.00
Flag question
Question 17
Correct
Mark 1.00 out of
1.00
Flag question
d.
for (i=1; i<=n; i--)
The correct answer is:
for (i=1; i<=n; i++)
.
int *a; a = (int *) malloc (21); //How
many bytes are we requesting
from OS?
Select one:
a. 84
b. 0
c. 21
d. 42
The correct answer is:
21
.
unsigned char a;
a=18;
a=a << 2;
What is the value of a?
Select one:
a. 76
b. 72
c. 20
d. 16
The correct answer is:
72
.Question 18
Correct
Mark 1.00 out of
1.00
Flag question
Question 19
Correct
Mark 1.00 out of
1.00
Flag question
Question 20
Incorrect
Mark 0.00 out of
1.00
Flag question
In sign-magnitude bit model 5 bits
can represent range of ______.
Select one:
a. -15 to +15
b. -8 to +8
c. -128 to +127
d. 0 to 8
The correct answer is:
-15 to +15
.
Which one is two's complement bit
model?
Select one:
a. text
b. unsigned int
c. unsigned char
d. int
The correct answer is:
int
.
What is the last value of d2?
#include <stdio.h>
main()
{
struct ID {
int number;
float cost;
double *barcode;
};
struct ID list[3],*item;Question 21
Incorrect
Mark 0.00 out of
1.00
Flag question
float *f;
double d2;
d2=8;
list[2].number=12;
list[2].cost=44.11;
list[2].barcode=&d2;
item=&(list[2]);
f=&(item->cost);
d=item->barcode;
*d=(*d)+10;
}
Select one:
a. 888
b. 18
c. 8
d. 889
The correct answer is:
8
.
What is the latest value of i ?
int i,n=0;
for (i=1; i<=4;i++)
n=n+2;
i=6;
Select one:
a. 5
b. 2
c. 4
d. 6
The correct answer is:Question 22
Correct
Mark 1.00 out of
1.00
Flag question
Question 23
Correct
Mark 1.00 out of
1.00
Flag question
Question 24
Incorrect
Mark 0.00 out of
1.00
Flag question
6
.
Which one is magnitude-only bit
model?
Select one:
a. char
b. int
c. float
d. unsigned char
The correct answer is:
unsigned char
.
unsigned char a;
a=18;
a=a >> 2;
What is the value of a?
Select one:
a. 16
b. 20
c. 72
d. 4
The correct answer is:
4
.
What is the last value of d[1]?
double d[3],*e;
e=&(d[1]);
d[0]=2.0;Question 25
Incorrect
Mark 0.00 out of
1.00
Flag question
Question 26
Incorrect
Mark 0.00 out of
1.00
Flag question
d[1]=0.0
*(e-1)=1.5;
e[0]=2.5;
Select one:
a. 2.5
b. 2.0
c. 0.0
d. 1.5
The correct answer is:
2.5
.
cp=&(ca[1]);
What can you write instead of *
(cp+1)=7;
Select one:
a. ca[2] = 7
b. ca[1] = 1
c. ca[1] = 7
d. ca[0] = 7
The correct answer is:
ca[2] = 7
.
What is wrong with the following
code:
#include <stdio.h>
#include <math.h>
main(int argc,char
*argv[]){
int n,i;
int d2,count,
double d1;
while (1)
{
printf("Enter a number (0 to quit): "
scanf("%d",&n);
if (n == 0)
break;
count=0;
for (i=0; i<n; i++)
{
d1=(double)n/(double)i;
d2=n/i;
if
(fabs(d1-(double)d2) < 0.00001)
count++;
}
if (count == 2)
printf("%d is prime\n"
else
printf("%d is not prime\n"
}
}
Select one:
a.
while (1)
b.
main(int argc,char
*argv[])
c.
double d1;
d.Question 27
Not answered
Marked out of
1.00
Flag question
Question 28
Incorrect
Mark 0.00 out of
1.00
Flag question
int d2,count,
The correct answer is:
int d2,count,
.
What is the last value of i[3]?
int *ip, i[5];
i[1]=1;i[2]=1;i[3]=1;
ip=&(i[0]);
*(ip+3) = *(ip+1) + *(ip+2);
printf("%d",i[3]);
Select one:
a. 1
b. 3
c. 2
d. 4
The correct answer is:
2
.
What is the last value of d[1]?
double d[3],*e;
e=&(d[1]);
d[0]=2.0;
*(e-1)=1.5;
*(e+0)=2.5;
Select one:
a. 1.5Question 29
Incorrect
Mark 0.00 out of
1.00
Flag question
Question 30
Incorrect
Mark 0.00 out of
1.00
Flag question
Question 31
Correct
Mark 1.00 out of
1.00
Flag question
b. 0.0
c. 2.5
d. 2.0
The correct answer is:
2.5
.
int *ip; *(ip+7)=8; //If the &ip = 400,
which address are we storing 8?
Select one:
a. 428
b. 414
c. 402
d. 407
The correct answer is:
428
.
A string is an array of char.
Select one:
True
False
The correct answer is 'True'.
b=01000000 What is b >> 3 ?
Select one:
a. 03000000
b. 01000003
c. 00010000
d. 00001000Question 32
Correct
Mark 1.00 out of
1.00
Flag question
Question 33
Incorrect
Mark 0.00 out of
1.00
Flag question
Question 34
The correct answer is:
00001000
.
Unsigned int has a range of
Select one:
a. 1 to 255
b. 0 to 4,294,967,295
c. 1 to 8
d. 0 to 256
The correct answer is:
0 to 4,294,967,295
.
What is the last value of d[0]?
double d[3],*e;
e=&(d[1]);
d[0]=2.0;
*(e-1)=1.5;
*(e+0)=2.5;
Select one:
a. 2.0
b. 0.0
c. 2.5
d. 1.5
The correct answer is:
1.5
.
What is the binary representation forCorrect
Mark 1.00 out of
1.00
Flag question
Question 35
Correct
Mark 1.00 out of
1.00
Flag question
Question 36
Incorrect
Mark 0.00 out of
1.00
Flag question
char c=35;
Select one:
a. 01000011
b. 00100011
c. 00100010
d. 01100011
The correct answer is:
00100011
.
unsigned char a;
a=4;
a=~a;
What is the value of a?
Select one:
a. 251
b. 20
c. 72
d. 16
The correct answer is:
251
.
Which one is not a way that a text
editor can assist with writing
program code (as opposed to
writing generic text using a word
processor).
Select one:
a. Automatically adjust
algorithms
b. Move the cursor to a matching
braceQuestion 37
Correct
Mark 1.00 out of
1.00
Flag question
Question 38
Correct
Mark 1.00 out of
1.00
Flag question
Question 39
c. Highlight programming
language keywords and reserved
words
d. Display the line number
The correct answer is:
Automatically adjust algorithms
.
char *cp; *(cp+7)=8; //If the &cp =
400, which address are we storing
8?
Select one:
a. 428
b. 407
c. 402
d. 414
The correct answer is:
407
.
Unsigned char has a range of
Select one:
a. 0 to 255
b. 1 to 8
c. 0 to 256
d. 1 to 255
The correct answer is:
0 to 255
.
Assume that our data type isCorrect
Mark 1.00 out of
1.00
Flag question
Question 40
Correct
Mark 1.00 out of
1.00
Flag question
magnitude-only bit model and it uses
4 bits. What would be the value
range?
Select one:
a. 0 to 256
b. 1 to 4
c. 0 to 15
d. 1 to 255
The correct answer is:
0 to 15
.
What is the total bytes declared in
memory for the following code?
char a;
float c;
double d;
a = 1; c = 1.0; d = 2.0;
Select one:
a. 4
b. 13
c. 3
d. 17
The correct answer is:
13
Question 1
Incorrect
Mark 0.00 out of 1.00
Not flaggedFlag question
Question text
unsigned char a;
a=4;
a=~a;
What is the value of a?
Select one:
a. 16 Incorrect
b. 72
c. 251
d. 20
Feedback
The correct answer is:
251
.
Question 2
Incorrect
Mark 0.00 out of 1.00
Not flaggedFlag question
Question text
int *a; a = (int *) malloc (21); //How many bytes are we requesting from OS?
Select one:
a. 84 Incorrect
b. 42
c. 0
d. 21
Feedback
The correct answer is:
21
.
Question 3
Incorrect
Mark 0.00 out of 1.00
Not flaggedFlag question
Question text
x = 0000 0001 What is x = x | (1«3);
Select one:
a. 0000 1000 Incorrect
b. 0000 1001
c. 0000 0001
d. 0000 0011
Feedback
The correct answer is:
0000 1001
.
Question 4
Correct
Mark 1.00 out of 1.00
Not flaggedFlag question
Question text
Assume that our data type is magnitude-only bit model and it uses 4 bits. What would be the value range?
Select one:
a. 0 to 15 Correct
b. 1 to 255
c. 1 to 4
d. 0 to 256
Feedback
The correct answer is:
0 to 15
.
Question 5
Incorrect
Mark 0.00 out of 1.00
Not flaggedFlag question
Question text
int *ip; *(ip+7)=8; //If the &ip = 400, which address are we storing 8?
Select one:
a. 402
b. 407
c. 428
d. 414 Incorrect
Feedback
The correct answer is:
428
.
Question 6
Incorrect
Mark 0.00 out of 1.00
Not flaggedFlag question
Question text
What will be the output of the following code?
#include <stdio.h>
int main()
{
int i, j; char s[8], t[4];
s[0] = 'S'; s[1] = 'y'; s[2] = '\0';
t[0] = 's'; t[1] = 't'; t[2] = 'e'; t[3] = '\0';
i = strlen(s); j = 0;
while (t[j] != '\0'){
s[i + j] = t[j];
j++;
}
s[i] = '\0';
printf("%s",s);
return 0;
}
Select one:
a. System
b. Syste Incorrect
c. Sy
d. Syst
Feedback
The correct answer is:
Sy
.
Question 7
Correct
Mark 1.00 out of 1.00
Not flaggedFlag question
Question text
4 bits called ______.
Select one:
a. Half
b. Bubble
c. Double
d. Nibble Correct
Feedback
The correct answer is:
Nibble
.
Question 8
Incorrect
Mark 0.00 out of 1.00
Not flaggedFlag question
Question text
What is the last value of d[0]?
double d[3],*e;
e=&(d[1]);
d[0]=2.0;
*(e-1)=1.5;
*(e+0)=2.5;
Select one:
a. 2.0 Incorrect
b. 0.0
c. 2.5
d. 1.5
Feedback
The correct answer is:
1.5
.
Question 9
Correct
Mark 1.00 out of 1.00
Not flaggedFlag question
Question text
What is the last value of d2?
#include <stdio.h>
main()
{
struct ID {
int number;
float cost;
double *barcode;
};
struct ID list[3],*item;
float *f;
double d2;
d2=8;
list[2].number=12;
list[2].cost=44.11;
list[2].barcode=&d2;
item=&(list[2]);
f=&(item->cost);
d=item->barcode;
}
Select one:
a. 8 Correct
b. 9
c. 889
d. 888
Feedback
The correct answer is:
8
.
Question 10
Correct
Mark 1.00 out of 1.00
Not flaggedFlag question
Question text
15 | 65
Select one:
a. 0100 1110
b. 1100 1111
c. 0110 1111
d. 0100 1111 Correct
Feedback
The correct answer is:
0100 1111
.
Question 11
Correct
Mark 1.00 out of 1.00
Not flaggedFlag question
Question text
What is the total bytes declared in memory for the following code?
char a;
short int c;
double d;
a = 1; c = 1; d = 2.0;
Select one:
a. 4
b. 17
c. 3
d. 11 Correct
Feedback
The correct answer is:
11
.
Question 12
Incorrect
Mark 0.00 out of 1.00
Not flaggedFlag question
Question text
Which program prompts the user for a positive integer and then computes the sum of all even digits. For example, if the user enters 2784, the program should print 14, which is (2+8+4).
Select one:
a. #include <stdio.h>
main()
{
int n,sum,last_digit;
printf("Enter an integer: ");
scanf("%d",&n);
sum=0;
while (n > 0){
last_digit=n%10;
if ((last_digit%2) == 0)
sum=sum+last_digit;
n=n/10;
}
printf("The sum of its digits is %d\n",sum);
}
b. #include <stdio.h>
main()
{
int n,sum,last_digit;
printf("Enter an integer: ");
scanf("%d",&n);
while (n > 0){
last_digit=n%10;
if ((last_digit%2) == 0)
sum=sum+last_digit;
n=n/10;
}
printf("The sum of its digits is %d\n",sum);
}
Incorrect
c. #include <stdio.h>
main()
{
int n,sum,last_digit;
printf("Enter an integer: ");
scanf("%d",&n);
sum=0;
while (n > 0){
last_digit=n%10;
sum=sum+last_digit;
n=n/10;
}
printf("The sum of its digits is %d\n",sum);
}
d. #include <stdio.h>
main()
{
int n,sum,last_digit;
printf("Enter an integer: ");
scanf("%d",&n);
sum=0;
while (n > 0){
last_digit=n%10;
if ((last_digit%2) == 0)
sum=sum+last_digit;
n=n-10;
}
printf("The sum of its digits is %d\n",sum);
}
Feedback
The correct answer is:
#include <stdio.h>
main()
{
int n,sum,last_digit;
printf("Enter an integer: ");
scanf("%d",&n);
sum=0;
while (n > 0){
last_digit=n%10;
if ((last_digit%2) == 0)
sum=sum+last_digit;
n=n/10;
}
printf("The sum of its digits is %d\n",sum);
}
.
Question 13
Correct
Mark 1.00 out of 1.00
Not flaggedFlag question
Question text
How can you fix the logical error here:
#include <stdio.h>
#include <math.h>
main(int argc,char *argv[])
{
int n,i;
int d2,count;
double d1;
while (1)
{
printf("Enter a number (0 to quit): ");
scanf("%d",&n);
if (n == 0)
break;
count=0;
for (i=1; i<n; i++)
{
d1=(double)n/(double)i;
d2=n/i;
if (fabs(d1-(double)d2) < 0.00001)
count++;
}
if (count == 2)
printf("%d is prime\n",n);
else
printf("%d is not prime\n",n);
}
}
Select one:
a.
main(int argc[],char *argv[])
b.
for (i=1; i<=n; i++)
Correct
c.
for (i=0; i<n; i++)
d.
for (i=1; i<=n; i--)
Feedback
The correct answer is:
for (i=1; i<=n; i++)
.
Question 14
Correct
Mark 1.00 out of 1.00
Not flaggedFlag question
Question text
Unsigned int has a range of
Select one:
a. 1 to 8
b. 0 to 256
c. 0 to 4,294,967,295 Correct
d. 1 to 255
Feedback
The correct answer is:
0 to 4,294,967,295
.
Question 15
Incorrect
Mark 0.00 out of 1.00
Not flaggedFlag question
Question text
How many bytes does the following code occupies in memory?
int a[4][2];
Select one:
a. 16
b. 32
c. 0
d. 8 Incorrect
Feedback
The correct answer is:
32
.
Question 16
Correct
Mark 1.00 out of 1.00
Not flaggedFlag question
Question text
What is the binary representation for
char d=’G’;
Select one:
a. 01000111 Correct
b. 01000011
c. 01100011
d. 00100011
Feedback
The correct answer is:
01000111
.
Question 17
Incorrect
Mark 0.00 out of 1.00
Not flaggedFlag question
Question text
What is the last value of d2?
#include <stdio.h>
main()
{
struct ID {
int number;
float cost;
double *barcode;
};
struct ID list[3],*item;
float *f;
double d2;
d2=8;
list[2].number=12;
list[2].cost=44.11;
list[2].barcode=&d2;
item=&(list[2]);
f=&(item->cost);
d=item->barcode;
*d=(*d)+10;
}
Select one:
a. 889 Incorrect
b. 888
c. 18
d. 8
Feedback
The correct answer is:
8
.
Question 18
Correct
Mark 1.00 out of 1.00
Not flaggedFlag question
Question text
35 & 3
Select one:
a. 0000 1111
b. 0000 0011 Correct
c. 0000 0111
d. 0001 0011
Feedback
The correct answer is:
0000 0011
.
Question 19
Incorrect
Mark 0.00 out of 1.00
Not flaggedFlag question
Question text
What is wrong with the following code:
#include <stdio.h>
#include <math.h>
main(int argc,char *argv[])
{
int n,i;
int d2,count,
double d1;
while (1)
{
printf("Enter a number (0 to quit): ");
scanf("%d",&n);
if (n == 0)
break;
count=0;
for (i=0; i<n; i++)
{
d1=(double)n/(double)i;
d2=n/i;
if (fabs(d1-(double)d2) < 0.00001)
count++;
}
if (count == 2)
printf("%d is prime\n",n);
else
printf("%d is not prime\n",n);
}
}
Select one:
a.
double d1;
Incorrect
b.
while (1)
c.
int d2,count,
d.
main(int argc,char *argv[])
Feedback
The correct answer is:
int d2,count,
.
Question 20
Incorrect
Mark 0.00 out of 1.00
Not flaggedFlag question
Question text
cp=&(ca[1]);
What can you write instead of *(cp+1)=7;
Select one:
a. ca[1] = 1
b. ca[1] = 7 Incorrect
c. ca[0] = 7
d. ca[2] = 7
Feedback
The correct answer is:
ca[2] = 7
.
Question 21
Correct
Mark 1.00 out of 1.00
Not flaggedFlag question
Question text
What is the last value of d[1]?
double d[3],*e;
e=&(d[1]);
d[0]=2.0;
*(e-1)=1.5;
*(e+0)=2.5;
Select one:
a. 2.0
b. 2.5 Correct
c. 0.0
d. 1.5
Feedback
The correct answer is:
2.5
.
Question 22
Incorrect
Mark 0.00 out of 1.00
Not flaggedFlag question
Question text
How can you fix the logical error here:
#include <stdio.h>
#include <math.h>
main(int argc,char *argv[])
{
int n,i;
int d2,count;
double d1;
while (1)
{
printf("Enter a number (0 to quit): ");
scanf("%d",&n);
if (n == 0)
break;
count=0;
for (i=0; i<n; i++)
{
d1=(double)n/(double)i;
d2=n/i;
if (fabs(d1-(double)d2) < 0.00001)
count++;
}
if (count == 2)
printf("%d is prime\n",n);
else
printf("%d is not prime\n",n);
}
}
Select one:
a.
while (1>0)
b.
for (i=1; i<n; i++)
c.
main(int argc[],char *argv[])
d.
double d1=0;
Incorrect
Feedback
The correct answer is:
for (i=1; i<n; i++)
.
Question 23
Correct
Mark 1.00 out of 1.00
Not flaggedFlag question
Question text
How many bytes does the following code occupies in memory?
int a[4];
Select one:
a. 16 Correct
b. 8
c. 0
d. 4
Feedback
The correct answer is:
16
.
Question 24
Correct
Mark 1.00 out of 1.00
Not flaggedFlag question
Question text
In sign-magnitude bir model a value of 1 in the sign bit indicates a ________ number.
Select one:
a. negative Correct
b. complex
c. integer
d. positive
Feedback
The correct answer is:
negative
.
Question 25
Incorrect
Mark 0.00 out of 1.00
Not flaggedFlag question
Question text
x = 0000 1001 What is x = x AND NOT (1«3);
Select one:
a. 0000 0001
b. 0000 0011
c. 0000 1001 Incorrect
d. 0000 1000
Feedback
The correct answer is:
0000 0001
.
Question 26
Correct
Mark 1.00 out of 1.00
Not flaggedFlag question
Question text
unsigned char a;
a=18;
a=a >> 2;
What is the value of a?
Select one:
a. 4 Correct
b. 16
c. 72
d. 20
Feedback
The correct answer is:
4
.
Question 27
Incorrect
Mark 0.00 out of 1.00
Not flaggedFlag question
Question text
What does 10011001 represents?
Select one:
a. Depends on the bit model.
b. 153 Incorrect
c. -153
Feedback
The correct answer is:
Depends on the bit model.
.
Question 28
Incorrect
Mark 0.00 out of 1.00
Not flaggedFlag question
Question text
Which one is magnitude-only bit model?
Select one:
a. unsigned char
b. char
c. int Incorrect
d. float
Feedback
The correct answer is:
unsigned char
.
Question 29
Incorrect
Mark 0.00 out of 1.00
Not flaggedFlag question
Question text
char *cp; *(cp+7)=8; //If the &cp = 400, which address are we storing 8?
Select one:
a. 407
b. 402 Incorrect
c. 414
d. 428
Feedback
The correct answer is:
407
.
Question 30
Correct
Mark 1.00 out of 1.00
Not flaggedFlag question
Question text
b=01000000 What is b >> 3 ?
Select one:
a. 01000003
b. 03000000
c. 00010000
d. 00001000 Correct
Feedback
The correct answer is:
00001000
.
Question 31
Incorrect
Mark 0.00 out of 1.00
Not flaggedFlag question
Question text
How many bytes does the following code uses in the memory?
struct ID {
int number;
float cost;
double *barcode;
};
Select one:
a. 16 Incorrect
No. This is template. If we define struct ID list; Then we are using memory.
b. 0
c. 12
d. 6
Feedback
The correct answer is:
0
.
Question 32
Correct
Mark 1.00 out of 1.00
Not flaggedFlag question
Question text
*(list)[i]=10+i; May be written as:
Select one:
a. *((*list)+i)=i;
b. *((*list)+i)=10;
c. *((*list)+i)=10+i; Correct
d. *((*list)+10)=10+i;
Feedback
The correct answer is:
*((*list)+i)=10+i;
.
Question 33
Incorrect
Mark 0.00 out of 1.00
Not flaggedFlag question
Question text
In sign-magnitude bit model 5 bits can represent range of ______.
Select one:
a. -8 to +8
b. 0 to 8
c. -128 to +127 Incorrect
d. -15 to +15
Feedback
The correct answer is:
-15 to +15
.
Question 34
Correct
Mark 1.00 out of 1.00
Not flaggedFlag question
Question text
Unsigned int has a range of
Select one:
a. 1 to 8
b. 0 to 256
c. 1 to 255
d. 0 to 255 Correct
Feedback
The correct answer is:
0 to 255
.
Question 35
Incorrect
Mark 0.00 out of 1.00
Not flaggedFlag question
Question text
d[0]='t',d[1]='e', d[2]='\0', d[3]='t', d[4]='\0'
printf("%c%c%c%c%c\n", d[0], d[1], d[2], d[3], d[4]);
printf ("%s\n", d);
Both printf statements will print same thing.
Select one:
True Incorrect
False
Feedback
The correct answer is 'False'.
Question 36
Incorrect
Mark 0.00 out of 1.00
Not flaggedFlag question
Question text
How many total bytes does the following code declares for variables?
#include <stdio.h>
main()
{
struct ID {
int number;
float cost;
double *barcode;
};
struct ID list[3],*item;
float *f;
double d2;
d2=888;
list[2].number=12;
list[2].cost=44.11;
list[2].barcode=&d2;
item=&(list[2]);
f=&(item->cost);
d=item->barcode;
}
Select one:
a. 56 Incorrect
b. 52
c. 15
d. 60
Feedback
The correct answer is:
52
.
Question 37
Incorrect
Mark 0.00 out of 1.00
Not flaggedFlag question
Question text
What is the last value of d[1]?
double d[3],*e;
e=&(d[1]);
d[0]=2.0;
d[1]=0.0
*(e-1)=1.5;
e[0]=2.5;
Select one:
a. 2.5
b. 1.5 Incorrect
c. 2.0
d. 0.0
Feedback
The correct answer is:
2.5
.
Question 38
Incorrect
Mark 0.00 out of 1.00
Not flaggedFlag question
Question text
What is the latest value of i ?
int i,n=0;
for (i=1; i<=4;i++)
n=n+2;
i=6;
Select one:
a. 6
b. 2
c. 4
d. 5 Incorrect
Feedback
The correct answer is:
6
.
Question 39
Incorrect
Mark 0.00 out of 1.00
Not flaggedFlag question
Question text
In sign-magnitude bit model 8 bits can represent range of ______.
Select one:
a. -128 to +127 Incorrect
b. -8 to +8
c. -127 to +127
d. 0 to 8
Feedback
The correct answer is:
-127 to +127
.
Question 40
Incorrect
Mark 0.00 out of 1.00
Not flaggedFlag question
Question text
What is the value of 1 0 0 1 0 0 1 1 in fixed-point bit model?
Select one:
a. 18.25
b. I don't know Incorrect
c. 2.275
d. 18.375
Feedback
The correct answer is:
18.375
unsigned char a;
a=18;
a=a >> 2;
What is the value of a?
Select one:
a. 20
b. 16
c. 4 Correct
d. 72
Feedback
The correct answer is:
4
.
Question 2
Incorrect
Mark 0.00 out of 1.00
Not flaggedFlag question
Question text
What is the last value of d2?
#include <stdio.h>
main()
{
struct ID {
int number;
float cost;
double *barcode;
};
struct ID list[3],*item;
float *f;
double d2;
d2=8;
list[2].number=12;
list[2].cost=44.11;
list[2].barcode=&d2;
item=&(list[2]);
f=&(item->cost);
d=item->barcode;
*d=(*d)+10;
}
Select one:
a. 18
b. 888
c. 889 Incorrect
d. 8
Feedback
The correct answer is:
8
.
Question 3
Correct
Mark 1.00 out of 1.00
Not flaggedFlag question
Question text
What is the last value of i[3]?
int *ip, i[5];
i[1]=1;i[2]=1;i[3]=1;
ip=&(i[0]);
*(ip+3) = *(ip+1) + *(ip+2);
printf("%d",i[3]);
Select one:
a. 3
b. 2 Correct
c. 1
d. 4
Feedback
The correct answer is:
2
.
Question 4
Correct
Mark 1.00 out of 1.00
Not flaggedFlag question
Question text
char *cp; *(cp+7)=8; //If the &cp = 400, which address are we storing 8?
Select one:
a. 428
b. 402
c. 407 Correct
d. 414
Feedback
The correct answer is:
407
.
Question 5
Incorrect
Mark 0.00 out of 1.00
Not flaggedFlag question
Question text
Which one is magnitude-only bit model?
Select one:
a. int Incorrect
b. float
c. char
d. unsigned char
Feedback
The correct answer is:
unsigned char
.
Question 6
Incorrect
Mark 0.00 out of 1.00
Not flaggedFlag question
Question text
What is the binary representation for
char c=35;
Select one:
a. 00100011
b. 01000011
c. 01100011
d. 00100010 Incorrect
Feedback
The correct answer is:
00100011
.
Question 7
Correct
Mark 1.00 out of 1.00
Not flaggedFlag question
Question text
Assume that our data type is magnitude-only bit model and it uses 4 bits. What would be the value
range?
Select one:
a. 1 to 255
b. 0 to 15 Correct
c. 1 to 4
d. 0 to 256
Feedback
The correct answer is:
0 to 15
.
Question 8
Incorrect
Mark 0.00 out of 1.00
Not flaggedFlag question
Question text
15 | 65
Select one:
a. 0110 1111
b. 1100 1111
c. 0100 1110 Incorrect
d. 0100 1111
Feedback
The correct answer is:
0100 1111
.
Question 9
Correct
Mark 1.00 out of 1.00
Not flaggedFlag question
Question text
int *a; a = (int *) malloc (21); //How many bytes are we requesting from OS?
Select one:
a. 21 Correct
b. 84
c. 42
d. 0
Feedback
The correct answer is:
21
.
Question 10
Incorrect
Mark 0.00 out of 1.00
Not flaggedFlag question
Question text
What is the last value of d[1]?
double d[3],*e;
e=&(d[1]);
d[0]=2.0;
d[1]=0.0
*(e-1)=1.5;
e[0]=2.5;
Select one:
a. 2.0
b. 2.5
c. 0.0 Incorrect
d. 1.5
Feedback
The correct answer is:
2.5
.
Question 11
Correct
Mark 1.00 out of 1.00
Not flaggedFlag question
Question text
unsigned char a;
a=4;
a=~a;
What is the value of a?
Select one:
a. 16
b. 20
c. 251 Correct
d. 72
Feedback
The correct answer is:
251
.
Question 12
Incorrect
Mark 0.00 out of 1.00
Not flaggedFlag question
Question text
cp=&(ca[1]);
What can you write instead of *(cp+1)=7;
Select one:
a. ca[2] = 7
b. ca[0] = 7
c. ca[1] = 7 Incorrect
d. ca[1] = 1
Feedback
The correct answer is:
ca[2] = 7
.
Question 13
Incorrect
Mark 0.00 out of 1.00
Not flaggedFlag question
Question text
In two's complement bit model 5 bits can represent range of ______.
Select one:
a. -8 to +8
b. -16 to +15
c. 0 to 8
d. -128 to +127 Incorrect
Feedback
The correct answer is:
-16 to +15
.
Question 14
Correct
Mark 1.00 out of 1.00
Not flaggedFlag question
Question text
In sign-magnitude bit model 8 bits can represent range of ______.
Select one:
a. 0 to 8
b. -8 to +8
c. -128 to +127
d. -127 to +127 Correct
Feedback
The correct answer is:
-127 to +127
.
Question 15
Incorrect
Mark 0.00 out of 1.00
Not flaggedFlag question
Question text
Which one is two's complement bit model?
Select one:
a. unsigned char Incorrect
b. text
c. int
d. unsigned int
Feedback
The correct answer is:
int
.
Question 16
Incorrect
Mark 0.00 out of 1.00
Not flaggedFlag question
Question text
In sign-magnitude bit model 5 bits can represent range of ______.
Select one:
a. -15 to +15
b. 0 to 8
c. -128 to +127 Incorrect
d. -8 to +8
Feedback
The correct answer is:
-15 to +15
.
Question 17
Correct
Mark 1.00 out of 1.00
Not flaggedFlag question
Question text
How many total bytes does the following code declares for variables?
#include <stdio.h>
main()
{
struct ID {
int number;
float cost;
double *barcode;
};
struct ID list[3],*item;
float *f;
double d2;
d2=888;
list[2].number=12;
list[2].cost=44.11;
list[2].barcode=&d2;
item=&(list[2]);
f=&(item->cost);
d=item->barcode;
}
Select one:
a. 56
b. 15
c. 52 Correct
d. 60
Feedback
The correct answer is:
52
.
Question 18
Incorrect
Mark 0.00 out of 1.00
Not flaggedFlag question
Question text
How can you fix the logical error here:
#include <stdio.h>
#include <math.h>
main(int argc,char *argv[])
{
int n,i;
int d2,count;
double d1;
while (1)
{
printf("Enter a number (0 to quit): ");
scanf("%d",&n);
if (n == 0)
break;
count=0;
for (i=0; i<n; i++)
{
d1=(double)n/(double)i;
d2=n/i;
if (fabs(d1-(double)d2) < 0.00001)
count++;
}
if (count == 2)
printf("%d is prime\n",n);
else
printf("%d is not prime\n",n);
}
}
Select one:
a.
main(int argc[],char *argv[])
b.
for (i=1; i<n; i++)
c.
double d1=0;
Incorrect
d.
while (1>0)
Feedback
The correct answer is:
for (i=1; i<n; i++)
.
Question 19
Incorrect
Mark 0.00 out of 1.00
Not flaggedFlag question
Question text
In sign-magnitude bir model a value of 1 in the sign bit indicates a ________ number.
Select one:
a. positive Incorrect
b. complex
c. integer
d. negative
Feedback
The correct answer is:
negative
.
Question 20
Correct
Mark 1.00 out of 1.00
Not flaggedFlag question
Question text
What will be the output of the following code?
#include <stdio.h>
int main()
{
int i, j; char s[8], t[4];
s[0] = 'S'; s[1] = 'y'; s[2] = '\0';
t[0] = 's'; t[1] = 't'; t[2] = 'e'; t[3] = '\0';
i = strlen(s); j = 0;
while (t[j] != '\0'){
s[i + j] = t[j];
j++;
}
s[i] = '\0';
printf("%s",s);
return 0;
}
Select one:
a. Sy Correct
b. Syste
c. Syst
d. System
Feedback
The correct answer is:
Sy
.
Question 21
Incorrect
Mark 0.00 out of 1.00
Not flaggedFlag question
Question text
What is the latest value of i ?
int i,n=0;
for (i=1; i<=4;i++)
n=n+2;
i=6;
Select one:
a. 4
b. 6
c. 2 Incorrect
d. 5
Feedback
The correct answer is:
6
.
Question 22
Incorrect
Mark 0.00 out of 1.00
Not flaggedFlag question
Question text
A string is an array of char.
Select one:
True
False Incorrect
Feedback
The correct answer is 'True'.
Question 23
Correct
Mark 1.00 out of 1.00
Not flaggedFlag question
Question text
int *ip; *(ip+7)=8; //If the &ip = 400, which address are we storing 8?
Select one:
a. 414
b. 428 Correct
c. 407
d. 402
Feedback
The correct answer is:
428
.
Question 24
Incorrect
Mark 0.00 out of 1.00
Not flaggedFlag question
Question text
What is the last value of d[1]?
double d[3],*e;
e=&(d[1]);
d[0]=2.0;
*(e-1)=1.5;
*(e+0)=2.5;
Select one:
a. 2.5
b. 1.5
c. 0.0 Incorrect
d. 2.0
Feedback
The correct answer is:
2.5
.
Question 25
Correct
Mark 1.00 out of 1.00
Not flaggedFlag question
Question text
How many bytes does the following code occupies in memory?
int a[4];
Select one:
a. 16 Correct
b. 0
c. 4
d. 8
Feedback
The correct answer is:
16
.
Question 26
Incorrect
Mark 0.00 out of 1.00
Not flaggedFlag question
Question text
unsigned char a;
a=18;
a=a << 2;
What is the value of a?
Select one:
a. 72
b. 76
c. 16 Incorrect
d. 20
Feedback
The correct answer is:
72
.
Question 27
Correct
Mark 1.00 out of 1.00
Not flaggedFlag question
Question text
*(list)[i]=10+i; May be written as:
Select one:
a. *((*list)+i)=10;
b. *((*list)+10)=10+i;
c. *((*list)+i)=10+i; Correct
d. *((*list)+i)=i;
Feedback
The correct answer is:
*((*list)+i)=10+i;
.
Question 28
Incorrect
Mark 0.00 out of 1.00
Not flaggedFlag question
Question text
What is the value of 1 0 0 1 0 0 1 1 in fixed-point bit model?
Select one:
a. 2.275
b. 18.375
c. 18.25
d. I don't know Incorrect
Feedback
The correct answer is:
18.375
.
Question 29
Correct
Mark 1.00 out of 1.00
Not flaggedFlag question
Question text
Which program prompts the user for a positive integer and then computes the sum of all even digits. For
example, if the user enters 2784, the program should print 14, which is (2+8+4).
Select one:
a. #include <stdio.h>
main()
{
int n,sum,last_digit;
printf("Enter an integer: ");
scanf("%d",&n);
while (n > 0){
last_digit=n%10;
if ((last_digit%2) == 0)
sum=sum+last_digit;
n=n/10;
}
printf("The sum of its digits is %d\n",sum);
}
b. #include <stdio.h>
main()
{
int n,sum,last_digit;
printf("Enter an integer: ");
scanf("%d",&n);
sum=0;
while (n > 0){
last_digit=n%10;
if ((last_digit%2) == 0)
sum=sum+last_digit;
n=n/10;
}
printf("The sum of its digits is %d\n",sum);
}
Correct
c. #include <stdio.h>
main()
{
int n,sum,last_digit;
printf("Enter an integer: ");
scanf("%d",&n);
sum=0;
while (n > 0){
last_digit=n%10;
if ((last_digit%2) == 0)
sum=sum+last_digit;
n=n-10;
}
printf("The sum of its digits is %d\n",sum);
}
d. #include <stdio.h>
main()
{
int n,sum,last_digit;
printf("Enter an integer: ");
scanf("%d",&n);
sum=0;
while (n > 0){
last_digit=n%10;
sum=sum+last_digit;
n=n/10;
}
printf("The sum of its digits is %d\n",sum);
}
Feedback
The correct answer is:
#include <stdio.h>
main()
{
int n,sum,last_digit;
printf("Enter an integer: ");
scanf("%d",&n);
sum=0;
while (n > 0){
last_digit=n%10;
if ((last_digit%2) == 0)
sum=sum+last_digit;
n=n/10;
}
printf("The sum of its digits is %d\n",sum);
}
.
Question 30
Incorrect
Mark 0.00 out of 1.00
Not flaggedFlag question
Question text
Which one is not a way that a text editor can assist with writing program code (as opposed to writing
generic text using a word processor).
Select one:
a. Display the line number
b. Move the cursor to a matching brace
c. Highlight programming language keywords and reserved words Incorrect
d. Automatically adjust algorithms
Feedback
The correct answer is:
Automatically adjust algorithms
.
Question 31
Partially correct
Mark 0.33 out of 1.00
Not flaggedFlag question
Question text
#include <stdio.h>
#include <string.h>
main()
{
int i,a;
char s[3],t[2];
s[0]='B'; s[1]='c'; s[2]='\0';
t[0]='B'; t[1]='\0';
i=0; a=0;
while (a == 0)
{
if (s[i] < t[i]) a=-1;
if (s[i] > t[i]) a=1;
if (s[i] == '\0' || t[i] == '\0')
break;
i++;
}
printf("%d\n",a);
a=strcmp(s,t);
printf("%d\n",a);
}
second value of a
Incorrect
First value of a
Incorrect
last value of a
Incorrect
last value of i
Correct
Total memory space used by the program in bytes:
Correct
last value of t[0]
Incorrect
Feedback
The correct answer is: second value of a – 1, First value of a – 0, last value of a – 99, last value of i – 1,
Total memory space used by the program in bytes: – 13, last value of t[0] – 'B'.
Question 32
Correct
Mark 1.00 out of 1.00
Not flaggedFlag question
Question text
How many bytes does the following code occupies in memory?
int a[4][2];
Select one:
a. 8
b. 32 Correct
c. 16
d. 0
Feedback
The correct answer is:
32
.
Question 33
Incorrect
Mark 0.00 out of 1.00
Not flaggedFlag question
Question text
What is the total bytes declared in memory for the following code?
char a;
short int c;
double d;
a = 1; c = 1; d = 2.0;
Select one:
a. 17 Incorrect
b. 3
c. 4
d. 11
Feedback
The correct answer is:
11
.
Question 34
Incorrect
Mark 0.00 out of 1.00
Not flaggedFlag question
Question text
System software on a UNIX system performs the basic services as system software on a Microsoft
Windows system.
Select one:
True
False Incorrect
Feedback
The correct answer is 'True'.
Question 35
Incorrect
Mark 0.00 out of 1.00
Not flaggedFlag question
Question text
What is wrong with the following code:
#include <stdio.h>
#include <math.h>
main(int argc,char *argv[])
{
int n,i;
int d2,count,
double d1;
while (1)
{
printf("Enter a number (0 to quit): ");
scanf("%d",&n);
if (n == 0)
break;
count=0;
for (i=0; i<n; i++)
{
d1=(double)n/(double)i;
d2=n/i;
if (fabs(d1-(double)d2) < 0.00001)
count++;
}
if (count == 2)
printf("%d is prime\n",n);
else
printf("%d is not prime\n",n);
}
}
Select one:
a.
double d1;
b.
while (1)
Incorrect
c.
main(int argc,char *argv[])
d.
int d2,count,
Feedback
The correct answer is:
int d2,count,
.
Question 36
Correct
Mark 1.00 out of 1.00
Not flaggedFlag question
Question text
System software on a UNIX system performs the basic services as system software on a Microsoft
Windows system. However, there are some fundamental differences in how the system software is
designed and developed. Which one is not one of those:
Select one:
a. Virtual Correct
b. Modular
c. Monolithic
d. Proprietary code
Feedback
The correct answer is:
Virtual
.
Question 37
Correct
Mark 1.00 out of 1.00
Not flaggedFlag question
Question text
Unsigned int has a range of
Select one:
a. 0 to 256
b. 1 to 8
c. 0 to 4,294,967,295 Correct
d. 1 to 255
Feedback
The correct answer is:
0 to 4,294,967,295
.
Question 38
Correct
Mark 1.00 out of 1.00
Not flaggedFlag question
Question text
x = 0000 1001 What is x = x AND NOT (1«3);
Select one:
a. 0000 1001
b. 0000 0001 Correct
c. 0000 0011
d. 0000 1000
Feedback
The correct answer is:
0000 0001
.
Question 39
Incorrect
Mark 0.00 out of 1.00
Not flaggedFlag question
Question text
x = 0000 0001 What is x = x | (1«3);
Select one:
a. 0000 0001
b. 0000 1000
c. 0000 0011 Incorrect
d. 0000 1001
Feedback
The correct answer is:
0000 1001
.
Question 40
Incorrect
Mark 0.00 out of 1.00
Not flaggedFlag question
Question text
How many bytes does the following code uses in the memory?
struct ID {
int number;
float cost;
double *barcode;
};
Select one:
a. 16
b. 0
c. 12 Incorrect
No. This is template. If we define struct ID list; Then we are using memory.
d. 6
Feedback
The correct answer is:
0
Question textWhat is the last value of d[0]?
double d[3],*e;
e=&(d[1]);
d[0]=2.0;
*(e-1)=1.5;
*(e+0)=2.5;
Select one:
a. 0.0
b. 2.0
c. 2.5
d. 1.5
FeedbackThe correct answer is:1.5
.
Question 2Correct
Mark 1.00 out of 1.00
Flag question
Question textWhat is wrong with the following code:
#include <stdio.h>
#include <math.h>
main(int argc,char *argv[])
{
int n,i;
int d2,count,
double d1;
while (1)
{
printf("Enter a number (0 to quit): ");
scanf("%d",&n);
if (n == 0)
break;
count=0;
for (i=0; i<n; i++)
{
d1=(double)n/(double)i;
d2=n/i;
if (fabs(d1-(double)d2) < 0.00001)
count++;
}
if (count == 2)
printf("%d is prime\n",n);
else
printf("%d is not prime\n",n);
}
}
Select one:
a.double d1;
b.int d2,count,
c.while (1)
d.main(int argc,char *argv[])
FeedbackThe correct answer is:int d2,count,
.
Question 3Correct
Mark 1.00 out of 1.00
Flag question
Question textx = 0000 1001 What is x = x AND NOT (1«3);
Select one:
a. 0000 1000
b. 0000 0001
c. 0000 0011
d. 0000 1001
FeedbackThe correct answer is:0000 0001
.
Question 4Correct
Mark 1.00 out of 1.00
Flag question
Question text4 bits called ______.
Select one:
a. Half
b. Double
c. Nibble
d. Bubble
FeedbackThe correct answer is:Nibble
.
Question 5Correct
Mark 1.00 out of 1.00
Flag question
Question textWhat is the last value of d[1]?
double d[3],*e;
e=&(d[1]);
d[0]=2.0;
d[1]=0.0
*(e-1)=1.5;
e[0]=2.5;
Select one:
a. 1.5
b. 2.0
c. 2.5
d. 0.0
FeedbackThe correct answer is:2.5
.
Question 6Correct
Mark 1.00 out of 1.00
Flag question
Question textWhat is the last value of d2?
#include <stdio.h>
main()
{
struct ID {
int number;
float cost;
double *barcode;
};
struct ID list[3],*item;
float *f;
double d2;
d2=8;
list[2].number=12;
list[2].cost=44.11;
list[2].barcode=&d2;
item=&(list[2]);
f=&(item->cost);
d=item->barcode;
}
Select one:
a. 8
b. 889
c. 888
d. 9
FeedbackThe correct answer is:8
.
Question 7Correct
Mark 1.00 out of 1.00
Flag question
Question textHow can you fix the logical error here:
#include <stdio.h>
#include <math.h>
main(int argc,char *argv[])
{
int n,i;
int d2,count;
double d1;
while (1)
{
printf("Enter a number (0 to quit): ");
scanf("%d",&n);
if (n == 0)
break;
count=0;
for (i=1; i<n; i++)
{
d1=(double)n/(double)i;
d2=n/i;
if (fabs(d1-(double)d2) < 0.00001)
count++;
}
if (count == 2)
printf("%d is prime\n",n);
else
printf("%d is not prime\n",n);
}
}
Select one:
a.for (i=1; i<=n; i--)
b.for (i=1; i<=n; i++)
c.main(int argc[],char *argv[])
d.for (i=0; i<n; i++)
FeedbackThe correct answer is:for (i=1; i<=n; i++)
.
Question 8Correct
Mark 1.00 out of 1.00
Flag question
Question textAssume that our data type is magnitude-only bit model and it uses 4 bits. What would be the value range?
Select one:
a. 0 to 15
b. 0 to 256
c. 1 to 255
d. 1 to 4
FeedbackThe correct answer is:0 to 15
.
Question 9Correct
Mark 1.00 out of 1.00
Flag question
Question textint *ip; *(ip+7)=8; //If the &ip = 400, which address are we storing 8?
Select one:
a. 407
b. 402
c. 414
d. 428
FeedbackThe correct answer is:428
.
Question 10Correct
Mark 1.00 out of 1.00
Flag question
Question textIn sign-magnitude bit model 8 bits can represent range of ______.
Select one:
a. -8 to +8
b. -127 to +127
c. -128 to +127
d. 0 to 8
FeedbackThe correct answer is:-127 to +127
.
Question 11Correct
Mark 1.00 out of 1.00
Flag question
Question textA string is an array of char.
Select one:
True
False
FeedbackThe correct answer is 'True'.
Question 12Correct
Mark 1.00 out of 1.00
Flag question
Question textunsigned char a;
a=18;
a=a << 2;
What is the value of a?
Select one:
a. 72
b. 16
c. 20
d. 76
FeedbackThe correct answer is:72
.
Question 13Correct
Mark 1.00 out of 1.00
Flag question
Question textSystem software on a UNIX system performs the basic services as system software on a Microsoft Windows system. However, there are some fundamental differences in how the system software is designed and developed. Which one is not one of those:
Select one:
a. Modular
b. Proprietary code
c. Monolithic
d. Virtual
FeedbackThe correct answer is:Virtual
.
Question 14Correct
Mark 1.00 out of 1.00
Flag question
Question textSystem software on a UNIX system performs the basic services as system software on a Microsoft Windows system.
Select one:
True
False
FeedbackThe correct answer is 'True'.
Question 15Correct
Mark 1.00 out of 1.00
Flag question
Question textWhat is the last value of d[1]?
double d[3],*e;
e=&(d[1]);
d[0]=2.0;
*(e-1)=1.5;
*(e+0)=2.5;
Select one:
a. 1.5
b. 0.0
c. 2.0
d. 2.5
FeedbackThe correct answer is:2.5
.
Question 16Correct
Mark 1.00 out of 1.00
Flag question
Question textWhich one is magnitude-only bit model?
Select one:
a. float
b. unsigned char
c. char
d. int
FeedbackThe correct answer is:unsigned char
.
Question 17Correct
Mark 1.00 out of 1.00
Flag question
Question text*(list)[i]=10+i; May be written as:
Select one:
a. *((*list)+i)=10+i;
b. *((*list)+i)=i;
c. *((*list)+10)=10+i;
d. *((*list)+i)=10;
FeedbackThe correct answer is:*((*list)+i)=10+i;
.
Question 18Correct
Mark 1.00 out of 1.00
Flag question
Question textWhat is the binary representation for
char c=35;
Select one:
a. 01100011
b. 00100010
c. 00100011
d. 01000011
FeedbackThe correct answer is:00100011
.
Question 19Correct
Mark 1.00 out of 1.00
Flag question
Question textWhat is the total bytes declared in memory for the following code?
char a;
short int c;
double d;
a = 1; c = 1; d = 2.0;
Select one:
a. 3
b. 11
c. 4
d. 17
FeedbackThe correct answer is:11
.