Write a C program Reading and Writing data using Scanf() and Printf() statement -Technology

1 Answer

Answer :

#include <stdio.h>int main(){ char ch; char str[100]; printf('Enter any character '); scanf('%c', &ch); printf('Entered character is %c ', ch); printf('Enter any string ( upto 100 character ) '); scanf('%s', &str); printf('Entered string is %s ', str);}OUTPUT:Enter any characteraEntered character is aEnter any string ( upto 100 character )haiEntered string is hai

Related questions

Description : State the use of printf( ) & scanf( ) with suitable example.

Last Answer : printf( ) & scanf( ): printf() and scanf() functions are library functions in C programming language defined in stdio.h . printf() function is used to print the character, string, float, integer, octal and hexadecimal ... number"); scanf("%d",&i); printf("Entered number is: %d",i); getch(); }

Description : Scanf (“% d”, & a); Explain the statement. ?

Last Answer : Scanf (“% d”, & a); The statement is explained below: Here ,% d is the memory location of the integer type a variable where the data will be stored.

Description : What is wrong in this statement? scanf(“%d”,whatnumber);

Last Answer : An ampersand & symbol must be placed before the variable name whatnumber. Placing & means whatever integer value is entered by the user is stored at the “address” of the variable name. This is a common mistake for programmers, often leading to logical errors.

Description : What will be the output of the following segment of the program? main( ) { char *s = “hello world”; int i = 7; printf(“%, *s”, i, s); } (A) Syntax error (B) hello w (C) hello (D) o world

Last Answer : Answer: Marks given to all

Description : How many times the word 'print' shall be printed by the following program segment? for(i=1, i≤2, i++) for(j=1, j≤2, j++) for(k=1, k≤2, k++) printf("print/n") (A) 1 (B) 3 (C) 6 (D) 8

Last Answer : (D) 8

Description : What is the output of the following program ? (Assume that the appropriate pre-processor directives are included and there is no syntax error) main() { char S[ ] = "ABCDEFGH"; printf ("%C",* (& ... Base address of S is 1000 */ } (A) ABCDEFGH1000 (B) CDEFGH1000 (C) DDEFGHH1000 (D) DEFGH1000

Last Answer : (D) DEFGH1000

Description : printf ("%" d,% x ", & b); Explain the statement ?

Last Answer : printf ( % d,% x , & b); Here , the printf statement displays the output function printf () function as a variable data result of different data types. The C program is used to ... b respectively which indicates the memory location of integer type a and b variables where data will be stored.

Description : What kind of mistake is it to write print f instead of printf and why ?

Last Answer : Write print f instead of printf, the syntax is wrong. If the syntax is wrong then the language in which the program is written is grammatically incorrect. As can be seen , the word Printf ... error. This error is easily detected when translating with a compiler and sends a message to the computer.

Description : Explain the use of %i format specifier w.r.t scanf().

Last Answer : Can be used to input integer in all the supported format.

Description : What are the functions of Printf () and Getch () function ?

Last Answer : The most commonly used function as an output statement in C language is printf (), which can be used to display various types of data (such as int, Char, float, etc.), including strings or strings ... programming . That is, both print () and getch () act as essential functions for C programming .

Description : printf() Function- What is the difference between "printf(...)" and "sprintf(...)"?

Last Answer : sprintf(...) writes data to the character array whereas printf(...) writes data to the standard output device.

Description : What is the output of printf("%d")?

Last Answer : 1. When we write printf("%d",x); this means compiler will print the value of x. But as here, there is nothing after ï ½%dï ½ so compiler will show in output window garbage value. 2. When we ... an error without the proper number and type of arguments for things like printf(...) and scanf(...).

Description : Trace the error: void main( ) { int *b, &a; *b = 20 printf(“%d, %d”, a, *b) } (A) No error (B) Logical error (C) Syntax error (D) Semantic error

Last Answer : (C) Syntax error

Description : What will be the output of the following ‘C’ code ? main ( ) { int x = 128; printf (“\n%d”, 1 + x++); } (A) 128 (B) 129 (C) 130 (D) 131

Last Answer :  (B) 129

Description : The process of copying data from a memory location is called a.reading b.writing c.controlling d.hand shaking

Last Answer : a.reading

Description : The process of putting data into a storage location is called a.reading b.writing c.controlling d.hand shaking

Last Answer : b.writing

Description : Which of the smart card uses a sim like structure for reading and writing data a) Contact smart card b) Contactless smart card c) Proximity smart card d) Both B and C

Last Answer : a) Contact smart card

Description : The smart card which use antenna for reading and writing data a) Contact smart card b) Contactless smart card c) Proximity smart card d) Both B and C

Last Answer : d) Both B and C

Description : ……. is an electronic device that manipulates information or data according to the set of instructions called program. -Technology

Last Answer : Computeris an electronic device that manipulates information or data according to the set of instructions called program.

Description : Which program do you need to write HTML code? (a) Spreadsheet (b) Access -Technology

Last Answer : (c) From the given options, Notepad is useful program to write HTML code.

Description : Write a Numpy program to create a 3x3 identity matrix, i.e. diagonal elements are 1, the rest are 0. Replace all 0 to random number from 10 to 20 -Technology

Last Answer : import numpy as nparray1=np.identity(3)print(array1)x=np.where(array1==0)for i in x:array1[x]=np.random.randint(low=10,high=20)print(array1)

Description : Write a Numpy program to create a 3x3 identity matrix, i.e. non diagonal elements are 1, the rest are 0. Replace all 0 to random number from 1 to 10 -Technology

Last Answer : import numpy as npZ = np.arange(9).reshape(3,3)print (Z)x=np.where((Z%2)==0)for i in x:Z[x]=np.random.randint(low=10,high=20)print(Z)

Description : Write a numPy program to create a numPy array with all values as True printed 10 times. -Technology

Last Answer : This answer was deleted by our moderators...

Description : Consider a given Series , M1: Write a program in Python Pandas to create the series. -Technology

Last Answer : import pandas as pdm1=pd.Series([45,65,24,89],index=['term1','term2','t erm3','term4'])

Description : Write a program in Python Pandas to create the following DataFrame batsman from a Dictionary: B_NO Name Score1 Score2 -Technology

Last Answer : Alternative Answer

Description : While writing HTML code, how do you find out how your Web page would look like? -Technology

Last Answer : For this, open the HTML code file in a Web browser.

Description : Help him in writing SQL query for the following purpose: (i) To count how many female candidates will be attending the training. -Technology

Last Answer : (i)Select count(name) from training where name like ‘Ms.%’;(ii) Select * from training where fee is NULL;(iii) Select city, fee from training where topic = ‘Cyber Security’;(iv) Alter table training add feedback varchar(20);

Description : A ……… is a thumb sized gadget that can be used to read, write or erase data as many times. -Technology

Last Answer : .A pen driveis a thumb sized gadget that can be used to read, write or erase data as many times.

Description : Write one example of data for which Memo data type is used. -Technology

Last Answer : To store resume of an employee in Employee table is an example of Memo data type.

Description : Write one example of data field for which you would set the Required property to Yes? -Technology

Last Answer : In a table, when we declare a field as a primary key, then the field’s Required property must be set to Yes because, in a primary key field, we need to enter data always.

Description : Write one example of each field, for which you would use 1. Text data type -Technology

Last Answer : 1. Text data type It allows to store text or combination of text and numbers as well as numbers that don't require calculations such as phone number. This data type allows maximum 255 characters ... Description will be of Memo data type, because the length of description of employee may be large.

Description : Write an XML document that marks up the following data: All these must be rendered -Technology

Last Answer : Raj Kumar Delhi Pankaj Mumbai Rahul Sharma Delhi Praveen Noida

Description : Write a small python code to drop a row from data frame labeled as 0. -Technology

Last Answer : # Drop rows with label 0df = df.drop(0)print(df )

Description : Write a python code to create a data frame with appropriate headings from the list given below : -Technology

Last Answer : import pandas as pd# initialize list of listsdata = [['S101', 'Amy', 70], ['S102', 'Bandhi', 69], ['S104','Cathy', 75], ['S105', 'Gundaho', 82]]# Create the pandas DataFramdf = pd.DataFrame(data, columns = ['ID', 'Name', 'Marks'])# printdataframe. print(df )

Description : (i) Write command to compute sum of every column of the data frame. -Technology

Last Answer : (i) df1.sum()(ii) df1[‘Rainfall’].mean()(iii) df1.loc[:11, ‘maxtemp’:’Rainfall’].mean( )

Description : Write the code in python to read the contents of “number.csv” file consisting of data from a mysql table and print the data of the table -Technology

Last Answer : f = open('numbers.csv', 'r') with f:reader = csv.reader(f)for row in reader:for e in row:print(e)

Description : Write the data type of variables that should be used to store : 1. Marks of students 2. Grades of students (Grade can be ‘A or ‘B’ or ‘C’) -Technology

Last Answer : (i) int data type(ii) char data type

Description : Write a statement in HTML that inserts an image named ‘school.jpg’ found in the ‘images’ folder of the current folder. -Technology

Last Answer :

Description : “Virtual schools are better than traditional schools.” Write reasons to support this statement. -Technology

Last Answer : A virtual school is a learning environment offered entirely on the Internet. All student services and courses are conducted through Internet technology. The virtual school differs from the traditional school ... properly socially.5. Students would not receive personal one-on-one time with teachers.

Description : Write java statement to make the Net Fee text field named txtNetFee un_editable at run time. -Technology

Last Answer : txtNetFee.setEditable(false);

Description : Consider the following python code and write the output for statement S1 import pandas as pd -Technology

Last Answer : 0.50 8.00.75 11.0

Description : State True or False. i) In spooling high speed device like a disk is interposed between running program and low-speed device in Input/output. ii) By using spooling for example instead of writing directly to a printer, ... ii-False B) i-True, ii-True C) i-False, ii-True D) i-False, ii-False

Last Answer : B) i-True, ii-True

Description : Rewrite the following code using switch statement : -Technology

Last Answer : Given code using switch statement :switch (code){case A ;allowance = 3500 ;break ;case B ;allowance = 3200 ;break ;default ;allowance = 2000 ;break ;}

Description : Write any two advantages of using database. -Technology

Last Answer : 1. Can ensure data security.2. Reduces the data redundancy.

Description : Define database management system. Write two advantages of using database management system for school. -Technology

Last Answer : Database Management System (DBMS) is a collection of programs that enable users to create, maintain database and control all the access to the database. The primary goal of the DBMS is to ... centralized location.2. It provides security to the personal information of the school, stored in it.

Description : Write down the name of the freehand drawing tools which are using when custom shapes can be drawn. -Technology

Last Answer : Curve, Freeform and Scribble are the three freehand drawing tools which are using when custom shapes can be drawn.

Description : Write the advantages of using Unicode to represent text. -Technology

Last Answer : Unicode encoding standard provides the basis for processing, storage and interchange of text data in any language in all modern software and information technology protocols.

Description : Write the command using Insert() function to add a new column in the last place(3rd place) named “Salary” from the list Sal=[10000,15000,20000] -Technology

Last Answer : EMP.insert(loc=3,column=”Salary”,value=Sal)

Description : Write the code given below using ‘for’ loop instead of ‘while’ loop : -Technology

Last Answer : The given code using ‘for’ loop instead of ‘while’ loop :int ifor (i = 1 ; i < = 5 ; i + +){if (1 * i = = 4)jTextFieldl. setText ( “ “ + i) ;}

Description : Write the advantages of using Unicode to represent text. -Technology

Last Answer : Advantages of using Unicode to represent text are as follows :1. Allows for multilingual text using any or all the languages that you desire.2. Text in any language can be exchanged worldwide