What will be the output of the program

Assignment Help C/C++ Programming
Reference no: EM13996294

1) What is the output of this C code?

#include <stdio.h>

int main()
{
int i = 0, j = 0; while (i < 2)
{
11: i++;
while (j < 3)
{
printf("loop\n");

goto 11;

}}}

a) Loop loop
b) Compile time error
c) loop loop loop loop
d) Infinite loop

2) What is the output of this C code?

#include <stdio.h>

int main()
{
int i = 0, j = 0;
while (11: i < 2)
{
i++;
while (j < 3)
printf("loop\n");

goto 11;

}}

a) loop loop
b) compile time error
c) loop loop loop loop
d) Infinite loop

3) The output of the code below is(When 1 is entered)

#include <stdio.h>
void main()

{

char *th;
printf("enter a value btw 1 to 3:");
scanf("%s", ch);

switch (th)

{ case 1:
printf ("1");

break.
case 2:
printf("2");

break; }}

a) 1
b) 2
c) Compile time error
d) No Compile time error

4) When 2 is entered, The output of the code below is?

#include <stdio.h>

void main() {
int ch;
printf("enter a value btw 1 to 2:");

scanf("%d", &ch);
switch (ch)

{
printf ("hi");
printf ("hello");
case 1:printf("1\n");

break;

printf("Hi");

default:printf("2\n");

}}

a) 1
b) Hi 2
c) Run time error
d) 2

5) When 1 is entered, The output of the code below is?

#include <stdio.h>

void main() {

int ch;
printf("enter a value btw 1 to 2:");

scanf("%d", &ch);
switch (ch, ch + 1,ch<=2)
printf("hi");

case 1:print-F("1\ n");break;
case 2:printf("2");break;

}}

a) 1
b) 2
c) 3
d) Run time error

6) What is the output of this C code?

#include <stdio.h>
int main() {
int 1= 0, j = 0;
11: while (i < 2)

{
i++;
while (j < 3) {
printf("loop\n");

goto 11;}}}

a) loop loop
b) Compile time error
c) loop loop loop loop
d) Infinite loop

7) What will be the output of the program?

#include<stdio.h>
int main()
{
const int 1=0;
Printf("%d\n", i++);

return 0;
}

a) 0
b) 1
c) error: can't modify constant object
d) Error: ++ needs a value

8) What will be the output of the program?

#include<stdio.h>

#define SQUARE(x) x*x
int main()
{
float s=10, u=30, 1=2, a;

a = 2*(s-u*W tat* attf "Result = %f", a);

return 0;
}

a) Result = -100.000000
b) Result = -25.000000
c) Result = 0.000000
d) Result = 100.000000
.

9) What will be the output of the program?

#include<stdio.h>
int main()
{
unsigned int res;
res= (64 >>(2+1-2)) & (~(1<<2));

printf("%d\n", res);
return 0;
}

a) 32
b) 64
c) 0
d) 128

10) what will be the output of the program?

void main()
{
int 1=2,j=3,k,l;

float a b;
k=i/j*j;
l=j/i*j;

a= i/j*j;
b=j/i*i;
printf("%d %d %f %f" k,l,a,b);
}

a) 3,0,0,0
b) 0,3,0.000000,2.000000
c) 0,0,0,0
d) error

11) what will be the output of the following program?

void main()
{
int a, b;
a=3--25;
b= -3 --(-3);
printf(" %d b= %d", a,b);
}

a) a=22,b=-6
b) a=-6,b=22
c) a=3,b=3
d) error

12) What will be output when you will execute following c code?

Choose all that apply:

#include<stdio.h>
void main(){
int x=-1,y=-1.;
if(++x=++y)
printf("R.I. ponting");

else

printf("C.H. Gayle");
}

a) R.T Ponting
b) C.H. Gayle
c) Warning: x and y are assigned a value that is never used
d) Warning: Condition is always true
e) Compilation error

13) What will be the output of the program?

#include<stdio.h>
int main()
{
int i=4, j=-1, k=0, w, x, y, z;
w= i || j || k;
x= i && j && k;

y = i || j && k;
z= i &&j || k;

printf("%d, %d, %d, %d\n", w, x, y, z);

return 0;
}

a) 1, 1, 1, 1
b) 1, 1, 0, 1
c) 1, 0, 0, 1
d) 1, 0, 1, 1

14) Comment on the following code below

#include <stdio.h>
void main()
{
int x = 5;
if (true);
printf("hello");
}

a) It will display hello
b) It will throw an error
c) Nothing will be displayed
d) Compiler dependent

15) The output of the code below is

#include <stdio.h>
void main()
{
int x = 5;
if (x < 1);
printf("Hello");
}

a) compile time error
b) Run time error
c) Hello
d) Varies

