Open navigation menu
Close suggestions
Search
Search
en
Change Language
Upload
Sign in
Sign in
Download free for days
0 ratings
0% found this document useful (0 votes)
134 views
30 pages
Code Tantra - 4
Code tantra unit 4 Solutions of c program Basics
Uploaded by
Syed Tahaseen
AI-enhanced title
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content,
claim it here
.
Available Formats
Download as PDF or read online on Scribd
Download
Save
Save Code Tantra _4 For Later
0%
0% found this document useful, undefined
0%
, undefined
Embed
Share
Print
Report
0 ratings
0% found this document useful (0 votes)
134 views
30 pages
Code Tantra - 4
Code tantra unit 4 Solutions of c program Basics
Uploaded by
Syed Tahaseen
AI-enhanced title
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content,
claim it here
.
Available Formats
Download as PDF or read online on Scribd
Carousel Previous
Carousel Next
Download
Save
Save Code Tantra _4 For Later
0%
0% found this document useful, undefined
0%
, undefined
Embed
Share
Print
Report
Download now
Download
You are on page 1
/ 30
Search
Fullscreen
creme The contents of PDF and text files are not stored as bits in a hard disk, Inconect! Inespective of the fle format (be HL PDF, Text, Image, Video or anything etse) datas stored as and 21 sonly Type of data (data type) determines how much memory will be allocated to the variable. Correct! In C, when the user wants to use a new variable, variable's data type must be declared before using it. Correct! If a text file contains only a decimal value 12, then the value 12 is stored as 1100 in its binary form Correct!@ When signed and unsigned are not specified, signed modifier is used as defau for every numeric data type. Conect!. int’ of signed int mean the same unsigned int specifies that both positive and negative numbers can be assigned to it. Incomectlt specifies that only positive numbers can be assigned ti short and long modifiers are used to modify the storage space allocated to variables. Correct! long and signed long mean the same. Correct!We can use an int data type to store a string. not. int data type can only store numenc values whe string |$ a collection of An int literal value can be a negative or a positive number within the range of -2'5 and 25-1. Correct! An int literal value can be enclosed within single or double quotes. No, we cannot. A single-quote Is used for character iiterals and a doudie-quote is used to enclose a string iteral 8 An int data type occupies 2 bytes of memory to store an integer value. Correct!terete We can use an int data type to store a string. No, we Cannot, int data type can c meric values while stnng isa An int literal value can be a negative or a positive number within the range of -2'5 and 215-1. Conectt An int literal value can be enclosed within single or double quotes. No, we cannot. A single-quote Is used for character Iitera's and a doudle-quote 1s used to enclose a sting hterai An int data type occupies 2 bytes of memory to store an integer value. Correct!finclude
y int -main() { int binaryThree = 3; »int octalEight cA sint hexTen = 10; -int asciivalueofone = 49; -int asciivalueOfa = 65; printf ("binaryThree value = $d\n"\, -binaryThree) ; printf ("octalzight -value = $d\n"", octalEight printf ("hexTen value = $d\n", printf ("asciivalueofone value printf ("asciivalueofa value = return, Average time Maximum time exTen) + §d\n"-, -asciivalueofone) ; d\n" asciivalueOfAa) ; 0.0715 fe 0.0718 — [)_-© 1 0ut of 1 shown test case(s) passed 71.00 ms 74.00 ms © Test case 1 Expected output binaryThree-value-=:3 octal£ight-value-=-8 hexTen-value-=-10 asciiValue0fOne-value = 49 asciiValueOfA:value-=-65 £8 Terminal Ey Actual output binaryThree value-=:3 octal£ight value-= 8 hexTen value= 10 asciiValueOfOne.value-=-49 asciiValueOfA:value:=-65@ Intdemo2.c 1 finclude «
2 y void: main() -{ 3 int -numl -=:15, num2 =-25, ‘sum; 4 printf ("Given integers are numl = %d, num2 = d\n", -numl, num2); 5 sum +-num2; 6 7 printf ("Sum-of 2-given numbers ‘= $d\n", -sum); 8 } Average time Maximum time 0057s | 0.0578 — [_—«@ 1 out of 1 shown test case(s) passed 57.00 ms 87.00 ms @ Test case 1 GD : Expected output Actual output Given: integers: are-numl:=-15, num2:= 25 Given integers :are-numl-=-15,-num2:=.25 Sum-of 2: given-numbers-=-40 Sum-of -2:given-numbers-=-40$$ ree eeetniecanaianenass G Intdemo2.c #include -<
Expected output Actual output Given: integers are-numl = 15, -num2 Given integers are-numl = 15, -nun2 = 25 Sum of 2 given:nunbers:=:40 Sum of 2-given-numbers-=-40See eect @ Intdemo3.c ° 1 tinelude > 2 y int maind { 3 sint signedvaluel = -20; 4 int signedvalue2 = 20; 5 unsigned int unsignedvaluel = 4294967295; 6 unsigned int unsignedVvalue2 = 1; 7 printf ("Given signed values are #d and ¢d\n",signedValuei, signedvalue2); 8 printf ("Given unsigned values are $u and $u\n", ‘un: Jaluel, unsignedValue2); saa Average tne 0.0715 [XL 0.0718 [© Tout of 1 shown test cases) passed Bias Fanos ——————— © Test case 1 CED cm -pD.- Expects ovtut fetus ouput Benet CEG@ IntDemo4.c 1 finclude
result = numl * -num2; 6 printf ("Product of ‘the given two numbers n", result ); 7 return 0; eed Average ume Maxum time 0066s | 0066s [7{__ © 1 out of 1 shown test case(s) passed eae Seow ee © Test case 1 GD. ey Expected output Actual output Given: integers are-numt = 5, -num2-=-7 Given. integers: are-numl =:5,-num2-=-7 Product -of the: given: two-numbers:=-35 Product of the -given-two-numbers:=-35 Btemina GEESE nul, -num2) ; D- le es ee ETTS 5 2 = nv - — G shortoe... a 2 3 4 5 6 7 2g tinclude
v int-main() -{ short int numberl-=-20, number2 30; *short ‘int ‘sub = -numberl -- ‘number2; printf ("Difference of the given two values = $d\n", sub); return 0°; Average time Maximum time 0.063s [LX 0.0635 ia 63.00 ms 63.00 ms © 1 out of 1 shown test case(s) passed ee , O Test case 1 GD cS Expected ouput Actual output D- Difference of the-given-tuo:values:=.-10 Difference-of ‘the given: tuo: values'=--10 BB Terria ON RS RITE BPEee ee The max value of a long is twice the max value of an int No, please read about “int) and, long” aqain Along can also represent decimal (fractional) numbers. No, a/ long’ can only represent integers and not fractional numbers Along literal value can be enclosed within single or double quotes. No, we cannot, A single-quote is used for character literals and a double-quote ts used to enclose a string literal Along literal value can be a negative or a positive number within the range of -25' and 231.1. Correct!G LongDem. tinclude
+long-int ‘numl = 123456L, num2 = 1234561; -long int result; printf ("Given integers are numl = $1d, num2-= $1d\n", numl, num2); result = numl + -num2; printf ("Sum of the given ‘two numbers = $1d\n",result ); 1 2 3 4 5 6 7 8 -return 0; 9 Average time Maximum time 0066s | 0.0668 [7) © Tout of 1 showntest case(s) passed 66.00 ms, 66.00 ms Sia el ipabuanaaanatieaaaeear @ Test case 1 : Actual output Given: integers are nunl =. 123456, nun2:= 123456 Given integers are-numt.=-123456, -num2-= 12345 ‘Sum-of the: given: two: numbers =:246912 Sum of the. given two-numbers: =. 246912 Btemint (Er eg eeeGLongdem oyanuswne #include
return 0; 8 ) Average time Maximum time 0055s [. 0055s [ZX @ 1 out of 1 shown test case(s) passed aes esoome —— @ Test case 1 GD cc -pD- Expected ourut Actual output Given float values are-numt.=/5,345000, -num2.--12. Given float values are-numl -=-5.345000, -nun2-= 12. 400000 400000 Result of division =-0,431048 Result of division-=.0.431048— Adouble data type occupies 8 bytes of memory. Correct! Adouble data type can have up to 10 decimal places for the fractional part. Incorrect! uses 14 decimal places for the fractional part Along double data type allocates 16 bytes of memory to the variables. Incorrect! It allocates 10 bytes of memory. Aouble data type uses 1 bit for sign, 10 bits for exponent value and 53 bits for mantissa part. ©) uses 1 bit for sign, 11 bits for exponent and 52 bits formantissa Incorrect! A aiDoubleDe. °& finclude
y int-main() -{ -double numl ~double num2 " 15.479000; 25.700000; double result = num2// numl; printf ("Given double values are -numi = %.6f, printf ("Result of dividing = $.6£\ printe (" num2 = %.6£\n" n", result); esult of dividing in exponential format )nunl, num2); 1, result); ~return 0; ) y Average ume ‘Maximum time ° 0.0608 [: 0.0608 {7 © 1outof 1 shown test case(s) passed . 60.00 ms 60.00 ms, © Test case 1 GD C= =D. Expected output Actual output Given double values are numt = 15.479000,-num2.= 2 Given-double values are num! = 15.479000, -num2:= 5.708000 5.700000 Result of dividing = 1.660314 Result of dividing 1.660314 Result of dividing in exponential format = 1.660314 Result of dividing in-exponential format = 1.650314 +00 e+00J DoubleDe.., @ { finclude
y int -main() ( : -double ‘numi = 15.34545, num2 = 12.4245; 1 ~double result = numl / num2; 5 printf("Given double values are numl = $f, num2 = ¢£\n", numl, -num2); 6 printf ("Result of division = $f\n", result); 7 return 0; 8 ) Average time Maximum time 0058s | 0058s |) © 1 out of 1 showntest case(s) passed 58.00ms 58.00 ms © Test case 1 ID D- Expected output Actual output Given-double: values are-numl =-15.345450, num2:= 1 Given-double values. are numl =,15.345450, -num2- 1 2.424500 2.424500 Result of division-= 1.235096 Result of division: =.1.235096remanence We can use char data type to store a sentence. No, we cannot, A sentence can include mulliple characters, however a “hag” data lype can represent anly a single character We can use char data type to store a single character. Correct! Achar constant can be enclosed within single or double quotes. No. Achar literal shouid only be enclosed in single quotes, The range of values for a char data type is -128 to +127. Correct!y Var went, aS @ ; tinclude
2 int-main() -( 3 char achar = 'A'; 4 schar tabChar = '\t'; 5 char
4 2 a 1 2 3 4 5 6 1 8 @ Charbel #include
y void main() -{ enum-month (JAN = 1, ‘FEB, MAR, APR, MAY, JUN, JUL, AUG, SEP, OUT, NOV, DEC); enum ‘month -d-= APR; r printé ("The ‘day ‘nunbs } rx stored in-d-is 4d\n", -d); 1 2 3 4 5 6 Average tme Maximum time 4.0518 fe 1.0518 — [7)__@ J outof 1 shown test case(s) passed 1081.00 ms 1051.00 ms © Test case 1 ESD aD -pD The day number: stored-in-d-15-4 Expected output Actual output ‘The: day-number-stored-in-d: 45-4EnumDe... ® include
y Void main) { enum day (sunday monday, wednesday, thur: day = 10, friday, saturday); »int sunday value = int ‘tuesday _value = 5; ; int ‘thursday value = 1 8 , Average time ‘Maximum: ° 0.0538 [0.0538 = [,_—« Tout of 1 shown test case(s) pas: 5 aarie [0089+ Ip, toute shomustcuas posses otras c= -D- Benn CEs | PO Se see eeD 5 :% < i Wy Enumerr, 1 2 3 4 5 6 #include
y int-main() -{ enum state {working = 1, failed printf ("$d, $d, $d\ return 0; 0, freezed = 0); , working, failed, freezed); Average time Maximum time 0056s fe 0.056s {X @ 1 out of 1 shown test case(s) passed eGo coon — © Test case 1 Expected output Actual output 1, @ 10,0 Bene CCD Poe eetvoid means empty. Correct! void allocates 2 bytes of memory to the void variables. Incorrect! void does not allocate any memory space void is used as return type of the function when a function does not return anything. Correct! void is a user-defined data type. Incortect! , #eid) 1S a Keyword used to denote an empty vaiue
You might also like
Python - Basics
PDF
No ratings yet
Python - Basics
124 pages
CLASS XII COMPUTER SCIENCE CH-2 Functions - PPT
PDF
No ratings yet
CLASS XII COMPUTER SCIENCE CH-2 Functions - PPT
46 pages
C Programming
PDF
100% (2)
C Programming
189 pages
Class 9 Question Paper New
PDF
No ratings yet
Class 9 Question Paper New
8 pages
Sree Muthukumaraswamy College: Department of Bca Object Oriented Programming Using C++ Lab
PDF
No ratings yet
Sree Muthukumaraswamy College: Department of Bca Object Oriented Programming Using C++ Lab
61 pages
PST - Unit 4
PDF
No ratings yet
PST - Unit 4
15 pages
Exception Handling: 1. Syntax Errors
PDF
No ratings yet
Exception Handling: 1. Syntax Errors
28 pages
Slide 05 - Input and Output
PDF
No ratings yet
Slide 05 - Input and Output
26 pages
Balu Sir New C PDF
PDF
No ratings yet
Balu Sir New C PDF
450 pages
Javalab File
PDF
No ratings yet
Javalab File
167 pages
Python Bca Qustion Banks Sem-5
PDF
No ratings yet
Python Bca Qustion Banks Sem-5
7 pages
Python UNIT III-Part-1
PDF
No ratings yet
Python UNIT III-Part-1
34 pages
Unit2 Input Output
PDF
No ratings yet
Unit2 Input Output
10 pages
Type Casting in C Language PDF
PDF
100% (2)
Type Casting in C Language PDF
6 pages
Unit Iii Loaders and Linkers
PDF
100% (1)
Unit Iii Loaders and Linkers
86 pages
Lecture Zero In108-Updated
PDF
No ratings yet
Lecture Zero In108-Updated
33 pages
Operators & Expressions
PDF
100% (1)
Operators & Expressions
39 pages
Case Study: Using MongoDB For An E-Commerce Platform
PDF
100% (8)
Case Study: Using MongoDB For An E-Commerce Platform
32 pages
Python Material Part1
PDF
100% (1)
Python Material Part1
37 pages
Lab03: Constructor and Destructor
PDF
No ratings yet
Lab03: Constructor and Destructor
9 pages
Notes of C++
PDF
No ratings yet
Notes of C++
96 pages
CFP Unit5 2024-25
PDF
No ratings yet
CFP Unit5 2024-25
46 pages
12 Exception
PDF
No ratings yet
12 Exception
27 pages
Programming Sheet - Infosys
PDF
No ratings yet
Programming Sheet - Infosys
10 pages
12 CS EM Kalviexpress Practical Hand Book
PDF
100% (1)
12 CS EM Kalviexpress Practical Hand Book
29 pages
Assignment Operators in C - C++
PDF
100% (1)
Assignment Operators in C - C++
3 pages
Basic Python Exercises
PDF
No ratings yet
Basic Python Exercises
2 pages
R2021 Python Lab
PDF
No ratings yet
R2021 Python Lab
48 pages
C Programming MCQ
PDF
No ratings yet
C Programming MCQ
206 pages
C Programming For Loop
PDF
No ratings yet
C Programming For Loop
3 pages
Assignment - C+++ - No - 01 To 16
PDF
No ratings yet
Assignment - C+++ - No - 01 To 16
16 pages
Accenture Crash Course 10 Free Mock Test Series 1698657849090
PDF
No ratings yet
Accenture Crash Course 10 Free Mock Test Series 1698657849090
1 page
C Tokens
PDF
No ratings yet
C Tokens
9 pages
PSTC Unit II
PDF
No ratings yet
PSTC Unit II
19 pages
Unary and Binary
PDF
No ratings yet
Unary and Binary
11 pages
Operators in Python
PDF
No ratings yet
Operators in Python
7 pages
Programming For Problem Solving-Notes
PDF
No ratings yet
Programming For Problem Solving-Notes
52 pages
Unit 4 - DT - Final
PDF
No ratings yet
Unit 4 - DT - Final
132 pages
Scenario 1 Java Programs
PDF
0% (1)
Scenario 1 Java Programs
1 page
Pop Module2 Notes
PDF
No ratings yet
Pop Module2 Notes
42 pages
Unit-4 Stream and Files: Input Device
PDF
No ratings yet
Unit-4 Stream and Files: Input Device
19 pages
CT Upto 17
PDF
No ratings yet
CT Upto 17
112 pages
PPL 50 Programs
PDF
No ratings yet
PPL 50 Programs
76 pages
Python Objective Questions For Beginners - CppBuzz
PDF
No ratings yet
Python Objective Questions For Beginners - CppBuzz
18 pages
BCSL-032 (2022-23) Solved Assignment
PDF
No ratings yet
BCSL-032 (2022-23) Solved Assignment
10 pages
Pps Code Tantra
PDF
No ratings yet
Pps Code Tantra
100 pages
Assignment 3 ALM 3
PDF
No ratings yet
Assignment 3 ALM 3
2 pages
Adv Dip in Computer Hardware and Netwark Management
PDF
No ratings yet
Adv Dip in Computer Hardware and Netwark Management
20 pages
C Program To Implement Evaluation of Postfix Expression Using Stack
PDF
0% (1)
C Program To Implement Evaluation of Postfix Expression Using Stack
2 pages
BB, Pe, Ce-111
PDF
No ratings yet
BB, Pe, Ce-111
80 pages
Recursion: Prof. Nilesh Gambhava
PDF
No ratings yet
Recursion: Prof. Nilesh Gambhava
13 pages
Final CE141 CCP Practical List
PDF
No ratings yet
Final CE141 CCP Practical List
11 pages
OSy Teaching Plan
PDF
No ratings yet
OSy Teaching Plan
10 pages
Unit 3 - Data Structures in Python
PDF
No ratings yet
Unit 3 - Data Structures in Python
10 pages
Week 4 Coding Assignment Name: Priyanka Indra Roll No.: 84 Dept: CSE Sem: 6
PDF
No ratings yet
Week 4 Coding Assignment Name: Priyanka Indra Roll No.: 84 Dept: CSE Sem: 6
11 pages
Relational Data Base Management System
PDF
No ratings yet
Relational Data Base Management System
3 pages
Object Oriented Programming in C++
PDF
No ratings yet
Object Oriented Programming in C++
4 pages
Consistency and Replication SLM
PDF
No ratings yet
Consistency and Replication SLM
25 pages
Elective 1 Journey Into Fundamentals and C Programming Concepts
PDF
No ratings yet
Elective 1 Journey Into Fundamentals and C Programming Concepts
3 pages
Reli Tivity
PDF
No ratings yet
Reli Tivity
16 pages
Adv C Slip 1 Solution
PDF
No ratings yet
Adv C Slip 1 Solution
4 pages
Some Numericals in CO-3
PDF
No ratings yet
Some Numericals in CO-3
11 pages
Instrumentation and Control: Experiment No. 1: Introduction To Tinkercad
PDF
No ratings yet
Instrumentation and Control: Experiment No. 1: Introduction To Tinkercad
3 pages
UNIT IV Functions Marks 14
PDF
No ratings yet
UNIT IV Functions Marks 14
2 pages
Vector Addition and Dot Product
PDF
No ratings yet
Vector Addition and Dot Product
6 pages
Slip16 (Employee Investment) (1 M)
PDF
No ratings yet
Slip16 (Employee Investment) (1 M)
3 pages
Notes 3 - 1
PDF
No ratings yet
Notes 3 - 1
10 pages