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

  A charitable organization wants to design a special atm

A charitable organization wants to design a special ATM machine to be used by needy people.   The association supplies the needy person with a pin number to be able to use the ATM machine.   He/she can then retrieve up to $150 per day depending on..

  Null pointer problem

What is the only thing that you should ever do with the NULL pointer? In the following declaration, explain what type p is, and describe how it might be used.

  Write the entire definition for the main function

Write the entire definition for the main function that prints out all of the command-line arguments on its own line.

  Write a program that creates a picture of a mountain panoram

Write a program that creates a picture of a mountain panorama from a height profile entered by the user and Implement the picture as an array of 5 strings. Every string must initially be filled with 60 space symbols. Space symbols represent the sk..

  Write two short c programs and solve exam-style problem

Write two short C programs and solve four exam-style problems.

  Define a function hypotenuse that calculates the hypotenuse

Define a function hypotenuse that calculates the hypotenuse of a right triangle when the other two sides are given. The function should take two arguments and return the hypotenuse as a double.

  In competitive tournament

In competitive tournaments, it is common for all the players or teams to play in a series of matches in order to determine a single winner of the entire tournament. However, a number of different tournament formats exist. Here, we will concern our..

  Write a program to check whether a number is even or odd

Write a C++ program to check whether a number entered by user is even or odd.

  Your program will read the array

Your program will read the array from the file, check the diagonal and print a report containing the size and the status of the diagonal. A typical report would look like: The matrix is 3x3 and all the numbers on the main diagonal are the same.

  Write a c program that reads in two sets of numbers a and b

Write a C program that reads in two sets of numbers A and B, and calculates and print their union (AυB) and intersection (A∩B). (AυB) is the set of elements that appear in either A or B, and thatA∩B is the set of elements that appear in both A and B...

  Create a console program that calculates and displays

Create a console program that calculates and displays a person's annual salary over a specific number of years, starting in 2014. The user provides the:

  Calculates average of three exams for each student

The program reads the grades for students, calculates average of three exams for each student, and puts out to another file (called Summarygrades.txt) Student ID average and letter grade: example below,

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