16) what is the output of the program?

void main()
{
printf("hai");
}
int main()
{
printf("hello");
return 0;
}

a) Hi
b) Hello
c) Compile time error
d) Nothing

17) The output of the code below is(when 1 is entered)

#include <stdio.h>

void main()
{
double ch;
printf("enter a value btw 1 to 2:");

scanf("%lf", &ch);
switch (ch)
{
case 1:printf("1");break;
case 2:printf("2");break;
}
}

a) Compile time error
b) 1
c) 2
d) Varies

18) What is the output of this C code?

#include <stdio.h>

void main()
{
int h = 8;
intb=4*6+3*4<3*4:3;

printf("%d\n", b);
}

a) 3
b) 33
c) 34
d) Run time error

19) What is the output of this C code?

#include <stdio.h>

void main()
{
char a = 'A'; char b = 'B';

int c = a + b %3 - 3 * 2;
printf("%d\n", c);
}

a) 65
b) 58
c) 64
d) 59

20) What is the output of this C code?

#include<stdio.h> int main()
{
printf("%c\n", ~('C'*-1));

return 0;

}

a) A
b) B
c) C
d) D

Reference no: EM13996294

Questions Cloud

Explain your own basis for making ethical decisions : Write a paper in which you explain your own basis for making ethical decisions. You are welcome to employ what you have learned from your study of traditional approaches, but you may also develop your own distinctive approach
What is the ratio of the frequency you hear : What is the ratio of the frequency you hear while the car is approaching to the frequency you hear while the car is moving away?
Are there vital ethical principles that it fails to mention : Summarize the features of this code and examine it critically. Are there vital ethical principles that it fails to mention? Does it overemphasize elements that are not really important? What large- or small-scale revisions might improve the code
What justifies the imposition of governmental authority : Should the government provide security by overcoming the selfish desires of the individual citizen, or should citizens cooperate voluntarily in service of the general welfare of all? What justifies the imposition of governmental authority on indivi..
What will be the output of the program : what will be the output of the program?
How far in meters does she fall in four seconds : The force due to air resistance is constant throughout the fall and is (0,10,0) N. How far (in meters) does she fall in 4 seconds?
Preparing a pro forma income statement : What specific prices, sales volumes, market shares, per pair costs, and profit margins it will probably take to achieve the strategic and financial objectives the company's management team has set.
Earnings as a result of this investment? : What pretax amounts did S&L include in its 2011 and 2012 earnings as a result of this investment?
Advantages and disadvantages of normative theories : Finally, discuss the advantages and disadvantages of these normative theories as methods for making moral decisions in practical cases. Use what you have written about the application of each theory to your example as evidence of the merits of eac..

Reviews

Write a Review

C/C++ Programming Questions & Answers

  Algorithm to be converted to c language

algorithm to be converted to c language

  Your main function will still prompt the user

Your main function will still prompt the user for the account number and service code. Based on the service code, main will ask for the correct number of minutes, then call your functions above as needed to finish the job. In addition you must.

  Write a preliminary version of the program

The last payment may be less than $50 if the debt is small, but do not forget the interest. If you owe $50, then your monthly payment of $50 will not pay off your debt, although it will come close. One month's interest on $50 is only 75 cents.

  What are reasons for using generics

Explain generics in C#. What are reasons for using generics? How do generics apply to collections? Write the code for a small example using C# code

  Modify the program to detect and report

Syntax errors including mismatched parentheses, invalid operator, missing comma, semicolon or assignment operator should be reported as a syntax error and the program should proceed to the next expression.

  Create a vector class implementing a number of vector

Create a Vector class incorporating the following features

  Calculates different formulas that converge to the number pi

Write a C program (Care should be taken not to use extensions of C + + language in your work ) that calculates different formulas that converge to the number  pi,  to compare the speed of convergence of these formulas. Each form will be calculated by..

  Help process applicants for a graduate degree in engineering

In this project, you will build a program used by an admissions office to help process applicants for a graduate degree in engineering.

  Write function displayscorethat write score underneath

Write a function displayScorethat writes a score underneath the target. Give it suitable parameters. You can use turtle.write() to display information on the turtle canvas.

  Develop a program for an auto dealership

You are to develop a program for an auto dealership. This program will keep track of the auto inventory using an array of objects. The dealer has a limit of 100 cars in inventory at one time due to space restrictions. The class used to instantiate..

  That takes the time as six integer arguments

Write a C function seconds_since_jan1() that takes the time as six integer arguments (year, month, day, hour, minute, and second) and returns the number of seconds since the beginning of the year.

  Assign any new integer value entered by the user

Build a program that allows a user to select one of the following four menu options: enter new integer value, print pointer address, print integer address, and print integer value. For this program you will need to create two variables: one integer d..

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd