Write one line of code to open a file

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

Assignment -

Problem 1. To make scanf( ) return an end-of-file EOF, enter ____________________________ from the keyboard.

Problem 2. Given unsigned short int ix = -65; write out the 16 bits stored in variable ix, most significant bit first.

Problem 3. What is printed to the display?

#include <stdio.h>

main( ) {

unsigned int x=17, y=24;

printf( "%d\n", (unsigned int)(x & y) );

}

Problem 4. What is printed to the display?

#include <stdio.h>

main( ) {

unsigned int x=17, y=24;

printf( "%d\n", (unsigned int)(x && y) );

}

Problem 5. What is printed to the display?

#include <stdio.h>

main( ){

int a=1,b=2;

b=a++;

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

}

Problem 6. What would be the output from the code segment below?

switch ( 'b' ) {

case 'a':

printf("a\n");

case 'b':

printf("b\n");

default:

printf("default");

}

Problem 7. Which statement or statements below assign zero to the variable "result" ?

(a) result = 9%3 - 1;

(b) result = 8%3 - 1;

(c) result = 2 - 6%2;

(d) result = 2 - 8%3;

(e) none of the above

Problem 8. Given the code segment below, would the printed value be positive, negative, or zero?

char v1[ ] = "abc", v2 = "abC";

printf(%d\n",strcmp(v1,v2));

Problem 9. Write down EXACTLY what is printed to the screen by the program below.

#include <stdio.h>

main( ) {

int i=2;

printf( "i/3=%4.2f\n",(float)(i/3) );

}

Problem 10. What is printed out to the screen by the following code segment?

i=2;

printf("%d\n", (i%3) ? i: 2*i);

Problem 11. Circle ALL that are true: "Every C program must contain ..".

(a) at least one #include statement.

(b) at least one return statement.

(c) at least one preprocessor directive.

(d) at least one variable.

(e) at least one main function argument.

Problem 12. What will be printed to the screen?

#include <stdio.h>

#include <string.h>

main( ) {

char s1[ ] = "star search", s2[ ] = "axqezwars";

printf("%s\n",strncpy(s2,s1,5));

}

Problem 13. What would be printed out by the program below?

#include <stdio.h>

#define Three(x) x*3

main( ){

printf("%d\n",Three(3-1));

}

Problem 14. What would be printed out by the code segment below?

float *pf;

double * pd;

printf("%d\n",sizeof(pd)-sizeof(pf));

Problem 15. What would be printed to the screen by the program below?

#include <stdio.h>

void funct(int x, int y){

x=3;

y= 2*x;

}

main( ){

int x=2,y=2;

funct(x,y);

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

}

Problem 16. Write down the output produced by the following code fragment.

for (i = 2; i < 4; ++i){

for (j = 2; j < 4; ++j){

if (i > j)printf("0");

else if (i < j)printf("1");

else if(i+j==4)printf("0");

else printf("2");

}

printf("\n");

}

Problem 17. What will be printed by the program below?

#include <stdio.h>

main( ) {

signed char i = -8, j;

j = i >> 1;

printf("%d\n",j);

}

Problem 18. Write one line of code to open a file called "myfile.txt" located in the folder "myfolder" on the "D:" partition of the drive. Open the file for reading using file pointer fp.

FILE * fp;

Problem 19. Write one printf( ) statement to print out the value of a float variable x using three digits past the decimal point left-justified in a field of width 12 characters.

Problem 20. Write two program statements: one statement to read-in a word entered by the user from the keyboard, store it in v[ ], and one statement to printout the number of characters in the word.

char v[100];

printf("Please enter a word\n");

Problem 21. Write a printf( ) statement that prints the memory address where variable dx is stored to the screen.

double dx=1.0;

Problem 22. Write a function declaration for a subroutine mysub( ) that receives a FILE pointer as input and returns a float value.

Problem 23. Write a function definition for a subroutine mysub( ) that receives two strings as input and returns an integer 1 if the second string is completely contained anywhere within the first string, and that returns an integer 0 if it is not.

Problem 24. #include<stdio.h>

main(){

int a[3]={7,8,9};

int *ptr;

// Write a single statement here so that the integer_pointer ptr points to the value 8 in the integer array a[]

}

Problem 25. Write a program to:

(a) Read in a line of text entered by the user from the keyboard. The user may type in tabs, blanks spaces, and any characters whatsoever followed by the Enter key.

(b) If the line of text does not contain at least two commas, print the phrase "Data Entry Error" to the display.

(c) Note that the two commas might occur one-right-after-the-other. If the first two commas in the line of text occur one-right-after-the-other, print the phrase "Missing Field" to the display.

(d) If the first two commas in the line of text are separated by some text, print that text to the display. Note, the text between the first two commas may include tabs or blank spaces.

Attachment:- Assignment Files.rar

Reference no: EM132245706

Questions Cloud

What are the possible differential diagnoses at given time : It is anticipated that the initial discussion response should be in the range of 250-300 words. Response posts must demonstrate topic knowledge and scholarly.
Review the essential elements of a fetal assessment : Review the essential elements of a fetal assessment during the last trimester of pregnancy. What are the clinical indicators of fetal well being.
In what areas can the practitioner improve : In what areas can the practitioner improve? At this point in the clinical interview, do you have any compelling concerns? If so, what are they?
New product development project : For this assignment you are to develop a new product concept and research the demand, proposed product attributes,
Write one line of code to open a file : Write one line of code to open a file called "myfile.txt" located in the folder "myfolder" on the "D:" partition of the drive
Evaluate management tools used in the organization : Evaluate management tools used in the organization, indicating potential strengths and weaknesses.
Describe one adult learning theory that is not covered : Write a four-five page paper that describes one adult learning theory that is not covered in the textbook how that theory incorporates.
Write the executive summary section of your strategic audit : Write the Executive Summary section or the beginning of your Strategic Audit Report.
Examine the decision-making process in business : Examine the decision-making process in business and its importance. Provide an example of a business decision based on multiple choices made.

Reviews

Write a Review

C/C++ Programming Questions & Answers

  C programme to find the minimum and maximum value

write a c programme to find the minimum and maximum value each elements in each row ,to create table b,having 5 rows and 2 coloums,the first coloum of table b is the maximumvalue and thye second coloum is the maximum value in each row.

  Write a function to compute the number of combinations that

You are given coins of different denominations and a total amount of money. Write a function to compute the number of combinations that make up that amount. You may assume that you have infinite number of each kind of coin.

  Partial implementation of the overloaded assignment

You have a class called MyBag that contains this partial implementation of the overloaded assignment operator.  The first line is missing.

  Complete the 8 queens 2 dimensional array

Complete the 8 queens 2 dimensional array program with backtracking. please change the below program using backtracking  and please run before posting it . the program suppose to print 92 solution . amd also comment before each line to better unde..

  Compares the number of possible sequences

A c++ program that compares the number of possible sequences of the length L that can be generated uinder the following assumptions. Given an alphabet of size N=9. The program must output a formatted list comparing the number of possible sequences..

  Displays all the numbers

write a java program that displays all the numbers from 100 to 200, ten per line, that are divisible by 5 and 6 .

  Create a pseudocode

Create a pseudocode using if instruction containing a compound condition that will satisfy the following: When STATE is equal to TX and CITY is Dallas, display "This person is a Dallas Texan

  Calculate the volume flow rate in cubic feet

Write a program to calculate the volume flow rate in cubic feet per second of water flowing through a pipe of diameter d in inches and a velocity of v feet per second. The formula for the flow rate is given by: Where area = ?d^2 / 4 equation in sq..

  Create an array for the current word read from the file

Some word games require the player to find words that can be formed using the letters of another word. For example, given the word SWIMMING, other words.

  Calculate and display the found occurrences of the substring

Ask the user for a substring to search for. Calculate and display the found occurrences of the substring in the file.

  Design a calculator program

Design a calculator program that will add, subtract, multiply, or divide two numbers input by a user

  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..

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